trace_call - Polygon
trace_call. Perform a transaction call and trace its execution
trace_call - polygon [Value: 60CU]
Executes a new message call immediately without creating a transaction on the blockchain, and returns detailed trace information about the execution
Use cases
- Debug smart contract function calls by tracing
- Analyze specific transactions for internal operations
- Investigate gas usage of complex contract interactions
Constraints
- Requires valid input data and addresses
- Node must support trace_call method
- Large data output for complex transactions
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl https://polygon.drpc.org \
-X POST \
-H "Content-Type: application/json" \
-d '{"method":"trace_call",
"params":[{
"from": "0x6f1FB6EFDf50F34bFA3F2bC0E5576EdD71631638",
"to": "0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e",
"value": "0x0",
"data": "0xa67a6a45000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000"},
["trace"]],
"id":1,
"jsonrpc":"2.0"}'
Response
200
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"output": "0x",
"stateDiff": null,
"trace": [
{
"action": {
"callType": "call",
"from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
"gas": "0x76c0",
"input": "0x",
"to": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value": "0x186a0"
},
"blockHash": "0x...",
"blockNumber": 1234567,
"result": {
"gasUsed": "0x5208",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [],
"transactionHash": "0x...",
"transactionPosition": 0,
"type": "call"
}
// Additional trace objects can be included here
],
"vmTrace": null
},
{
"output": "0x",
"stateDiff": null,
"trace": [
{
"action": {
"callType": "call",
"from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
"gas": "0x76c0",
"input": "0x",
"to": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value": "0x186a0"
},
"blockHash": "0x...",
"blockNumber": 1234567,
"result": {
"gasUsed": "0x5208",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [],
"transactionHash": "0x...",
"transactionPosition": 0,
"type": "call"
}
// Additional trace objects can be included here
],
"vmTrace": null
}
]
}{
"jsonrpc": "2.0",
"result": {
"output": "0x",
"stateDiff": null,
"trace": [
{
"action": {
"callType": "call",
"from": "0x6f1fb6efdf50f34bfa3f2bc0e5576edd71631638",
"gas": "0x1dcd11f8",
"input": "0xa67a6a45000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000",
"to": "0x1e0447b19bb6ecfdae1e4ae1694b0c3659614e4e",
"value": "0x0"
},
"error": "Reverted",
"subtraces": 0,
"traceAddress": [],
"type": "call"
}
],
"vmTrace": null
},
"id": 0
}
Request params
idinteger
jsonrpcstring
methodstring
array
transactionobject
The transaction call object which contains the following fields.
array
blockHashstring
Hash of the block containing the transaction.
blockNumberstring
Block number containing the transaction.
transactionIndexstring
Position of the transaction in the block (null if pending)
fromstring
Transaction hash.
gasstring
Gas provided by the sender.
gasPricestring
Gas price provided by the sender in wei.
tostring
Receiver's address (null if contract creation).
valuestring
Value transferred in Wei.
blockNumberstring
(optional) Block number as an integer, or string
- latest [default] - The most recent block in the blockchain (default).
- earliest - The first block, also known as the genesis block.
- pending - Transactions that have been broadcast but not yet included in a block.
traceTypestring
Specifies the trace options, such as "vmTrace", "trace", and "stateDiff".
- trace [default] - To get the basic trace of the given transaction.
- vmTrace - To get a full trace of the virtual machine's state during the execution of the given of given transaction, including for any subcalls
- stateDiff - To get information on altered Ethereum state due to execution of the given transaction.
Response
200
The trace resultsResponse params
object
idinteger
jsonrpcstring
resultobject
object
actionobject
Contains details about the trace action.
object
callTypestring
The type of call.
fromstring
The sender's address.
tostring
The receiver's address.
valuestring
The value transferred in wei.
gasstring
The gas provided for the call.
inputstring
The data sent with the call.
blockHashstring
The hash of the block where the trace occurred.
blockNumberstring
The number of the block where the trace occurred.
resultstring
object
gasUsedstring
Gas used by the trace.
outputstring
Call output.
subtracesinteger
Number of subtraces created by this trace..
traceAddressarray_of_strings
Position of this trace in the call stack.
transactionHashstring
Hash of the transaction containing this trace.
transactionPositionstring
Transaction's position in the block.
typestring
The type of trace.
vmTracestring
To get a full trace of the virtual machine's state during the execution of the given of given transaction, including for any subcalls
Last updated on