🟪 Polygon
trace_get

Polygon API Documentation


trace_get RPC Method

trace_get executes traces for the given transaction and only returns specified trace indexes.

Parameters

Transaction hash [required]

The transaction hash to trace.

Index positions [required]

The array of index positions of the traces to return. Hex encoded.

🔌 To use trace_get you must be connected to a blockchain node.

Returns

  • The trace object.

    • 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.

Request

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

Example

💡 Confusing?

Ask our experienced blockchain developers in Telegram

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

Body

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

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