ethereum.constantinople.blocksethereum.istanbul.blocks

A Block is a single link in the chain that is Ethereum. Each Block contains a Header and zero or more transactions. Each Header contains associated metadata like the block number, parent block hash, and how much gas was consumed by its transactions.

Together, these blocks form a cryptographically secure journal recording the history of all state transitions that have happened since the genesis of the chain.

Header

Header portion of a block on the chain, containing metadata and cryptographic commitments to the block's contents.

23
@slotted_freezable
24
@dataclass
class Header:

parent_hash

Hash (keccak256) of the parent block's header, encoded with RLP.

31
    parent_hash: Hash32

ommers_hash

Hash (keccak256) of the ommers (uncle blocks) in this block, encoded with RLP.

39
    ommers_hash: Hash32

coinbase

Address of the miner who mined this block.

The coinbase address receives the block reward and all transaction fees (gas price * gas used) from included transactions in the block.

48
    coinbase: Address

state_root

Root hash (keccak256) of the state trie after executing all transactions in this block. It represents the state of the Ethereum Virtual Machine (EVM) after all transactions in this block have been processed. It is computed using the state_root() function, which computes the root of the Merkle-Patricia Trie representing the Ethereum world state.

56
    state_root: Root

transactions_root

Root hash (keccak256) of the transactions trie, which contains all transactions included in this block in their original order. It is computed using the root() function over the Merkle-Patricia trie of transactions as the parameter.

69
    transactions_root: Root

receipt_root

Root hash (keccak256) of the receipts trie, which contains all receipts for transactions in this block. It is computed using the root() function over the Merkle-Patricia trie constructed from the receipts.

81
    receipt_root: Root

bloom

Bloom filter for logs generated by transactions in this block. Constructed from all logs in the block using the logs bloom mechanism.

92
    bloom: Bloom

difficulty

Difficulty of the block, used in Proof-of-Work to determine the effort required to mine the block. This value adjusts over time to maintain a relatively constant block time and is computed using the calculate_block_difficulty() function.

100
    difficulty: Uint

number

Block number, (height) in the chain.

111
    number: Uint

gas_limit

Maximum gas allowed in this block. Pre EIP-1559, this is the maximum gas that could be consumed by all transactions in the block.

116
    gas_limit: Uint

gas_used

Total gas used by all transactions in this block.

124
    gas_used: Uint

timestamp

Timestamp of when the block was mined, in seconds since the unix epoch.

129
    timestamp: U256

extra_data

Arbitrary data included by the miner.

134
    extra_data: Bytes

mix_digest

Mix hash used in the mining process, which is a cryptographic commitment to the block's contents. It validates that PoW was done on the correct block.

139
    mix_digest: Bytes32

nonce

Nonce used in the mining process, which is a value that miners increment to find a valid block hash. This is also used to validate the proof-of-work for this block.

148
    nonce: Bytes8

Block

A complete block on Ethereum, which is composed of a block header, a list of transactions, and a list of ommers (also known as uncle blocks).

The block header includes PoW-specific fields such as difficulty, nonce, and ommersHash, which relate to the mining process. The coinbase field denotes the address receiving mining and transaction fees.

The header also contains commitments to the current state (stateRoot), the transactions (transactionsRoot), and the transaction receipts (receiptsRoot). It also includes a bloom filter which summarizes log data from the transactions.

Ommers are used to provide rewards for near-valid mined blocks that didn't become part of the canonical chain.

158
@slotted_freezable
159
@dataclass
class Block:

header

The block header containing metadata and cryptographic commitments. Refer headers for more details on the fields included in the header.

181
    header: Header

transactions

A tuple of transactions included in this block.

189
    transactions: Tuple[Transaction, ...]

ommers

A tuple of ommers (uncle blocks) included in this block. Ommers are blocks that were mined at the same time as this block but were not included in the main chain.

194
    ommers: Tuple[Header, ...]

Log

Data record produced during the execution of a transaction. Logs are used by smart contracts to emit events (using the EVM log opcodes (LOG0, LOG1, LOG2, LOG3 and LOG4), which can be efficiently searched using the bloom filter in the block header.

202
@slotted_freezable
203
@dataclass
class Log:

address

The address of the contract that emitted the log.

218
    address: Address

topics

A tuple of up to four topics associated with the log, used for filtering.

223
    topics: Tuple[Hash32, ...]

data

The data payload of the log, which can contain any arbitrary data.

228
    data: Bytes

Receipt

Result of a transaction execution. Receipts are included in the receipts trie.

234
@slotted_freezable
235
@dataclass
class Receipt:

succeeded

Whether the transaction execution was successful.

242
    succeeded: bool

cumulative_gas_used

Total gas used in the block up to and including this transaction.

247
    cumulative_gas_used: Uint

bloom

Bloom filter for logs generated by this transaction. This is a 2048-byte bit array that allows for efficient filtering of logs.

252
    bloom: Bloom

logs

A tuple of logs generated by this transaction. Each log contains the address of the contract that emitted it, a tuple of topics, and the data payload.

258
    logs: Tuple[Log, ...]