trace_call

Executes the given call and returns a number of possible traces for it.

📘

Supported on ETH, BSC, opBNB, and Polygon.

Parameters

  • Object - Call options, same as eth_call.
    • from: Address - (optional) 20 Bytes - The address the transaction is sent from.
    • to: Address - (optional when creating new contract) 20 Bytes - The address the transaction is directed to.
    • gas: Quantity - (optional) Integer formatted as a hex string of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
    • gasPrice: Quantity - (optional) Integer formatted as a hex string of the gas price used for each paid gas.
    • value: Quantity - (optional) Integer formatted as a hex string of the value sent with this transaction.
    • data: Data - (optional) 4 byte hash of the method signature followed by encoded parameters. For details see Ethereum Contract ABI.
  • Array - Type of trace, one or more of: "trace", "stateDiff".
  • Quantity or Tag - (optional) Integer formatted as a hex string that represents a block number, or the string earliest or latest.

Returns

  • array - The block traces, which have the following fields (please note that all return types are hexadecimal representations of their data type unless otherwise stated):
    • output - The data which is returned as an output encoded in hexadecimal format
    • stateDiff - It returns the information on altered Ethereum state due to execution of the given transaction
    • trace - It is used to retrieve the basic trace of the given information
      • action - The action to be performed on the receiver id
        • from - The address of the sender
        • callType - The type of method such as call, delegatecall
        • gas - The gas provided by the sender, encoded as hexadecimal
        • input - The data sent along with the transaction
        • to - The address of the receiver
        • value - The integer of the value sent with this transaction, encoded as hexadecimal
      • result - The integer of the gas price used encoded as hexadecimal
        • gasUsed - The total used gas by all transactions in this block encoded as hexadecimal
        • output - The value returned by the contract call, and it only contains the actual value sent by the RETURN method. If the RETURN method was not executed, the output is empty bytes
    • subtraces - The traces of contract calls made by the transaction
    • traceAddress - The list of addresses where the call was executed, the address of the parents, and the order of the current sub call
    • type - The value of the method such as call or create

API Endpoint

The format of a MegaNode API endpoint is https://{chain}-{network}.nodereal.io/v1/{API-key}
Here is an example:

https://eth-mainnet.nodereal.io/v1/4c0a1c23661a4e26bcbcwed461e34ea9

For other chains or networks, please refer to this guidance Find API key & endpoint.

Example

Request

curl https://eth-mainnet.nodereal.io/v1/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"method":"trace_call","params":[{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"},["trace"], "latest"],"id":1,"jsonrpc":"2.0"}'

Result

{
"jsonrpc":"2.0",
"id":1,
"result":
  {
    "output":"0x0000000000000000000000000000000000000000000000000858898f93629000",
    "stateDiff":null,
    "trace":[
      {
        "action":
          {
            "from":"0x0000000000000000000000000000000000000000",
            "callType":"call",
            "gas":"0x2fa9cc8",
            "input":"0x70a082310000000000000000000000006e0d01a76c3cf4288372a29124a26d4353ee51be",
            "to":"0x6b175474e89094c44da98b954eedeac495271d0f",
            "value":"0x0"
          },
        "result":
          {
            "gasUsed":"0xa2a",
            "output":"0x0000000000000000000000000000000000000000000000000858898f93629000"
          },
        "subtraces":0,
        "traceAddress":[],
        "type":"call"
      }
    ],
  "vmTrace":null
  }
}