Ethereum block header — the consensus-critical metadata for a block. A pure
data carrier; validation lives in EEVM.Block.Processor.
Fields
| Field | Description |
|---|---|
number | Block number (height on the chain) |
parent_hash | Keccak hash of the parent header |
timestamp | Block timestamp in seconds since epoch |
coinbase | Address of the block producer (fee recipient) |
gas_limit | Maximum cumulative gas the block may consume |
base_fee_per_gas | EIP-1559 base fee |
prev_randao | RANDAO mix inherited from the beacon chain (post-Merge) |
parent_beacon_block_root | EIP-4788 beacon root pointer from the parent slot |
state_root | Post-execution world-state MPT root |
receipts_root | MPT root of {rlp(index) => rlp(receipt)} |
transactions_root | MPT root of {rlp(index) => rlp(transaction)} |
logs_bloom | 256-byte bloom summarising every log in the block |
gas_used | Total gas the block's transactions consumed, as declared by the producer |
extra_data | Arbitrary producer bytes (at most 32 bytes on mainnet) |
difficulty | Proof-of-work difficulty (always zero post-Merge) |
hash | Keccak hash of this header, as supplied by the caller (not computed here) |
nonce | 8-byte proof-of-work nonce (all zero post-Merge) |
ommers_hash | Keccak hash of the RLP ommers list (the empty-list hash post-Merge) |
blob_gas_used | EIP-4844 blob gas consumed by the block; nil before Cancun |
excess_blob_gas | EIP-4844 running excess blob gas; nil before Cancun |
Summary
Functions
Returns the ommers hash of a block with no ommers, keccak256(rlp([])),
which every post-Merge header carries.
Returns a zero-initialised header.
Returns a header with the given overrides.
Types
@type t() :: %EEVM.Block.Header{ base_fee_per_gas: non_neg_integer(), blob_gas_used: non_neg_integer() | nil, coinbase: non_neg_integer(), difficulty: non_neg_integer(), excess_blob_gas: non_neg_integer() | nil, extra_data: binary(), gas_limit: non_neg_integer(), gas_used: non_neg_integer(), hash: binary(), logs_bloom: binary(), nonce: binary(), number: non_neg_integer(), ommers_hash: binary(), parent_beacon_block_root: non_neg_integer(), parent_hash: binary(), prev_randao: non_neg_integer(), receipts_root: binary(), state_root: binary(), timestamp: non_neg_integer(), transactions_root: binary() }
Functions
@spec empty_ommers_hash() :: binary()
Returns the ommers hash of a block with no ommers, keccak256(rlp([])),
which every post-Merge header carries.
@spec new() :: t()
Returns a zero-initialised header.
Returns a header with the given overrides.
Example
iex> header = EEVM.Block.Header.new(number: 18_000_000, gas_limit: 30_000_000)
iex> {header.number, header.gas_limit}
{18_000_000, 30_000_000}