Deep Dive
Some low level explainers and examples to improve understanding.
Last updated
Some low level explainers and examples to improve understanding.
Last updated
Storage gets really expensive when you have billions of transactions to store - just ask any miner.
The total cumulative size of all blockheaders is currently ~68MB. When comparing this to storing the whole blockchain, the advantage becomes obvious. The total size of the BSV blockchain at time of writing is over 10TB.
A block header is an 80 byte data structure which describes one block. As a hex string it looks like this:
Here's a breakdown of what all that means:
0020372d395bfcfc03b467e747f873da7e4f4fd0afcc89301787b10a0000000000000000724ab3c241848b826766b46947e008e022b95877629498ec3e7dd85f1ae0b383f8f8826566280d184b11f02a
The Previous Block Hash allows us to link the chain of blocks together all the way back to Genesis.
You might ask how do I know that the block header is valid if I don't have all the transactions? The easy way to detect fake block headers is to hash it, and if it doesn't have a bunch of zeros at the end then it is not legitimate. Creating a block header which hashes to a low number requires a boatload of ASIC machines iterating the nonce and hashing until a low output is found. Expensive to fake.
In MacOS Terminal we can copy paste the following to double sha256 the data and output the hash.
The result of which is below. See the bunch of zeros on the end? Seems legitimate.
Let's attempt to fake the Merkle Root to show how difficult it would be to get away with.
Again let's copy paste that into Terminal so that we can check the double sha256 block hash.
The result makes the forgery obvious, no zeros at the end.
If we fake this one block header and use some ASIC machines to hash it a bunch until we eventually get a low hash value, then we would need to do the same for every block header thereafter since they're all chained together. This quickly becomes infeasible.
The Merkle Root is what we compare to the calculated value we get from our txid and Merkle Path. If it matches, then we have definitive proof that the transaction was indeed included within the block with that header.
Field | Purpose | Size (Bytes) |
---|---|---|
Version
Defines the version of this encoding format
4
Previous Block Hash
Hash of the previous block header
32
Merkle Root
Hash encapsulating all transaction in the block
32
Time
Timestamp of when this block was created
4
Bits
Difficulty target used by miners
4
Nonce
Random number iterated while mining
4