TraceResult
Complete execution trace result returned bydebug_traceTransaction and debug_traceCall. Contains either opcode-level logs or call tree depending on tracer configuration.
Overview
TraceResult is the top-level response from Geth’s debug tracing methods. It provides execution outcome (gas used, success/failure, return data) plus optional detailed trace data.Type Definition
Usage
Creating TraceResults
Accessing Trace Data
RPC Usage
debug_traceTransaction
debug_traceCall
Common Patterns
Analyzing Failed Transactions
Gas Profiling
Finding Expensive Operations
Extracting Storage Changes
Call Flow Visualization
Tracer-Specific Results
Default Tracer (structLogs)
callTracer
prestateTracer
Performance Considerations
Memory Usage
structLogscan be very large (10k+ entries for complex transactions)- Each log contains stack/memory/storage snapshots
- Use
TraceConfig.disableAll()for minimal memory
Processing Time
- Opcode-level tracing is slow (10-100x slower than normal execution)
- callTracer is faster (only tracks calls, not every opcode)
- Use timeouts in TraceConfig for long-running traces
Best Practices
Security Analysis
Reentrancy Detection
SELFDESTRUCT Detection
See Also
- TraceConfig - Trace configuration options
- StructLog - Opcode-level trace entry
- CallTrace - Call tree structure
- OpStep - Typed opcode step

