💎 Ethereum
trace_replayBlockTransactions

trace_replayBlockTransactions RPC Method

Executes all transactions of a given block and returns their traces. Ideal for simulations and blockchain analysis.

Parameters

1.BLOCK PARAMETER [required]

The block number as hex or the Tag "latest", "earliest", "pending", "safe" or "finalized", or an hexadecimal block number.

"Safe" and "finalized" are only availible on Ethereum and Arbitrum One chains. Read block parameter description in Ethereum documentation (opens in a new tab).

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

    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.
    • output - The output (return value) of the call
    • transactionHash - The hash of the transaction being traced
    • stateDiff - The state changes that would happen due to the transaction in the given eth_call
    • 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
    • vmTrace - The full trace of the virtual machine's state during execution of the given eth_call, including any sub-calls

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 mainnet
curl https://mainnet.chainnodes.org/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"method":"trace_replayBlockTransactions","params":["0x1034094", ["stateDiff"]],"id":1,"jsonrpc":"2.0"}'

Body

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "output": "0x",
            "stateDiff": {
                "0x388c818ca8b9251b393131c08a736a67ccb19297": {
                    "balance": {
                        "*": {
                            "from": "0xcff94ae39cf4e199",
                            "to": "0xcffb1a75c99d3369"
                        }
                    },
                    "code": "=",
                    "nonce": "=",
                    "storage": {}
                },
                "0xd018538c87232ff95acbce4870629b75640a78e7": {
                    "balance": {
                        "*": {
                            "from": "0xb353f3b13344878d",
                            "to": "0xb401a228e066f78d"
                        }
                    },
                    "code": "=",
                    "nonce": "=",
                    "storage": {}
                },
                "0xfc5e7ea8694db2d784e8653b72c3c2913e2366c2": {
                    "balance": {
                        "*": {
                            "from": "0xb1a2bc2ec50000",
                            "to": "0x0"
                        }
                    },
                    "code": "=",
                    "nonce": {
                        "*": {
                            "from": "0x0",
                            "to": "0x1"
                        }
                    },
                    "storage": {}
                }
            },
            "trace": [],
            "vmTrace": null,
            "transactionHash": "0x76af15dd09aee8891ed7ee2ecc2334b2b638e877752b3efe1a37ec7dc8b71908"
        },
        {
            "output": "0x",
            "stateDiff": {
                "0x388c818ca8b9251b393131c08a736a67ccb19297": {
                    "balance": {
                        "*": {
                            "from": "0xcffb1a75c99d3369",
                            "to": "0xcffc4998a2eee539"
                            ............
                            ............
                            ............
                        }
                        }
                        }
                        }