A Reth Execution Extension (ExEx) that indexes Ethereum execution witnesses for stateless validation.
Historical state reconstruction can be a bottleneck. As a result, extracting execution witnesses for historical blocks can be extremely slow, and often requests can timeout.
This project captures execution witnesses as blocks are committed to the chain and stores them in a database (reth-db/MDBX). These indexed witnesses can then be retrieved via JSON-RPC.
- Real-time indexing: Extracts witnesses by re-executing blocks against parent state
- Reorg handling: Automatically removes witnesses for reverted blocks
- Pruning: Two strategies available:
- Periodic: Keeps only the N most recent blocks
- Event-driven: Prunes up to a block number received via channel (useful for zk-rollups finalizing on L1)
- JSON-RPC API: Query witnesses by block number or hash (
indexed_witnessByNumber,indexed_witnessByBlockHash)
| Module | Description |
|---|---|
db |
Database trait and reth-db implementation for witness storage |
exex |
Core WitnessIndexer ExEx that processes chain notifications |
pruner |
Background pruning task with configurable policies |
rpc |
JSON-RPC server under the indexed namespace |
error |
Error types for RPC operations |
# Build library
cargo build
# Build binary
cargo build --release --bin reth-witness-indexer --features=build-binary# Run all tests
RUST_LOG=reth-witness-indexer=trace cargo test --all-features
# Run tests with reproducible randomness
SEED=12345 cargo test --all-featuresThe binary can be run with standard reth CLI arguments plus indexer-specific options:
reth-witness-indexer node \ # other `reth node` CLI options
--reth-witness-indexer.start-block <BLOCK_NUMBER> \
--reth-witness-indexer.max-backfill-distance <N_BLOCKS> \
--reth-witness-indexer.include-headers \
--reth-witness-indexer.pruner.interval <SECONDS> \
--reth-witness-indexer.pruner.n-recent <N_BLOCKS>Built against reth v1.10.2.