Polygon API Documentation
debug_traceTransaction RPC Method
debug_traceTransaction
returns the number of possible tracing result by executing an eth_call
within the context of the given block execution.
Parameters
-
Transaction hash
[required] -
Tracer object
[optional]-
The type of tracer
- It might becallTracer
orprestateTracer
-
callTracer
- The calltracer keeps track of all call frames, including depth 0 calls, that are made during a transaction. -
prestateTracer
- The prestateTracer replays the transaction and tracks every part of state that occured during the transaction.
-
-
tracerConfig
- The object to specify the configurations of the traceronlyTopCall
- When set to true, this will only trace the primary (top-level) call and not any sub-calls. It eliminates the additional processing for each call frame.
-
Additional configuration parameters
-
disableStorage
— when enabled, it prevents tracing of storage changes made by the transaction being analyzed, which can reduce the resource requirements of the analysis. By default,debug_traceTransaction
traces both memory and storage changes, but storage tracing can be particularly resource-intensive, especially for large transactions. -
disableStack
— when enabled, it skips tracing of stack changes made by the transaction being analyzed. -
disableMemory
— when true, it stops tracing of memory changes made by the transaction being analyzed, reducing resource requirements. -
disableReturnData
— when true, it prevents the method from tracing the return data of a transaction. This return data tracing can be very demanding on resources, as it requires a lot of time and processing power. -
timeout
(default: 5s) — allows to customize the method's timeout period for JavaScript-based tracing calls.
When using one of the three tracers, the
disableMemory
,disableStorage
,disableStack
, anddisableReturnData
will not have any effect.
When no tracer is selected, the response defaults to the Struct/opcode logger (opens in a new tab).
Need RPC API keys?
Get 12.5M archival requests for free today.
Returns
callTracer
response
Field | Description |
---|---|
type of the call | Type of the call |
from | The transaction sender. |
to | The address of the transaction recipient. |
gas | The gas included in the transaction by the sender. |
transaction value | The actual value per gas deducted from the sender's account. |
gasUsed | The total used gas by the call. Encoded as hexadecimal. |
input | The optional input data sent with the transaction, usually used to interact with smart contracts. |
output | The return value of the call, encoded as a hexadecimal string. |
error | An error message in case the execution failed. |
calls | A list of sub-calls made by the contract during the call, each represented as a nested call frame object. |
revertReason | The reason why the transaction was reverted, returned by the smart contract if any. |
prestateTracer
response
-
smart contract address
— The address of the smart contract associated with the result.-
balance
— The balance of the contract, expressed in wei and encoded as a hexadecimal string. -
code
— The bytecode of the contract, encoded as a hexadecimal string. -
nonce
— The nonce of the account associated with the contract, represented as an unsigned integer. -
storage
— A map of key-value pairs representing the storage slots of the contract. The keys and values are both encoded as hexadecimal strings.
-
Struct/opcode
response
-
The transaction trace object
: -
failed
- Successful or failed -
gas
- The total consumed gas in the transaction -
returnValue
- The return value of the executed contract call -
structLogs
- The trace result of each step:-
pc
- The current index in bytecode. -
op
- The name of current executing operation. -
gas
- The available gas in the execution. -
gasCost
- The gas cost of the operation. -
depth
- The number of levels of calling functions. -
stack
- An array of values in the current stack. -
storage
- The mapping of the current storage. -
refund
- The total of current refund value. -
error
- The error of the execution. -
memory
- An array of values in the current memory.
-
Request
POST https://<network>.chainnodes.org/YOUR-API-KEY
Example
- 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
polygon-mainnet
curl https://polygon-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"method":"debug_traceTransaction","params":["0xd19320daa641b029c043a8eeab7cc3f5a19c3c213119c72cf97b9a32428f0278", {"tracer": "callTracer"}],"id":1,"jsonrpc":"2.0"}'
💡 Confusing?
Ask our experienced blockchain developers in Telegram
Body
{
"jsonrpc":"2.0",
"id":1,
"result":{
"from":"0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5",
"gas":"0x2328",
"gasUsed":"0x5208",
"to":"0x6d2e03b7effeae98bd302a9f836d0d6ab0002766",
"input":"0x",
"value":"0x2b983193126b4ff",
"type":"CALL"
}
}
JSON-RPC API Documentation by CHAINNODES is based on Erigon node client. Contact us if you are interested in specific methods that are only available on geth, besu, Nethermind or reth.