Skip to main content

TraceConfig

Configuration options for Ethereum execution tracing via debug_traceTransaction and debug_traceCall RPC methods.

Overview

TraceConfig controls what data is collected during transaction execution tracing. Different options trade off between detail and performance.

Type Definition

Usage

Basic Configuration

Using Tracers

Performance Optimization

Built-in Tracers

callTracer

Traces the call tree structure. Returns nested calls with gas usage, errors, and return data.

prestateTracer

Captures pre-execution state for all accessed accounts and storage slots.

4byteTracer

Counts function selector usage (first 4 bytes of calldata).

opcodeTracer

Default tracer that logs every opcode execution.

Performance Considerations

Memory Overhead

  • disableMemory: true - Saves significant memory for contracts with large memory usage
  • enableMemory: true - Required for debugging memory-related issues
  • Default: Memory tracking disabled

Storage Overhead

  • disableStorage: true - Reduces trace size for contracts with heavy SSTORE/SLOAD
  • Default: Storage tracking enabled

Stack Overhead

  • disableStack: true - Minimal savings, stack is usually small
  • Default: Stack tracking enabled

Use Cases

Debugging Transaction Reverts

Gas Profiling

Call Tree Analysis

State Access Patterns

RPC Methods

TraceConfig is used with these Geth debug RPC methods:

debug_traceTransaction

Traces an already-mined transaction.

debug_traceCall

Traces a call without mining it.

debug_traceBlockByNumber

Traces all transactions in a block.

debug_traceBlockByHash

Traces all transactions in a block by hash.

See Also