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 gas provided for the transaction execution, in hexadecimal.gasPrice
: [optional] The gas price used for each paid gas, in hexadecimal.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 value sent with this transaction, in hexadecimal.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 stringlatest
,earliest
, orpending
. See the default block parameter.options
: A list of tracing options. Tracing options aretrace
andstateDiff
.
Returns
Example
Replace <YOUR-API-KEY>
with an API key from your MetaMask Developer 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
}