Block Headers are the meta data of each block on a blockchain. They contain details such as nonce value, hash of previous block, timestamp, difficulty target, etc.
Block headers play a crucial role in the blockchain’s safety.
Once the block header is assembled, it is hashed to obtain block hash or block ID which is unique for every block in the blockchain.
Table of Contents
Components of a Block Header
A block header is composed of several data points below.
1. Version Number
Version number is the identifier of the format of the block which is in use for that blockchain. Formats change after soft forks and hard forks.
Format numbers are incremental and they increase as the block height progresses.
2. Previous Block Hash
Hash is the result of running all the information in the block through a hashing function. Usually, hashes of a block are the Merkle Roots of the block.
The hashing function is a non-reversible function which means that once you can get a hash out of some information but you cannot get back the original information by reversing the hash function or by any means.
For example, you make an apple pie (similar to a hash value) from flour, sugar and apple (similar to transactions details, merkle root and previous block’s header), but you cannot recreate the apple from the apple pie.
3. Merkle Root
A merkle root is the hash of all the values of preceeding transactions in a blockchain. To obtain a merkle root, transactions are hashed in pairs till the time there is just a single merkle root derived from all transactions.
This is a very crucial component of blockchain security because any change in any element in the Merkle Tree would change the value of the end Merkle Root.
4. Timestamp
A timestamp records the time when a block was created. Different blockchains have different methods of adding timestamps to a block. In most cases these timestamps are added by the miner. However, in the case of Proof of History, there is a function called the Verifiable Delay Function (used in Solana) which automatically adds timestamps to each block.
5. Difficulty Target
Difficulty target specifies the level of difficulty that a validator (who verifies transactions) must encounter and overcome to get the nonce value for that block.
6. Nonce Value
A nonce value is a number that is used to find a hash that meets the difficulty target. This nonce value is generated in several ways.
In Bitcoin a nonce value is obtained by selecting a random number and incrementing it till the resultant hash meets the difficulty target.
In Ethereum this nonce value is obtained by validators by putting down a collateral which is seized if they introduce errors in the blocks.
In Proof of Capacity consensus mechanism, nonce values are stored in the local disk of the validator in advance. The validator just has through scan the local disk to obtain it.