This tutorial layers the proofs-history historical proof store (storage format v2) on top of a working op-reth node. Follow Building and running an OP Stack node from source first to build op-reth and op-node, then return here to enable proofs-history.Documentation Index
Fetch the complete documentation index at: https://docs.optimism.io/llms.txt
Use this file to discover all available pages before exploring further.
Do you need this tutorial? Withdrawal proving on op-reth uses
eth_getProof against historical L2 state, so both permissioned and permissionless chains need historical state exposed — but the required lookback differs sharply:- Permissioned chains only need a few hours of lookback (covering your dispute-game publishing cadence with margin). The lighter
--rpc.eth-proof-window <num_blocks>flag is sufficient on its own — no separate proofs database is needed, and this tutorial does not apply. See the op-reth configuration reference for that flag. - Permissionless chains need ~28 days of lookback.
--rpc.eth-proof-windowbecomes too slow and memory-hungry at that range, so follow this tutorial to set up--proofs-history(v2).
Use historical proofs storage format v2 by setting
--proofs-history.storage-version=v2 when running op-reth node.How it works
reth’s defaulteth_getProof reverts in-memory state diffs backward from the tip, which becomes prohibitive at multi-day lookbacks. The proofs-history subsystem maintains a separate MDBX database that tracks intermediate Merkle Patricia Trie nodes versioned by block, enabling O(1) lookups of proofs at any block within a configurable retention window. A background pruner removes data outside the window.
The subsystem processes blocks asynchronously via reth’s ExEx (Execution Extension) hook, so it adds zero overhead to sync speed and negligible tip latency. See the historical proof configuration reference for storage tables, RPC overrides, and tunable parameters.
Prerequisites
- A built
op-rethbinary at v2.2.3 or later (required for--proofs-history.storage-version=v2). See Build op-node and the execution client. - An op-reth datadir, either initialized from genesis or restored from a snapshot (covered below).
- Sufficient disk: estimate
chain_size + 20% bufferfor the proofs database (e.g., ~1 TB for 4 weeks on Base at 2s block time). - NVMe SSD recommended.
Initialization
Runningop-reth with historical proofs requires a two-step initialization:
1. Initialize op-reth
Initialize the core database with the genesis file for your chain (e.g.,optimism).
Option: Start from a Snapshot
If you prefer to start from a pre-synchronized database snapshot instead of syncing from genesis:- Download and extract an
op-rethsnapshot from datadirs.optimism.io into yourdatadir. - Skip the
op-reth initcommand above. - Proceed to Initialize Proofs Storage below. The
proofs initcommand initializes the proofs database at the snapshot’s chain tip — it does not retroactively populate proofs for blocks already in the snapshot.
2. Initialize Proofs Storage
Initialize the separate storage used by the historical proof store. This is required before starting the node with--proofs-history, even when reusing an existing op-reth datadir or restoring from a snapshot.
The first time
proofs init runs, it takes minutes to hours. Subsequent invocations should only take seconds. It does not backfill historical proofs — it marks the current chain tip as the starting point of the proofs database. Once the node is running with --proofs-history, the proofs database fills forward as new blocks are committed. To serve proofs across the full retention window (e.g., 30 days for permissionless fault proofs at default settings), the node must run continuously for at least that long after initialization. For that reason it is recommended to start from a snapshot whose tip is old enough to cover the required time window.Running op-reth with proofs-history
Add the--proofs-history.* flags below to your standard op-reth start command from Start the execution client. The proofs-history additions are:
The default
--proofs-history.window is 1,296,000 blocks, corresponding to ~30 days at 2s block times. For chains with a different block time, set --proofs-history.window=<num_blocks> explicitly using target_retention_seconds / block_time_seconds.--proofs-history.* flags (window, prune-interval, metrics, etc.), see the historical proof configuration reference.
Running op-node
Startop-node as documented in Start op-node. No proofs-history-specific changes are needed on the consensus client.
Verification
After starting both clients, query the sync status of the proofs store via thedebug_proofsSyncStatus RPC method:
proofs init, both earliest and latest sit at the chain tip; the window then fills forward as new blocks are committed. eth_getProof calls for every block within [earliest, latest] will be served from the versioned store. Requests for blocks older than earliest will fail or fall back to the default reth implementation.
You can also check the op-reth startup logs for messages confirming the proofs-history ExEx is wired up:
Monitoring
When op-reth is run with the--metrics=<addr>:<port> flag, the proofs-history ExEx exposes Prometheus metrics covering proofs-DB sync state (optimism_trie_block_*), the background pruner (optimism_trie_pruner_*), and eth_getProof RPC traffic (optimism_rpc_eth_api_ext_*). See the historical proof configuration reference for the full list.
Operational Commands
Manual prune
Pruning runs automatically in the background on the configured--proofs-history.prune-interval (default 15s). You should not need to invoke op-reth proofs prune under normal operation.
A manual prune is only required in one situation: at startup, if the proofs database contains more than 1000 blocks of history beyond the configured --proofs-history.window, the node refuses to start rather than stalling on a large prune operation. This typically happens after the node has been offline long enough that the configured window has shifted significantly, or after reducing --proofs-history.window to a smaller value than was previously in use.
When this happens, op-reth exits with an error indicating the number of blocks to prune. Run the prune command once to bring the database back within the safety threshold, then restart the node:
Unwind
Recover from corruption by reverting the proofs database to a specific block:You can only unwind to a block after the earliest block number in the database. Unwinding to a block before the earliest will fail.
Performance
Benchmarked on Base Sepolia (~700k block window, WETH contract):| Metric | Value |
|---|---|
| Avg latency | ~15 ms per eth_getProof |
| Throughput | ~5,000 req/s (10 concurrent workers) |
| Sync overhead | Zero (ExEx processes asynchronously) |
| Memory | Bounded by window size — no OOM risk |
Next steps
- op-reth v2.2.3 release notes — the release that introduced the historical proof store v2.
- op-reth historical proof configuration reference — full
--proofs-history.*flag set, RPC endpoints, and Prometheus metrics. - op-reth configuration reference — all standard op-reth flags.