debug_traceCall

How to use it

// yarn add @tatumio/tatum

import { TatumSDK, Tron, Network } from '@tatumio/tatum'

// Initialize the SDK for the TRON network
const tatum = await TatumSDK.init<Tron>({network: Network.TRON})
  
const tatum = await TatumSDK.init<EON>({network: Network.EON})

const result = await tatum.rpc.debugTraceCall({
      "from": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86",
      "to": "0xa41d19F4258a388c639B7CcD938FCE3fb7D05e87",
      "gas": "0x76c0",
      "gasPrice": "0x9184e72a000",
      "value": "0x9184e72a",
      "data": "0x606060..."
    },
    "0xAD7C5E",
    {
  tracer: 'callTracer',
  tracerConfig: {
      onlyTopCall: true,
      timeout: '5s',
  }
}
)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs

Overview

debug_traceCall is an RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call.

Parameters

The debug_traceCall method accepts the following parameters:

  • transaction: An object that contains the following fields:

    • from: The address from which the call is initiated. Example: "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d"

    • to: The address of the contract to be called. Example: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"

    • gas: (Optional) The gas limit for the call. Example: "0x76c0"

    • gasPrice: (Optional) The gas price for the call. Example: "0x9184e72a000"

    • value: (Optional) The value to be transferred during the call. Example: "0x9184e72a"

    • data: (Optional) The input data for the call, encoded as a hexadecimal string. Example: "0x606060..."

  • blockNumber: The block number as a hexadecimal string for which the call should be traced. Example: "0x1b4"

Return Object

The return object is an object containing the following fields:

  • output: The output data from the call.

  • gasUsed: The total gas used by the call.

  • calls: An array of objects, each representing a nested call made during the call. Each object contains:

    • from: The address the call was made from.

    • gas: The gas provided for the call.

    • gasUsed: The gas used by the call.

    • to: The address the call was made to.

    • input: The input data for the call.

    • output: The output data from the call.

    • type: The type of the call (e.g., "STATICCALL").

This method is available only on the full archive node.

JSON-RPC Request and Response Examples

Request

{