Skip to content

scroll-tech/reth-witness-indexer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reth Witness Indexer

A Reth Execution Extension (ExEx) that indexes Ethereum execution witnesses for stateless validation.

Overview

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.

Features

  • 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)

Modules

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

# Build library
cargo build

# Build binary
cargo build --release --bin reth-witness-indexer --features=build-binary

Test

# Run all tests
RUST_LOG=reth-witness-indexer=trace cargo test --all-features

# Run tests with reproducible randomness
SEED=12345 cargo test --all-features

Usage

The 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>

Dependencies

Built against reth v1.10.2.

About

A Reth Execution Extension (ExEx) that indexes Ethereum execution witnesses for stateless validation.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages