Skip to main content

debug_traceCall

Parameters

In addition to the hash of the transaction you may give it a secondary optional argument, which specifies the options for this specific call. The possible options are:

  • object - The transaction call object with the following fields:
    • from:OPTIONAL (string) - The address the transaction is sent from
    • to: OPTIONAL (string) - The address the transaction is directed to
    • gas:OPTIONAL (integer) - The integer of the gas provided for the transaction execution
    • gasPrice:OPTIONAL (integer) - The integer of the gasPrice used for each paid gas
    • value:OPTIONAL (integer) - The integer of the value sent with this transaction
    • data:OPTIONAL (string) -The hash of the method signature and encoded parameters
  • blockReference:(string) - The block number in hexadecimal format, the block hash, or tags. The supported tag values include earliest for the earliest/genesis block, latest for the latest mined block, pending for the pending state/transactions, safe for the most recent secure block, and finalized for the most recent secure block
  • object - OPTIONAL The tracer object with the following fields:
    • 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

Returns:

  • result - The transaction trace object, which has the following fields:
    • 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

Example

Request

curl https://ava-mainnet.blastapi.io/<project-id>/ext/bc/C/rpc \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"debug_traceCall","params":[{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"}, "latest"],"id":1,"jsonrpc":"2.0"}'

Response:

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"gas": 21432,
"failed": false,
"returnValue": "",
"structLogs": []
}
}