trace_ vs debug_: which tracing namespace to reach for
If you have ever needed to know exactly what a transaction did — every internal call, every state change — you have run into the two EVM tracing namespaces. They overlap enough to confuse and differ enough to matter. This is a practical map.
The debug_ namespace
debug_traceTransaction and debug_traceCall are geth-native. They run a configurable tracer (the default struct logger, or built-ins like callTracer and prestateTracer) and return opcode-level or call-level detail. callTracer is the workhorse: it returns the full internal call tree with values, gas, and revert reasons, which is what most application developers actually want.
The trace_ namespace
trace_transaction, trace_block, and trace_filter originate from OpenEthereum/Erigon. trace_filter is the standout: it lets you query internal calls across a block range by from/to address without replaying transactions yourself — invaluable for following value flow or reconstructing an address's activity. There is no clean debug_ equivalent for that range-filter pattern.
Choosing between them
Reach for debug_ callTracer when you have a specific transaction hash and want its call tree. Reach for trace_filter when you have an address or block range and want every internal call touching it. For opcode-level gas profiling, use debug_ with the struct logger. All of these require archive state to run against historical blocks — a full node only traces recent history.
常见问题
Are both namespaces available on every chain?
No. Availability depends on the client. Erigon-based nodes expose both trace_ and debug_; some op-stack and other clients expose debug_ but not the full trace_ set. Check the method reference for the specific chain.
Why is tracing so much more expensive than a normal call?
Tracing replays the transaction through the EVM with instrumentation, and historical tracing needs the archive state at that block. Both the compute and the storage are heavier than a simple current-state read.
Related
充值、拿密钥、上线。
自助开通。支持加密货币或银行卡。按额度计费——重型原语更贵,简单调用很便宜。
获取 API 密钥