Skip to content

chainbase-labs/evm-tracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

evm-tracer

A high-performance EVM execution tracer with prestate reconstruction, custom tracer support, and parallelized replay.

In the Ethereum ecosystem, extracting a complete list of ERC-20 token holders might sound straightforward — yet in practice, it’s one of the hardest challenges in reconstructing on-chain state.

  • The EVM’s mapping(address => uint256) is non-iterable by design.
  • Transfer events can be missing, reordered, or inconsistent.
  • Archive nodes are expensive and resource-intensive.
  • JSON-RPC queries are slow and limited by rate controls.

evm-tracer addresses this by replaying EVM execution directly, capturing every balance mutation as it happens —
ensuring complete, verifiable, and event-independent state reconstruction.

Instead of inferring state from events, evm-tracer directly observes how the EVM state evolves in real time — offering true God-mode visibility into on-chain behavior.

🚀 Features

  • Full Block Replay — execute every transaction locally and reconstruct state transitions precisely.
  • Prestate Support — load pre-execution state using debug_traceBlockByNumber.
  • Custom Tracer Support — use built-in or custom Go tracers (callTracer, 4byteTracer, prestateTracer, etc).
  • Parallel Execution — multi-core accelerated transaction replay.
  • Structured JSON Output — returns detailed call traces and receipts.
  • Archive-Level Accuracy — no reliance on event logs or approximations.

🧠 Core Concept

evm-tracer doesn’t guess the state — it observes it.

  • Captures SSTORE operations that modify contract storage.
  • Replays full blocks locally for verifiable execution context.
  • Outputs both execution traces and state changes as structured JSON.

This is not log parsing — it’s state machine replay.

🧮 Use Cases

  • Reconstruct ERC-20/721/1155 token holder snapshots
  • Analyze MEV and internal transactions
  • Trace contract execution paths and storage slot mutations
  • Lightweight archive-node alternative
  • On-chain audit and compliance reporting

⚡ Performance Comparison

Feature Traditional Approach evm-tracer
Data Source Transfer Events + eth_call Full Block + Prestate
RPC Calls Tens of thousands Only 2
Accuracy Depends on event integrity State-level accuracy
Historical Query Requires Archive Node Native support
Bottleneck Network / RPC rate Local computation

🧪 Example Usage

Example: trace all transactions in block #20000000 on Ethereum mainnet.

make run

🔍 WASM Demo

build to WASM:

make wasm

UI and demo: https://1block.dev

🧭 Roadmap

  • Multi-chain support (BSC, Polygon, Arbitrum, Optimism, etc)
  • Built-in parsers for ERC-20 / ERC-721 / ERC-1155 state changes
  • Wasm tracer engine
  • gRPC / REST API / CLI service layer
  • Web-based visualization tool

📄 License

MIT

About

prestate-based EVM custom tracer. demo:

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published