debug_traceCall

The debug_traceCall method lets you run an eth_call within the context of the given block execution using the final state of parent block as the base. The first argument (just as in eth_call) is a transaction object. The block can be specified either by hash or by number as the second argument. The trace can be configured similar to debug_traceTransaction, see TraceConfig. The method returns the same output as debug_traceTransaction.

Parameters

  • Object - The transaction call object
    • from: DATA, 20 Bytes - The address the transaction is sent from.
    • to: DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.
    • gas: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas.
    • gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas.
    • value: QUANTITY - (optional) Integer of the value sent with this transaction.
    • data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters.
    • nonce: QUANTITY - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
  • hash|QUANTITY|TAG - block hash, or hex encoded integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
  • object- (Optional) The tracer object with the following fields:
    • disableStorage: boolean - Setting this to true will disable storage capture (default = false).
    • disableStack: boolean - Setting this to true will disable stack capture (default = false).
    • enableMemory: boolean - Setting this to true will disable memory capture (default = false).
    • enableReturnData: boolean - Setting this to true will disable stack capture (default = false).
    • tracer: string - The type of tracer. It could be callTracer or prestateTracer
      • callTracer - The calltracer keeps track of all call frames, including depth 0 calls, that are made during a transaction
      • prestateTracer - The prestateTracer replays the transaction and tracks every part of state that occured during the transaction
    • tracerConfig: object - The object to specify the configurations of the tracer
      • onlyTopCall: boolean - When set to true, this will only trace the primary (top-level) call and not any sub-calls. It eliminates the additional processing for each call frame
curl https://ethereum-mainnet-archive.allthatnode.com/8U3JLUhzIDg3GShvy9hkCCSYkLGc11kj \
--request POST \
--header "Content-Type: application/json" \
--data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "debug_traceCall",
  "params": [
    {
      "from": "0xc5a93444Cc4dA6EfB9e6FC6e5D3CB55A53b52396",
      "to": "0x6b175474e89094c44da98b954eedeac495271d0f",
      "gas": "0x76c00",
      "gasPrice": "0xe1cb98800",
      "value": "0x9184e72a",
      "data": "0x"
    },
    "latest",
    {
      "enableMemory": true,
      "disableStack": false,
      "disableStorage": false,
      "enableReturnData": true
  }
  ]
}'

Returns

  • object - trace object
    • failed - The transaction is successful or not
    • gas - The total consumed gas in the transaction
    • returnValue - The return value of the executed contract call
    • structLogs - The trace result of each step with the following fields:
      • pc - The current index in bytecode
      • op - The name of current executing operation
      • gas - The available gas in the execution
      • gasCost - The gas cost of the operation
      • depth - The number of levels of calling functions
      • error - The error of the execution
      • stack - An array of values in the current stack
      • memory - An array of values in the current memory
      • storage - The mapping of the current storage
      • refund - The total of current refund value
//with default tracer option
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "gas": 21045,
        "failed": true,
        "returnValue": "",
        "structLogs": [
            {
                "pc": 0,
                "op": "PUSH1",
                "gas": 465400,
                "gasCost": 3,
                "depth": 1,
                "stack": [],
                "memory": []
            },
            {
                "pc": 2,
                "op": "PUSH1",
                "gas": 465397,
                "gasCost": 3,
                "depth": 1,
                "stack": [
                    "0x80"
                ],
                "memory": []
            },
            {
                "pc": 4,
                "op": "MSTORE",
                "gas": 465394,
                "gasCost": 12,
                "depth": 1,
                "stack": [
                    "0x80",
                    "0x40"
                ],
                "memory": []
            },
            {
                "pc": 5,
                "op": "CALLVALUE",
                "gas": 465382,
                "gasCost": 2,
                "depth": 1,
                "stack": [],
                "memory": [
                    "0000000000000000000000000000000000000000000000000000000000000000",
                    "0000000000000000000000000000000000000000000000000000000000000000",
                    "0000000000000000000000000000000000000000000000000000000000000080"
                ]
            },
            //more objects
            {
                "pc": 14,
                "op": "DUP1",
                "gas": 465358,
                "gasCost": 3,
                "depth": 1,
                "stack": [
                    "0x9184e72a",
                    "0x0"
                ],
                "memory": [
                    "0000000000000000000000000000000000000000000000000000000000000000",
                    "0000000000000000000000000000000000000000000000000000000000000000",
                    "0000000000000000000000000000000000000000000000000000000000000080"
                ]
            },
            {
                "pc": 15,
                "op": "REVERT",
                "gas": 465355,
                "gasCost": 0,
                "depth": 1,
                "stack": [
                    "0x9184e72a",
                    "0x0",
                    "0x0"
                ],
                "memory": [
                    "0000000000000000000000000000000000000000000000000000000000000000",
                    "0000000000000000000000000000000000000000000000000000000000000000",
                    "0000000000000000000000000000000000000000000000000000000000000080"
                ]
            }
        ]
    }
}


//with callTracer option
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "from": "0xc5a93444cc4da6efb9e6fc6e5d3cb55a53b52396",
    "gas": "0x76c00",
    "gasUsed": "0x5208",
    "to": "0x7c4cbc1c8cb34e3ae021e66efda4c69d759ff499",
    "input": "0x",
    "value": "0x9184e72a",
    "type": "CALL"
  }
}

Try Yourself

Language
Click Try It! to start a request and see the response here!