EEVM.Block.Header (eevm v0.1.0)

Copy Markdown View Source

Ethereum block header — the consensus-critical metadata for a block. A pure data carrier; validation lives in EEVM.Block.Processor.

Fields

FieldDescription
numberBlock number (height on the chain)
parent_hashKeccak hash of the parent header
timestampBlock timestamp in seconds since epoch
coinbaseAddress of the block producer (fee recipient)
gas_limitMaximum cumulative gas the block may consume
base_fee_per_gasEIP-1559 base fee
prev_randaoRANDAO mix inherited from the beacon chain (post-Merge)
parent_beacon_block_rootEIP-4788 beacon root pointer from the parent slot
state_rootPost-execution world-state MPT root
receipts_rootMPT root of {rlp(index) => rlp(receipt)}
transactions_rootMPT root of {rlp(index) => rlp(transaction)}
logs_bloom256-byte bloom summarising every log in the block
gas_usedTotal gas the block's transactions consumed, as declared by the producer
extra_dataArbitrary producer bytes (at most 32 bytes on mainnet)
difficultyProof-of-work difficulty (always zero post-Merge)
hashKeccak hash of this header, as supplied by the caller (not computed here)
nonce8-byte proof-of-work nonce (all zero post-Merge)
ommers_hashKeccak hash of the RLP ommers list (the empty-list hash post-Merge)
blob_gas_usedEIP-4844 blob gas consumed by the block; nil before Cancun
excess_blob_gasEIP-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

t()

@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

empty_ommers_hash()

@spec empty_ommers_hash() :: binary()

Returns the ommers hash of a block with no ommers, keccak256(rlp([])), which every post-Merge header carries.

new()

@spec new() :: t()

Returns a zero-initialised header.

new(opts)

@spec new(keyword()) :: t()

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}