🟪 Polygon
trace_filter

Polygon API Documentation


trace_filter RPC Method

trace_filter executes traces of all transactions on a given block range and returns only the ones that match the given filter. Parity Style.

Parameters

  • Filter object [required]

    • fromBlock - The lower range of blocks to include

    • toBlock - The upper range of blocks to include

    • fromAddress - Sender addresses to filter for. MUST BE AN ARRAY.

    • toAddress - Recipient addresses to filter for. MUST BE AN ARRAY.

    • after - The offset trace number if doing a pagination

    • count - Number of traces to return if doing a pagination

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.

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_filter","params":[{ "fromBlock": "0x1034163", "toBlock": "0x103416D", "fromAddresses": ["0x61c53fd4dadbc9666a990148003c3d5436767c9f"], "count": 1 }],"id":1,"jsonrpc":"2.0"}'

Body

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "action": {
                "from": "0x61c53fd4dadbc9666a990148003c3d5436767c9f",
                "callType": "call",
                "gas": "0x0",
                "input": "0x",
                "to": "0xa86309988947559b6e72ef716c5058f479386c0f",
                "value": "0x40fdf31f2e8840"
            },
            "blockHash": "0x2594db83b08edb01aca8160b20b3100c41e2b5c3481384ec766ed22d3c1738a8",
            "blockNumber": 16990563,
            "result": {
                "gasUsed": "0x0",
                "output": "0x"
            },
            "subtraces": 0,
            "traceAddress": [],
            "transactionHash": "0x8aed1b80773af213775f668be8419f45d875a83e9310fce24b431be1aff6045b",
            "transactionPosition": 0,
            "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