Fetch Ethereum Blocks from RPC URL and Save to Local Directory
Overview
The z6m_prover command with --service option runs a service fetching blocks at the tip or specified range and execute.
Command Syntax
prover/target/release/z6m_prover --service --rpc-url <URL> --data-dir temp/mainnet --save-all-responses [other-flags] > temp/mainnet/fetch.log 2>&1
Required Flags
--rpc-url: URL of the RPC server to fetch blocks from (required). Use the$RPC_URLenvironment variable, which should be configured in.claude/settings.local.jsonunder theenvkey. If$RPC_URLis not set, ask the user for the URL.
Usage Patterns
Fetch and Execute Blocks at the Tip Until Stopped
prover/target/release/z6m_prover --service --rpc-url <URL> --data-dir temp/mainnet --save-all-responses > temp/mainnet/fetch.log 2>&1
Fetch Blocks at the Tip Executing One In Every Million Until Stopped
prover/target/release/z6m_prover --service --rpc-url <URL> --data-dir temp/mainnet --save-all-responses --execute-every 1000000 > temp/mainnet/fetch.log 2>&1
Fetch Blocks Range Without Executing
prover/target/release/z6m_prover --service --rpc-url <URL> --data-dir temp/mainnet --save-all-responses --start-block 24620000 --end-block 24620199 --execute-every 1000 > temp/mainnet/fetch.log 2>&1
Important Considerations
Fetching Without Executing
When specifying both --start-block and --end-block, you can use a value for --execute-every greater than the block range size to only fetch blocks without ever executing.
Before Running
- Ensure z6m_prover binary is built: run
make z6m_proverto build it
Workflow
When the user wants to fetch Ethereum blocks and save them to a local directory:
Confirm parameters
- Ask for target RPC URL if not already known from context
Run command
Error Handling
Common issues:
- "Failed to get initial block number after retries": Verify the RPC URL is correct
Examples
Example 1: Fetch Blocks at the Tip From Public Reth Until Stopped
prover/target/release/z6m_prover --service --rpc-url $RPC_URL --data-dir temp/mainnet --save-all-responses --execute-every 1000000 > temp/mainnet/fetch.log 2>&1
Example 2: Fetch Blocks Range [24620000, 24620199] Without Executing
prover/target/release/z6m_prover --service --rpc-url $RPC_URL --data-dir temp/mainnet --save-all-responses --start-block 24620000 --end-block 24620199 --execute-every 1000 > temp/mainnet/fetch.log 2>&1
Tips
- If building from source, use
make z6m_proverwithin the project home folder to build the binary atprover/target/release/z6m_prover