debug_traceCall
The debug_traceCall method executes a call without creating a transaction on the blockchain and returns the trace of the call execution. This method simulates a transaction call against the blockchain state at a specific block, providing detailed execution traces including opcode-level information, gas usage, and state changes.
This method is invaluable for debugging smart contract interactions, optimizing gas consumption, and understanding transaction behavior before actually sending a transaction to the network. Developers can test contract calls with different parameters, analyze internal function calls, identify gas inefficiencies, and debug failed transactions in a safe environment without spending gas or altering blockchain state. The trace output can be customized using different tracers to focus on specific aspects of execution.
This method is available only on the full archive node.
Parameters
parameter | type | description |
|---|---|---|
transaction | object (required) | The transaction call object |
blockParameter | string (required) | Block number in hex format or one of the string tags: 'latest', 'earliest', or 'pending' |
traceConfig | object (optional) | Configuration object to customize the trace output |
Transaction Object Properties:
property | type | description |
|---|---|---|
from | string (optional) | The address the call is sent from (20-byte hex string) |
to | string (required) | The address the call is directed to (20-byte hex string) |
gas | string (optional) | Gas provided for the call execution (hex) |
gasPrice | string (optional) | Gas price for each paid gas (hex) |
value | string (optional) | Value transferred with the call in wei (hex) |
data | string (optional) | The data payload sent with the call (method signature and encoded parameters) |
Trace Config Properties:
property | type | description |
|---|---|---|
tracer | string (optional) | The type of tracer: 'callTracer', 'prestateTracer', '4byteTracer', or custom JavaScript tracer |
timeout | string (optional) | Maximum time for the trace operation (e.g., '10s'). Defaults to '5s' |
disableStorage | boolean (optional) | Set to true to disable storage capture for faster tracing |
disableMemory | boolean (optional) | Set to true to disable memory capture |
disableStack | boolean (optional) | Set to true to disable stack capture |
enableMemory | boolean (optional) | Set to true to enable memory capture (opposite of disableMemory) |
enableReturnData | boolean (optional) | Set to true to enable return data capture |
Return Object
The method returns detailed trace information with structure depending on the tracer used:
With default tracer:
- gas -
number: Gas used by the execution - failed -
boolean: Whether the execution failed - returnValue -
string: The return data from the execution - structLogs -
array: Array of opcode execution steps, each containing pc (program counter), op (opcode), gas (remaining gas), gasCost (cost of operation), depth (call depth), stack (execution stack), memory (execution memory), and storage (modified storage)
With callTracer:
- type -
string: The type of the call (CALL, CREATE, DELEGATECALL, etc.) - from -
string: The address the call is from - to -
string: The address the call is to - value -
string: The value transferred - gas -
string: The gas provided - gasUsed -
string: The gas actually used - input -
string: The input data - output -
string: The output data - calls -
array: An array of nested calls made during execution
Request Example
Response Example