🟪 Polygon
trace_transaction

Polygon API Documentation


trace_transaction RPC Method

trace_transaction JSON-RPC method executes traces for the given transaction and returns all the specific traces.

Parameters

1.Transaction hash [required]

The transaction hash to trace.

Request

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

Need RPC API keys?

Get 12.5M archival requests for free today.

Returns

  • array - The list of trace objects. One per transaction in the block.

    • action - The action performed, parity style.

      • from - The sender address.

      • to - The receiver address.

      • callType - The type of the call, either call or delegatecall.

      • gas - The gas provided.

      • input - The input data of the action (transaction).

      • value - The amount of ETH sent in this action (transaction).

      • author - The author of this transaction, for some transaction types.

      • rewardType - The type of the reward, for reward transactions.

    • blockHash - The hash of the block where this action happened.

    • blockNumber - The number of the block where this action happened.

    • result - The result object, parity style.

      • gasUsed - The amount of gas used by this transaction.

      • output - The output of this transaction.

    • subtraces - The number of traces of internal transactions that happened during this transaction.

    • traceAddress - The trace addresses (array) where the call executed (every contract where code was executed).

    • transactionHash - The hash of the transaction being traced.

    • transactionPosition - The position of the transaction in the block.

    • type - The type of the transaction like call or create or reward.

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":"trace_transaction","params":["0x6cb6f41be1384dfb2c03eb3de02b68440923575baf77fb1f8b7ccf3ed9505dd6"],"id":1,"jsonrpc":"2.0"}'

💡 Confusing?

Ask our experienced blockchain developers in Telegram

Body

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "action": {
                "from": "0x49fabee6cadf2dd5bf738f9c0dfabbb2c8fd6a81",
                "callType": "call",
                "gas": "0x1ed8eb",
                "input": "0xb3be57f8000000000000000000000000000000000000000000000000000000000000002000000000000000000.........
                .........
                .........195e6c477302757d3121dd427cbe750f74e0e3cf76783b083db3d90d602accbbc",
                "to": "0x000000000000ad05ccc4f10045630fb830b95127",
                "value": "0x0"
            },
            "blockHash": "0x70c05b19b13856e90b07bb559cd9b7e222810d812543ba4bc2afe7990a79a586",
            "blockNumber": 16990620,
            "result": {
                "gasUsed": "0x1a7fc2",
                "output": "0x"
            },
            "subtraces": 1,
            "traceAddress": [],
            "transactionHash": "0x6cb6f41be1384dfb2c03eb3de02b68440923575baf77fb1f8b7ccf3ed9505dd6",
            "transactionPosition": 140,
            "type": "call"
        },
        {
            "action": {
                "from": "0x000000000000ad05ccc4f10045630fb830b95127",
                "callType": "delegatecall",
                "gas": "0x1e399c",
                "input": "0xb3be57f8000000000000000000000000000000000000000000000000000000000000002000000000000000000........
                ........
                ........083db3d90d602accbbc",
                "to": "0x983e96c26782a8db500a6fb8ab47a52e1b44862d",
                "value": "0x0"
            },
            "blockHash": "0x70c05b19b13856e90b07bb559cd9b7e222810d812543ba4bc2afe7990a79a586",
            "blockNumber": 16990620,
            "result": {
                "gasUsed": "0x1a5b1e",
                "output": "0x"
            },.....
            ......
            ......
 

JSON-RPC Polygon 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