trace_call
Executes the given call and returns a number of possible traces for it. Use this API to retrieve detailed information about the transaction execution, including state changes and logs generated during the process.
Parameters
- transaction call object[Required] with the following keys and their values:- from: 20 bytes. The address the transaction is sent from.
- to: 20 bytes. The address the transaction is directed to.
- gas: [optional] The hexadecimal value of the gas provided for the transaction execution.
- gasPrice: [optional] The hexadecimal value of the gasPrice used for each paid gas.
- maxPriorityFeePerGas: [optional] Maximum fee, in Wei, the sender is willing to pay per gas above the base fee. See EIP-1559 transactions.
- maxFeePerGas: [optional] Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. See EIP-1559 transactions.
- value: [optional] The hexadecimal equivalent of the value sent with this transaction.
- data: [optional] The hash of the method signature and encoded parameters. See the Ethereum contract ABI specification.
 
- block parameter: [Required] The hexadecimal block number, or the string- latest,- earliest, or- pending. See the default block parameter.
- options: A list of tracing options. Tracing options are- traceand- stateDiff.
Returns
Example
Replace <YOUR-API-KEY> with an API key from your Infura dashboard.
Request
- cURL
- WSS
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "trace_call", "params": [{"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "to": "0x0010000000000000000000000000000000000000", "gas": "0xfffff2", "gasPrice": "0xef", "value": "0x0", "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", "nonce": "0x0"}, ["trace"], "latest"], "id": 1}'
wscat -c wss://mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc": "2.0", "method": "trace_call", "params": [{"from":"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "to": 0x0010000000000000000000000000000000000000", "gas": "0xfffff2", "gasPrice": "0xef", "value": "0x0", "data": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", "nonce": "0x0"}, ["trace"], "latest"], "id":1}'
Response
- JSON
{
  "jsonrpc": "2.0",
  "result": {
    "output": "0x",
    "stateDiff": null,
    "trace": [
      {
        "action": {
          "callType": "call",
          "from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
          "gas": "0xffabba",
          "input": "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002",
          "to": "0x0010000000000000000000000000000000000000",
          "value": "0x0"
        },
        "result": {
          "gasUsed": "0x9c58",
          "output": "0x"
        },
        "subtraces": 0,
        "traceAddress": [],
        "type": "call"
      }
    ],
    "vmTrace": null
  },
  "id": 2
}