💎 Ethereum
trace_call

trace_call RPC Method

Executes a call like eth_call but returns traces.

Parameters

1.TRANSACTION CALL OBJECT [required]

Similar to eth_call.

object

  • from [optional] - The address from which the transaction is sent.

  • to - The address where the transaction is sent to.

  • gas [optional] - Integer of the gas provided for the transaction execution. Although eth_call consumes zero gas, this parameter may still be needed by some executions.

  • gasPrice [optional] - Integer of the gasPrice used for each paid gas as hexadecimal.

  • value [optional] - Interger of the value sent with a stated transaction

  • data [optional] - Hash of the method signature and encoded parameters. More info 👉 Ethereum Contract ABI (opens in a new tab)

2.TRACE TYPE [required]

  • array - The type of traces to include

    • vmTrace - Include the full trace of the virtual machine during the transaction

    • trace - Include the basic trace of the transaction

    • stateDiff - Include state changes caused by the transaction

3.BLOCK PARAMETER [required]

The string "latest", "earliest", "pending", "safe" or "finalized", or an hexadecimal block number."Safe" and "finalized" are only availible on Ethereum and Arbitrum One chains. Read block parameter description in Ethereum documentation (opens in a new tab).

Need RPC API keys?

Get 12.5M archival requests for free today.

Returns

  • object - The trace object

    • output - The output (return value) of the call

    • stateDiff - The state changes that would happen due to the transaction in the given eth_call

    • vmTrace - The full trace of the virtual machine's state during execution of the given eth_call, including any sub-calls

    • trace - The trace of the call

      • action - The action to be performed

        • from - The address of the sender

        • callType - The type of method such as call, delegatecall

        • gas - The gas provided by the sender

        • input - The input data of the call or delegatecall

        • to - The address of the receiver

        • value - The amount of ETH sent with this transaction

      • result - The result of the transaction

        • gasUsed - Gas used by the transaction

        • output - The return value of the call. Can be empty.

      • subtraces - The traces of internal transactions (calls made by the contract)

      • 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

Request

POST https://<network>.chainnodes.org/YOUR-API-KEY

Example

💡

Confusing? Ask blockchain developers in Chainnodes Telegram Chat (opens in a new tab)

  • HTTPS POST Request with a JSON RPC call in the body
  • Replace YOUR-API-KEY with the API key from your Chainnodes.org Dashboard
  • You can use a different supported network by replacing mainnet
curl https://mainnet.chainnodes.org/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"method":"trace_call","params":[{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"},["stateDiff"], "latest"],"id":1,"jsonrpc":"2.0"}'

Body

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "output": "0x0000000000000000000000000000000000000000000000000858898f93629000",
        "stateDiff": {
            "0x0000000000000000000000000000000000000000": {
                "balance": {
                    "*": {
                        "from": "0x2722c44d6c83b4f6de2",
                        "to": "0x2722c41f47945f7a814"
                    }
                },
                "code": "=",
                "nonce": {
                    "*": {
                        "from": "0x0",
                        "to": "0x1"
                    }
                },
                "storage": {}
            }
        },
        "trace": [],
        "vmTrace": null
    }
}