EIP-7792 Verifiable event logs (Verifiable logs)

No call decision · Security & privacy · EIP status Stagnant · created 2024-10-21

A method that lets a wallet verify the correctness and completeness of an eth_getLogs event log response using only block state, without relying on a trusted RPC provider.

Why it is needed

Wallets use eth_getLogs to query past event logs by address or topic. However, a wallet alone cannot easily confirm whether the response returned by an RPC provider is correct or whether any logs are missing. The conventional approach is to fetch every block header and cross-check it against the log bloom filter, but bloom filters produce many false positives, requiring unnecessary blocks to be filtered out and separate requests per block, resulting in heavy network round trips. As a result, wallets end up trusting a specific provider and are exposed to that provider's privacy policy and potential censorship. This EIP accumulates a commitment of each block's logs into state, allowing the correctness and completeness of a response to be verified using only a proof obtained via eth_getProof.

What changes

Today

After EIP-7792

Who is affected

In depth

Log accumulation mechanism

After all transactions in a block have executed, the commitments of the resulting logs are accumulated into the storage of LOG_CONTRACT_ADDRESS (0xff...fe). This contract has no code, and its nonce is set to 1 on first write to prevent cleanup under EIP-158. Its storage consists of three mapping slots keyed by address, topics, and the address+topics combination (LOG_ADDRESS_STORAGE_SLOT=0, LOG_TOPICS_STORAGE_SLOT=1, LOG_ADDRESS_TOPICS_STORAGE_SLOT=2).

LogEntry structure

Building on the Log SSZ type from EIP-6466, a LogMeta is added that bundles block metadata (BlockMeta: timestamp, number) with the transaction index (transaction_index), forming LogEntry. LogEntry takes the form {meta: LogMeta, log: Log}, and the hash_tree_root of this LogEntry becomes the commitment that gets accumulated.

accumulate_log / track_log behavior

accumulate_log hashes the new entry's root together with the existing slot value using SHA256 and overwrites it via SSTORE. track_log calls accumulate_log separately for the address key, each topic key, and each address-topic combination key per log, making it possible to verify using address alone, topics alone, or a combination of both.

JSON-RPC changes

A blockTimestamp (QUANTITY) field is added to the eth_getLogs response. It holds the value of the timestamp field of the block referenced by blockHash.

Verification procedure

An eth_getLogs(address, topics, fromBlock, toBlock) response is verified as follows. Confirm the fromBlock and toBlock headers against known hashes, then confirm fromBlock's parentBlock header using fromBlock.parentHash. Next, use eth_getProof to obtain the past log accumulated value as of parentBlock and the accumulated value as of toBlock. Starting from the past accumulated value, apply each entry in the response in order using the same method as accumulate_log; the response can only be trusted as correct and complete if the result matches the accumulated value as of toBlock.

Gas cost tradeoff

The gas cost of this approach is much higher than the LOG# opcodes as of Prague, due to the added SLOAD/SSTORE and SHA256, which costs twice as much as KECCAK256. The cost increase outweighs the savings from removing the log bloom. If the cost proves excessive, the accumulator could be moved to a separate optimized structure outside state_root or to an off-protocol zk system, in which case the gas cost would still need to reflect the actual cost of updating the external accumulator to prevent log spam.

Why number and index are used instead of block hash

While the accumulator lives inside the state trie, the block hash cannot be included in the metadata, because the block hash is produced by hashing the state root, which would create a circular dependency. That is why LogMeta uses timestamp, number, and transaction_index instead of the block hash. If an external system were used instead, the state root would be unaffected, so the hash could be included.

Current status

This EIP is Stagnant and is no longer being actively discussed. There is no call record indicating a decision on hard fork inclusion. The source notes that if the gas cost proves excessive, the accumulator could be moved to a structure outside state_root or to an off-protocol zk system, so the detailed design may differ from what is described here.

Original EIP · ← EIPs