diff --git a/docs/_sidebar.md b/docs/_sidebar.md index a7484256..970d8413 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -50,6 +50,7 @@ - [Precompiled Contracts](/wiki/EL/precompiled-contracts.md) - [Block Building](/wiki/EL/block-production.md) - [Data Structures](/wiki/EL/data-structures.md) + - [Summary](/wiki/EL/el-data-structures-summary.md) - [Transaction anatomy](/wiki/EL/transaction.md) - [JSON-RPC](/wiki/EL/JSON-RPC.md) - [DevP2P](/wiki/EL/devp2p.md) diff --git a/docs/wiki/EL/el-data-structures-summary.md b/docs/wiki/EL/el-data-structures-summary.md new file mode 100644 index 00000000..2b098507 --- /dev/null +++ b/docs/wiki/EL/el-data-structures-summary.md @@ -0,0 +1,113 @@ +# Ethereum Execution Layer Data Structures + +# Block +## block_header +- **block_header** + - parent_hash // Hash of the previous block + - ommers_hash // Hash of the ommers (a.k.a. uncles) list + - beneficiary // Address of the miner or validator who receives block rewards + - state_root // Root hash of the world state trie after all txs are executed + - transactions_root // Root hash of the transaction trie for this block + - receipts_root // Root hash of the receipt trie for this block + - logs_bloom // Bloom filter summarizing all logs from receipts in this block + - difficulty // PoW: difficulty of the block + - number // Block number (height in the chain) + - gas_limit // Maximum amount of gas allowed in this block + - gas_used // Total gas used by all transactions in this block + - timestamp // Unix timestamp for when the block was proposed + - extra_data // Arbitrary 32-byte field for additional data (e.g. miner ID) + - mix_hash / prev_randao // PoW: used in nonce verification; PoS: random seed for validators [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399) – Paris + - nonce // PoW only: solution for the mining puzzle + - base_fee_per_gas // Minimum base fee per gas [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) – London + - withdrawals_root // Root of the withdrawals list trie [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) – Shanghai + - base_fee_per_blob_gas // Minimum blob gas fee [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) – Dencun + - blob_gas_used // Total blob gas used in the block [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) – Dencun + - excess_blob_gas // Rolling counter of unused blob gas [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) – Dencun + - parent_beacon_block_root // SSZ root of the parent beacon block [EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) – Dencun + - requests_root // Root hash of EL-generated cross-layer requests [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) – Pectra +## block_body +- **block_body** + - transactions[] // List of transactions executed in the block, in order + - ommers[] // List of ommer (uncle) block headers (legacy, empty in PoS) + - withdrawals[] // List of ETH withdrawals for validators [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) – Shanghai + - requests[] // List of cross-layer requests generated by execution [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) – Pectra + + +# state_trie +- (rooted at state_root) +- keccak(address1) -> RLP(nonce, balance, storage_root, code_hash) + - nonce // Number of transactions sent (EOA) or created (contract) + - balance // ETH balance of the account, in wei + - storage_root // Root of this account's storage trie (contracts only) + - code_hash // keccak256 hash of the account's code (contracts) or empty hash (EOAs) + - storage_trie (if contract) + - keccak(slot0) -> RLP(value0) // Contract storage: key-value pairs at specific slots +- keccak(address2) -> ... + +# transaction_trie +- (rooted at transactions_root) +## Legacy Transaction (type 0x00) +- [pre-EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) – Frontier + + +- RLP(0) -> Transaction 0 + - RLP(nonce, gas_price, gas_limit, to, value, data, v, r, s) + - nonce // Number of txs sent by sender prior to this + - gas_price // Legacy pricing model: gas price per unit + - gas_limit // Max gas this tx is allowed to consume + - to // Recipient address or empty (for contract creation) + - value // ETH to transfer in wei + - data // Call data for contract interaction or init code for creation + - v, r, s // Signature components (used to recover sender address) + +## Access List Transaction (type 0x01) +- [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) – Berlin + + +- RLP(0) -> Transaction 0 + - RLP(chain_id, nonce, gas_price, gas_limit, to, value, data, access_list, v, r, s) + - Extends **Legacy Transaction** by adding: + - chain_id // [EIP-155](https://eips.ethereum.org/EIPS/eip-155) – Spurious Dragon + - access_list // list of addresses/storage keys to be accessed [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) – Berlin + +## Dynamic-Fee Transaction (type 0x02) +- [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) – London + + +- RLP(0) -> Transaction 0 + - RLP(chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, v, r, s) + - Extends **Access List Transaction** by replacing `gas_price` with: + - max_priority_fee_per_gas //tip for the validator [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) – London + - max_fee_per_gas // maximum fee willing to pay per unit of gas [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) – London + +## Blob-Carrying Transaction (type 0x03) +- [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) – Dencun + + +- RLP(0) -> Transaction 0 + - RLP(chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes, v, r, s) + - Extends **Dynamic-Fee Transaction** by adding: + - max_fee_per_blob_gas // Maximum fee willing to pay per blob gas unit [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) – Dencun + - blob_versioned_hashes // List of hashes for each blob [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) – Dencun +... + +# receipt_trie +- (rooted at receipts_root) + +- RLP(0) -> receipt_0 + - type // Receipt type byte prefix [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) – Berlin + - status // 1 = success, 0 = failure [EIP-658](https://eips.ethereum.org/EIPS/eip-658) – Byzantium ; pre-Byzantium: state_root + - cumulative_gas_used // Total gas used up to and including this tx in the block + - logs_bloom // 256-byte bloom filter summarizing all logs from this tx + - logs[] // List of event logs emitted during execution + - address // Address of the contract that emitted the log + - topics[] // Array of indexed topics (includes event signature) + - data // ABI-encoded non-indexed event data +- RLP(1) -> receipt_1 + ... + +# withdrawals entries +- withdrawals(0) -> withdrawal_0 + - validator_index // Index of the validator making the withdrawal + - address // Address to receive the withdrawal + - amount // Amount in gwei \ No newline at end of file