Discussion topic for EIP-8304: Trustless log and transaction index
Note that this EIP is a result of the same “trustless log index” project as EIP-7745 but it is a new and different (much simpler) design.
Discussion topic for EIP-8304: Trustless log and transaction index
Note that this EIP is a result of the same “trustless log index” project as EIP-7745 but it is a new and different (much simpler) design.
We’re strongly in favor of this EIP at Willow. We’ve been working on this problem from the off-protocol side, so a few measurements from our prover may be useful.
From the draft:
any meaningful proof would include all block receipts since the last contract update. The cost of this would be impractical for API proofs and prohibitive for on-chain/cross-chain proofs.
That’s close to what we do today: prove log queries directly from receipts, without the proposed tables.
For one recent 2,048-block query, proving took 56 minutes on a single A100. The proof was verified on mainnet in 550,091 gas, independent of range length: transaction.
Across our profiling runs, 59% of the proving work goes to rebuilding receipt tries against receiptsRoot, 34% to scanning logs, and less than 1% to walking headers and checking blooms. In other words, most of the cost is proving completeness.
The tables change that. Once a block’s logs are committed, filters can be proven against that commitment instead of redoing the completeness work from receipts. For logs, the table already contains the address, topics, and position, so only matching receipts need to be opened to recover data.
The lexicographic ordering is especially useful here: matches are contiguous, so the entries immediately before and after the range can establish completeness. We would prefer to keep that property fixed.
We also see the bloom saturation described in the motivation. Across the same 2,048 blocks, the median logsBloom had 1,473 of 2,048 bits set. In our tests, even filters returning no logs could still require opening more than a third of the blocks.
On pre-fork history, I’m not convinced a proven table rebuild is prohibitively expensive with today’s hardware. Our rough estimate for one table level is about 25,400 A100-hours, or a little over $35K in GPU time at the rate we paid.
That estimate uses 3.72B transactions and our measured proving cost per receipt. The transaction-trie cost is unmeasured, so we assume roughly the same cost again. For table hashing, we estimate about 32B entries and use our measured Keccak cost as a stand-in for the SHA-256 specified by the EIP.
This excludes data fetching and sorting, and the EIP-7708 re-execution is a separate problem we haven’t priced. The estimate is rough, but it suggests a one-time proven rebuild is feasible enough to investigate.
If this gets to a devnet, we’d be interested in implementing a table prover for log and transaction-hash lookups, along with a history index contract, and publishing the actual costs.
Thanks for the response!
About proving pre-fork history: proving historic tables from already consensus-proven receipts sounds like the easier thing to me, and you are probably right, it might be feasible to do with today’s tech. What looks like a more serious undertaking though is proving the entire EIP-7708 re-execution of the chain. Anyways, this is something that will probably be cheap and easy at a certain point in the future, but my point is that this is not something that the viability of EIP-8304 should depend on. If we can trust a consensus change verified and implemented by multiple teams, we can also trust a hardcoded historic table root verified with multiple implementations, at least until we have a better solution.
Regarding the proofs of log and tx lookups: I already have a proof format defined, the verifier implemented in Go and some WIP documents written about the proof format and verification at my trustless log index repo:
I am actively improving the docs right now, also I want to check if the binary proof encoding works correctly on the provided test API endpoint, but you can probably already use it as a starting point. Building efficient ZKPs of log index proof verification would be very useful (my long term dream is to make these super cheap on chain with recursive ZKPs and have super cheap and efficient UTXOs based on logs and my index tables).
Another super useful thing would be to build the proof system that does a very simple thing: prove table merging on-chain, for historic tables bigger than 256 blocks. The operation itself is super simple, just verify the merging of ordered lists and re-hash both the input and output tables. Then the historic index contract would verify the proof proving for example that four consecutive 256 block tables with given roots merge into a 1024 block table with this and this root, and create an entry for the 1024 block table. And then continue this process with even bigger tables. For a table merge proof covering millions of blocks, this would probably require a recursive proof. Are you (or someone else here) maybe interested on working on this? This is a problem where I don’t really have the required expertise yet so attacking it alone would probably just take up too much of my time while I also have to push the EIP and work on specs and stuff.
Hi @zsfelfoldi we’d be happy to work on this. And we already went ahead and produced a first merge proof today.
We took four consecutive 256-block tables from mainnet, covering blocks 25,845,760–25,846,783, and proved their merge into a single 1,024-block table.
In SP1, wrapped in Groth16, it took 107 minutes on one L40S and roughly $2 of GPU time at the rate we paid. The proof’s public values carry the four child roots and the parent root, and all five match what your core/logindex implementation computes for the same tables, so the encoding, ordering, and SSZ roots are byte-compatible.
About 83% of the proving work is just SHA-256 re-hashing of the input and output tables; the merge itself is relatively cheap.
Next we can work on the recursive version for larger tables, along with a history index contract that binds the child roots and exposes the same get interface as the system contract.
Agreed as well on pre-fork history. A hardcoded root independently reproduced by multiple implementations seems like a perfectly reasonable starting point, and I agree EIP-8304 shouldn’t depend on solving the full EIP-7708 re-execution first.
We’re also interested in the log-index proof format you linked. Proving verification of those lookup proofs seems like a natural next step once the merge path is further along.
One tiny thing we noticed while building against your branch: core/logindex/table_rw_test.go imports fmt without using it, so go test ./core/logindex currently fails to compile.
We’ll keep building against your eip-8304 branch and post the code and measurements as the recursive merge comes together. I’ll also send you an email now too in case having mine is helpful for further coordination.
Hi Zsolt, great work on this ![]()
I’m working on add eth_getLogsV2 by bomanaps · Pull Request #900 · ethereum/execution-apis · GitHub, a JSON-RPC endpoint that improves eth_getLogs with reorg detection and pagination. On the RPC call last Monday the question came up of whether this can be designed to work with EIP-8304 when it lands, instead of doing something we have to replace later.
I think it can, with three small additions maybe?
None of this needs the proof format finalised now, it just means adding proofs later is a clean extension, not really a redesign.
Will it make sense to add a JSON-RPC integration section to EIP-8304 for this now? Happy to help draft it if this makes sense to you.
For the cursor question, an agent can change wallets mid-block. A page ending at that change must resume without losing or duplicating receipts. This small fixture totals 25 across the split and rejects a changed reference head.
Would a count-limited page use a log-position cursor, or allow whole-block overflow? This is a consumer test, not an 8304 proof verifier.
Hi! If there is a new version of eth_getLogs then I think it is indeed a good idea to prepare for adding proofs. Now regarding EIP-8304, the good thing is that technically speaking it is in a pretty good state, the proof generation and verification is implemented and proven efficient, I even implemented an API endpoint. The not so good thing is that it’s been rejected for H* because other priorities or whatever. Which does not mean that it cannot get into I* or some subsequent fork, but I don’t want this project to get stuck for years so I decided to try to validate the log index without a protocol change, using ZKPs. So leaving the proof format open is a wise choice, because while I intend to see this project through, it’s really not clear in what exact form it is going to work out in the end and that will also affect the proof format.
Specifying the referenceHead parameter and proof response now as placeholders is possible, though I think adding them later is no big deal either if it does not change the behavior of the API otherwise. Regarding the result count, I think it is important regardless of proofs to have a result count limitation. And I would also strongly suggest to add a “reverse limitation” option, meaning that the request returns the last N results if there are more than N results in the searched range. I think it is even more useful than the “forward limitation”. If you want to list certain interesting events and it turns out that there are millions of them then it feels logical that you would want to see the most recent ones first and then either paginate backwards or tighten the search params.
Btw you can check out the currently implemented proof format here (note that if we go the ZKP way then the top part of the proof, the table root proving logic will be different)
And here is my PoC logs-with-proofs API endpoint spec. It’s different from JSON-RPC and more similar to the CL REST API, but the result count limitation logic could be applied to the JSON-RPC call format too.
I added latest-first cases: skipping the capped boundary block loses 7 of 25 in this consumer fixture. Is refilling that block with a higher limit the intended continuation policy?
The intended policy is soft cap with whole-block overflow, the server always completes the boundary block even if it slightly exceeds the limit, and cursorBlock always points to the last fully covered block, will update the PR spec to say this
Thanks for the links referenceHead and proof work as placeholders either way whether the proof comes from the protocol contract or a ZKP verifier, so keeping them in the pr
Got it. I updated the consumer tests for whole-block overflow. All 32 pass; the wallet-change example stays at 25 without a boundary refill.
Hi all, Vansh here, one of the EPF fellows working on EIP-8304 in geth. Sorry to hear it missed Hegota, but the work is useful whether or not it ends up in a fork, so I wanted to share what I have. I built the path end to end in geth (consensus, index, RPC, verifier):
What my implementation does - A node answers a log query with the logs and a proof. A client holding only a header it already trusts checks the proof, including that nothing was left out. On a two-client devnet (geth + lighthouse, one geth node with the index switched off) I got 24k logs back in 12 pages, every page verified by a standalone verifier that never talks to the node, identical to eth_getLogs.
The verifier stands on its own : Verify(trustedHeader, request, options) binds the proof to the trusted header and the exact request, and only accepts the index contract it is configured for. That doesn’t change if the roots come from the protocol or from a ZK-validated history contract.
Out-of-protocol mode : For ranges before a fork (or without one), a contract holds hardcoded roots, and it can hold only the top levels (a few hundred roots instead of one per block). The proof format is the same, only the trust anchor for the contract differs. That looks like a fit for the merged-root history @pauldelucia has been building, so I’d be happy to test a merged root against the verifier.
Reverse limit : It’s there already (limitLatest): the newest N logs, with a proof of the range down to the oldest returned block.
How I tried to break it - A differential matrix of 288 queries against brute force, a fuzzer, five attack modes (drop a block, forged contract, wrong header, truncated range, flipped hash), and one dumb but useful test: change one byte of every string in a proof, one at a time.
In RLP the proof is about half the size of JSON ( around 2.6 MB vs 5.6 MB for 2,570 logs, mostly receipts)
One thing I believe we can have in the EIP
The roots must be a function of the chain, not of a node’s local index, otherwise a node without an index (or one that just snap-synced) builds a different block. I derive them from ancestry, which means a node needs the receipts of the last 319 blocks around a due 256-table. Probably worth a line in the EIP, and an open question for stateless clients.
My wallet-change case could be useful for limitLatest: income should stay at 25 across overlapping pages. I haven’t connected it to your verifier yet.
Hi @Vansh, really nice work on this.
We’d love to test a merged root against your verifier. The one we have from real mainnet data covers blocks 25,845,760–25,846,783, where we took four consecutive 256-block tables and proved their merge into a single 1,024-block table with root 0x201e730a99fa30d9c1be13e7c32b26b246e34c420597150f37651bb708c703bd. The SP1 merge proof verifies on a mainnet fork in our history index contract, which verifies the four child roots and stores the parent. We’ve also proven the recursive version for larger tables, though so far only on synthetic tables. Everything is in GitHub - willow-network/eip-8304-prover: Off-protocol proving for EIP-8304: table-merge proofs, recursive aggregation, a history index contract, and a zkVM verifier for trustless-log-index query proofs — verified against the reference implementation and on Ethereum mainnet · GitHub .
Our contract answers the same 64-byte get(first_block, table_size) call, so your historic mode should be able to run it once it’s configured with the contract’s address and code hash. We can deploy it with that root so your verifier can point at it. If your node builds the 1,024-block table for the same blocks, it should also get the same root, which would confirm the tables match end to end.
Connected it to your Go verifier in integration tests. On a generated chain, wallet-change income stays at 25 through overlaps and boundary refills; dropping the 13-unit receipt fails verification. This uses your protocol index path so far.
Thanks Paul, great, and yes please!
I did the first half of that check. I computed the table for blocks 25,845,760 - 25,846,783 with my implementation. All the block roots match what you posted and the entry count is the same too, 3,453,970. So great to know our implementations agree on mainnet data!
For the contract side: my verifier doesn’t read a storage slot for a historic contract, it runs the contract’s get(first_block, table_size) on the proven state and pins the contract by address and code hash, so HistoryIndex should work as is. Would need the address, the code hash, and somewhere I can fetch a state proof for the deployed contract. If you can share the deployed fork, I’ll run a query against it.