Blockchain database schemas


An input in Core is represented by the CTxIn class, which looks like this:. Many different variations on how to optimize operations were attempted, for example using an expression index to only index a subset blockchain database schemas a hash first 10 bytes are blockchain database schemas statistically uniqueetc. Same is true with respect to transaction id. Blocks and transactions are indexed by id as their primary index.

Coinbase outputs are the sum of all the fees and the miner reward. This is an easily justifiable optimization, blockchain database schemas it to lookup the input transaction would require first finding the transaction integer id. Any block that this walk does not visit is an orphan. Blockchain database schemas post documents the latest incarnation of the SQL schema used to store the blockchain as well as thoughts on why it was decided to be this way.

Any block that this walk does not visit is an orphan. In a previous post I wrote some initial thoughts on storing the blockchain in Postgres. The COutPoint class blockchain database schemas a combination of a hash and an integer representing an output.

Coinbase is a special transaction where the inputs refer to a non-existent transaction hash of all zeros. Witness is stored at blockchain database schemas end of a transaction as a list where each entry corresponds to an input. The implication being that when the hash is printed e.

There is also an ambiguity in how the hash is printed versus how it is stored. In the blockchain blocks and transactions are always referred to through their hash. Columns orphan blockchain database schemas, statusfilen and filepos are from the CBlockIndex class which is serialized in LevelDb and not formally part of the blockchain.