Skip to main content

Overview

BlockHeader contains all metadata for a block including Merkle roots, gas limits, timestamps, and consensus-related fields. The block hash is computed from RLP(header).
// Obtain block header via JSON-RPC; map fields from hex to Zig types.
// {"method":"eth_getBlockByNumber","params":["latest",false]}

Type Definition

// Core fields: parentHash, stateRoot, transactionsRoot, receiptsRoot, logsBloom, gasLimit, gasUsed, timestamp, baseFeePerGas, withdrawalsRoot, blobGasUsed, excessBlobGas, parentBeaconBlockRoot

Creating BlockHeader

from

Universal constructor with all header fields.
// Map fields per fork as needed: London (baseFeePerGas), Shanghai (withdrawalsRoot), Cancun (blobGasUsed, excessBlobGas, parentBeaconBlockRoot).

Header Fields by Fork

Genesis (All Blocks)

FieldDescription
parentHashHash of parent block
ommersHashHash of ommers list RLP
beneficiaryBlock reward recipient
stateRootState trie root after execution
transactionsRootTransactions trie root
receiptsRootReceipts trie root
logsBloom256-byte bloom filter for logs
difficultyPoW difficulty (0 post-merge)
numberBlock height
gasLimitMax gas for block
gasUsedTotal gas consumed
timestampUnix timestamp (seconds)
extraDataArbitrary data (max 32 bytes)
mixHashPoW mix hash (0 post-merge)
noncePoW nonce (0 post-merge)

EIP-1559 (London Fork)

FieldDescription
baseFeePerGasDynamic base fee per gas

Shanghai Fork

FieldDescription
withdrawalsRootMerkle root of withdrawals

EIP-4844 (Cancun Fork)

FieldDescription
blobGasUsedTotal blob gas used
excessBlobGasExcess blob gas for pricing
parentBeaconBlockRootBeacon chain parent root

Post-Merge Changes

After The Merge, several fields are deprecated but still present:
// Post-merge: difficulty = 0, nonce = 0; mixHash holds RANDAO reveal

See Also