---
eip: 8304
label: EIP-8304
title: Trustless log and transaction index
status: Draft
type: Standards Track
category: Core
created: 2026-06-17
requires: 4788
official: https://eips.ethereum.org/EIPS/eip-8304
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8304.md
canonical: https://eips.huatuo.xyz/eip-8304/
lang: en
tldr: Proposes that every block commits sorted index tables of its transactions and logs into a system contract, so anyone can get compact proofs that a log or transaction lookup result is correct and complete.
tags: [logs, indexing, light-clients, proofs, core]
---

# EIP-8304: Trustless log and transaction index

> Store the root hashes of index tables in a system contract to allow efficient trustless proofs of log and transaction lookups

**TL;DR:** Proposes that every block commits sorted index tables of its transactions and logs into a system contract, so anyone can get compact proofs that a log or transaction lookup result is correct and complete.

## What problem does it solve?

Logs (events) are cheap to emit, but the protocol gives no efficient way to *search* them. The per-block bloom filters in headers are oversaturated and practically useless today. So users ask an RPC provider "give me all `Transfer` events to my address", and must simply trust the answer: the provider cannot prove the result is correct, or that nothing was left out.

EIP-8304 adds a cheap-to-maintain index that supports trustless query proofs. The spec also points to cross-chain messaging (prove logs emitted on another chain from a known block hash) and, later, using logs as a cheap, easily expired form of state.

## How it works

- **Index entries.** For each block the client derives entries for every transaction hash, every log's address and each of its topics, and (one block late) the parent block hash. Each entry is `type ‖ value ‖ position` in big-endian bytes, e.g. a `log.address` entry is `0x0002 ‖ address ‖ block number ‖ tx index ‖ log index` (38 bytes).
- **Index tables.** Entries are sorted lexicographically and hashed: each entry is SHA-256'd and the table root is the SSZ root of that `List[Hash32]`. Sorting is what makes *exclusion* provable: you can show there are no further matching entries.
- **Levels.** Tables exist for 1, 4, 16, 64 and 256 blocks. Larger tables are merged from four tables of the level below and are committed with a delay of `table_size / 4` blocks, so merging can happen in the background.
- **System contract.** After each block, a system call stores `(first_block, table_size, table_root)`. Each level keeps a 1024-entry ring buffer, so roughly the last 2^18 blocks are covered by in-protocol tables. Anyone can call `get(first_block, table_size)` to read a root.
- **Older history** is expected to be covered by much larger tables built off-protocol and proven with ZK proofs in separate "history index contracts" sharing the same `get` interface.

Block header blooms are left unchanged, and `LOG` gas costs do not increase.

## Sample code

Encoding a `log.topics[0]` entry and reading a table root (the contract address is still TBD in the spec):

```python
def topic0_entry(topic: bytes, block: int, tx_index: int, log_index: int) -> bytes:
    # type 3 = log.topics[0]; 2 + 32 + 8 + 4 + 4 = 50 bytes
    return (3).to_bytes(2, "big") + topic + block.to_bytes(8, "big") \
        + tx_index.to_bytes(4, "big") + log_index.to_bytes(4, "big")

entry_hash = sha256(topic0_entry(TRANSFER_TOPIC, 42, 0, 1))
```

```solidity
// get(): 64 bytes of calldata -> 32-byte table root, reverts if unknown/overwritten
function tableRoot(address index, uint256 firstBlock, uint256 tableSize) view returns (bytes32) {
    (bool ok, bytes memory ret) = index.staticcall(abi.encode(firstBlock, tableSize));
    require(ok, "no root");
    return abi.decode(ret, (bytes32));
}
```

## Things to know

- Status is **Draft**. The contract address and deployment details are still TBD.
- [EIP-7745](/eip-7745/), by the same author and with the same title, is an earlier, different design that replaces header bloom filters; this proposal leaves blooms alone and focuses on low per-block processing cost.
- After syncing, a client needs at most the last 319 blocks to rebuild the tables it must commit next; no sync protocol change is needed.
- If [EIP-8141](/eip-8141/) frame transactions activate, a 2-byte frame index is added to log positions. After [EIP-7708](/eip-7708/), history could be re-indexed with ETH transfer logs in an alternative index contract.
- Query proofs are larger than state proofs; the spec expects a typical query to need tens of individual table proofs.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-8304
