This module provides a Go CLI that:
- Fetches Ethereum blocks and all transactions from JSON-RPC.
- Splits each block's transactions into configurable segments by
transactionIndex. - Computes per-segment
mean(tx-weighted),avg(per-block), andmaxpriority fee. - Optionally fetches receipts to compute per-segment average tip per block and average tip share per block.
- Supports parallel receipt fetching for faster large-range analysis.
- Prints separate non-EthGas and EthGas segment tables; EthGas blocks are excluded from the non-EthGas table.
- Supports CSV export of segment statistics.
go build ./...go run ./cmd/segment-analyzer \
--rpc-url https://your-rpc-endpoint \
--start-block 22000000 \
--end-block 22000010 \
--segments 8Using environment variable:
ETH_RPC_URL=https://your-rpc-endpoint go run ./cmd/segment-analyzer \
--start-block latest \
--segments 6Include receipt-based profitability:
go run ./cmd/segment-analyzer \
--rpc-url https://your-rpc-endpoint \
--start-block 22000000 \
--end-block 22000002 \
--segments 8 \
--with-receiptsTune receipt concurrency (for large ranges):
go run ./cmd/segment-analyzer \
--rpc-url https://your-rpc-endpoint \
--start-block 22000000 \
--end-block 22000100 \
--segments 8 \
--with-receipts \
--receipt-workers 32 \
--receipt-batch-size 50Write full JSON output to a file:
go run ./cmd/segment-analyzer \
--rpc-url https://your-rpc-endpoint \
--start-block 22000000 \
--end-block 22000002 \
--segments 8 \
--with-receipts \
--output report.jsonWrite CSV output:
go run ./cmd/segment-analyzer \
--rpc-url https://your-rpc-endpoint \
--start-block 22000000 \
--end-block 22000002 \
--segments 8 \
--with-receipts \
--csv report.csvPrint JSON report to stdout:
go run ./cmd/segment-analyzer \
--rpc-url https://your-rpc-endpoint \
--start-block 22000000 \
--end-block 22000002 \
--segments 8 \
--json--rpc-url: Ethereum JSON-RPC URL. Falls back toETH_RPC_URL.--ethgas-relay-url: Relay URL used to classify EthGas-proposed blocks by matching block hashes in relay delivered bids.--start-block: Start block number (decimal,0x..., orlatest).--end-block: End block number (decimal,0x..., orlatest). Defaults to start block.--segments: Number of transaction-index segments.--with-receipts: Fetcheth_getTransactionReceiptfor each tx and computetotal_priority_tip_eth(avg per block) andavg_tip_share_pct.--receipt-workers: Worker count for parallel receipt fetches (defaultruntime.NumCPU()).--receipt-batch-size: Number ofeth_getTransactionReceiptcalls per JSON-RPC batch request (default25).--timeout: Per-request timeout (default25s).--rate-limit-retries: Retry count for rate-limited RPC requests (default5).--rate-limit-backoff: Base backoff between rate-limit retries (default500ms).--rate-limit-max-backoff: Maximum backoff between rate-limit retries (default5s).--output: Optional path for JSON report file.--csv: Optional path for CSV segment report.--json: Print JSON report to stdout.
When --ethgas-relay-url is provided, each block is matched against relay delivered bids by block_hash using:
/relay/v1/data/bidtraces/proposer_payload_delivered?block_hash=<hash>
If a matching block_hash is found in the relay response, the block is treated as an EthGas relay block.
EthGas blocks are counted only in the EthGas table (not in the non-EthGas table).