Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ethereum Transaction Segment Analyzer

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), and max priority 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.

Build

go build ./...

Run

go run ./cmd/segment-analyzer \
  --rpc-url https://your-rpc-endpoint \
  --start-block 22000000 \
  --end-block 22000010 \
  --segments 8

Using environment variable:

ETH_RPC_URL=https://your-rpc-endpoint go run ./cmd/segment-analyzer \
  --start-block latest \
  --segments 6

Include receipt-based profitability:

go run ./cmd/segment-analyzer \
  --rpc-url https://your-rpc-endpoint \
  --start-block 22000000 \
  --end-block 22000002 \
  --segments 8 \
  --with-receipts

Tune 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 50

Write 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.json

Write 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.csv

Print JSON report to stdout:

go run ./cmd/segment-analyzer \
  --rpc-url https://your-rpc-endpoint \
  --start-block 22000000 \
  --end-block 22000002 \
  --segments 8 \
  --json

Flags

  • --rpc-url: Ethereum JSON-RPC URL. Falls back to ETH_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..., or latest).
  • --end-block: End block number (decimal, 0x..., or latest). Defaults to start block.
  • --segments: Number of transaction-index segments.
  • --with-receipts: Fetch eth_getTransactionReceipt for each tx and compute total_priority_tip_eth (avg per block) and avg_tip_share_pct.
  • --receipt-workers: Worker count for parallel receipt fetches (default runtime.NumCPU()).
  • --receipt-batch-size: Number of eth_getTransactionReceipt calls per JSON-RPC batch request (default 25).
  • --timeout: Per-request timeout (default 25s).
  • --rate-limit-retries: Retry count for rate-limited RPC requests (default 5).
  • --rate-limit-backoff: Base backoff between rate-limit retries (default 500ms).
  • --rate-limit-max-backoff: Maximum backoff between rate-limit retries (default 5s).
  • --output: Optional path for JSON report file.
  • --csv: Optional path for CSV segment report.
  • --json: Print JSON report to stdout.

EthGas Block Detection

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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages