EIP-6466 SSZ receipts

No call decision · Scaling & data · EIP status Draft · created 2023-02-08

Converts transaction receipts from RLP to SSZ format so that only part of a receipt can be selectively proven, and embeds information needed for verification, such as the sender address, directly into the receipt where it was previously missing.

Why it is needed

Currently, receipts are serialized using a method called RLP and hashed wholesale into a data structure called a Merkle Patricia Trie (MPT). With this structure, it is not possible to efficiently prove a specific part of a receipt, such as a single log. As a result, smart contracts that handle L2 fraud proofs or apps that verify log data must fetch the entire receipt, which is a significant burden. Missing information is also a problem. When a receipt is queried via JSON-RPC, it returns the from, gasUsed, and contractAddress values, but the receipt as actually recorded on chain contains no information to verify these values. This EIP solves both problems together by converting receipts into an SSZ (Simple Serialize) format that is hashed as a Merkle tree, and by embedding the missing information directly into the receipt.

What changes

Today

After EIP-6466

Who is affected

In depth

Three receipt types

A receipt is one of three types grouped by a CompatibleUnion. 0x01 BasicReceipt is issued for general transactions (RlpLegacyReplayableBasicTransaction, RlpLegacyBasicTransaction, RlpAccessListBasicTransaction, RlpBasicTransaction, RlpBlobTransaction) and has the fields from_, gas_used, logs, and status. 0x02 CreateReceipt is issued for contract deployment type transactions and adds contract_address. 0x03 SetCodeReceipt is issued for RlpSetCodeTransaction and adds the authorities field. Each type is defined as a ProgressiveContainer(active_fields=...) so that common fields keep the same position in the tree.

Fields included in and excluded from the receipt

from is the address that sent the transaction, gas_used is the gas used by that single transaction, and contract_address is the deployed contract address, present only in CreateReceipt. logs are the logs emitted during execution, and status is the EIP-658 transaction status code. authorities is the EIP-7702 list of authority addresses for transactions with an authorization list, with failed authorizations shown as an all-zero address. Conversely, logs_bloom, the intermediate state root (Homestead style), and cumulative_gas_used (pre-EIP-8116 style) are not included in the SSZ receipt.

The SSZ structure of a log

A log is represented as an SSZ Container with three fields: address (ExecutionAddress), topics (List[Bytes32, MAX_TOPICS_PER_LOG]), and data (ProgressiveByteList). MAX_TOPICS_PER_LOG is 4, matching the fact that the LOG0 through LOG4 instructions allow 0 to 4 topics per log.

receipts_root moves from MPT to SSZ

The execution block header's receipts_root switches from an MPT root to an SSZ root. The block's receipts are placed into a ProgressiveList[Receipt], and its hash_tree_root() is used as receipts_root. At the consensus layer as well, the receipts_root type in ExecutionPayload and ExecutionPayloadHeader changes from the MPT-based Hash32 to an SSZ Root, and payload_header.receipts_root uses payload.receipts_root directly.

JSON-RPC changes

An authorities array is added to the receipt object. Each entry is either 20 bytes of DATA or null. The new receipt no longer returns logsBloom, while older-style legacy receipts continue to return it. from, gasUsed, and contractAddress remain as previously provided, and since BasicReceipt and SetCodeReceipt have no contract_address field, contractAddress becomes null for them. logIndex, per the EIP-8116 definition, refers to the position of the log within the individual receipt rather than across the whole block.

Design rationale: future compatibility and verification efficiency

All receipts share the same Merkle tree shape, and each field is assigned a fixed generalized index (gindex). This means that even if transaction features are added in the future and receipt fields are added or removed, existing verifiers will not break. Because from, contract_address, and authorities are committed directly in the receipt, verification is possible without expensive ecrecover, and even if a new signature scheme is introduced later that changes how addresses are computed, verifiers are unaffected. Execution clients no longer need access to transaction data or additional indexes when serving SSZ-based receipts.

Backward compatibility and current status

Apps that relied on the block header's existing MPT receipts_root must migrate to the SSZ receipts_root. Since RLP receipts and SSZ receipts can collide in encoding, only one format must be used within a single channel, and when requesting a receipt by hash over the network, the format's fork must be identified by referencing the block header containing that receipts root. This EIP is still in Draft status, so the specification may change going forward.

Original EIP · ← EIPs