🟪 Polygon
trace_rawTransaction

Polygon API Documentation


trace_rawTransaction RPC Method

trace_rawTransaction executes a raw transaction but returns traces instead of posting it on chain.

Note: Chainnodes does not support trace_rawTransaction yet as erigon (opens in a new tab) hasn't implemented it to date. In the meantime you can easily replace this call with trace_call.

Parameters

1.RAW TRANSACTION [required]

The raw transaction as a string.

2.TRACE TYPE [required]

  • array - The type of traces to include

    • vmTrace - Include the full trace of the virtual machine during the transaction

    • trace - Include the basic trace of the transaction

    • stateDiff - Include state changes caused by the transaction

Returns

  • object - The trace object

    • output - The output (return value) of the call

    • stateDiff - The state changes that would happen due to the transaction in the given eth_call

    • vmTrace - The full trace of the virtual machine's state during execution of the given eth_call, including any sub-calls

    • trace - The trace of the call

      • action - The action to be performed

        • from - The address of the sender

        • callType - The type of method such as call, delegatecall

        • gas - The gas provided by the sender

        • input - The input data of the call or delegatecall

        • to - The address of the receiver

        • value - The amount of ETH sent with this transaction

      • result - The result of the transaction

        • gasUsed - Gas used by the transaction

        • output - The return value of the call. Can be empty.

      • subtraces - The traces of internal transactions (calls made by the contract)

      • traceAddress - The list of addresses where the call was executed, the address of the parents and the order of the current sub call

      • type - The value of the method such as call or create

Need RPC API keys?

Get 12.5M archival requests for free today.

Request

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

Example

💡

Confusing? Ask blockchain developers in Chainnodes Telegram Chat (opens in a new tab)

  • 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_rawTransaction","params":["0xf6199ca6dca83e5d4d828ba4a586841067423d12da558bf1c3cd054c6be39bce",["statediff"]],"id":1,"jsonrpc":"2.0"}'

Body

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "output": "0x0000000000000000000000000000000000000000000000000858898f93629000",
        "stateDiff": {
            "0x0000000000000000000000000000000000000000": {
                "balance": {
                    "*": {
                        "from": "0x2722f4b4a37258f501e",
                        "to": "0x2722f48ab4cbdf40684"
                    }
                },
                "code": "=",
                "nonce": {
                    "*": {
                        "from": "0x0",
                        "to": "0x1"
                    }
                },
                "storage": {}
            }
        },
        "trace": [],
        "vmTrace": null
    }
}

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