trace_replayBlockTransactions

Replays all transactions in a block returning the requested traces for each transaction.

📘

Supported on ETH, BSC, opBNB, and Polygon.

Parameters

  • Quantity or Tag - Integer of a block number, or the string 'earliest', 'latest' or 'pending'.
  • array - The type of trace, one or more of:
    • trace - string - To get the basic trace of the given transaction
    • stateDiff - string - To get information on altered Ethereum state due to execution of the given transaction

Returns

  • array - The block traces, which have the following fields (please note that all return types are hexadecimal representations of their data type unless otherwise stated):
    • output - The data which is returned as an output encoded in hexadecimal format
    • stateDiff - It returns the information on altered Ethereum state due to execution of the given transaction
    • trace - It is used to retrieve the basic trace of the given information
      • action - The action to be performed on the receiver id
        • from - The address of the sender
        • callType - The type of method such as call, delegatecall
        • gas - The gas provided by the sender, encoded as hexadecimal
        • input - The data sent along with the transaction
        • to - The address of the receiver
        • value - The integer of the value sent with this transaction, encoded as hexadecimal
      • result - The integer of the gas price used encoded as hexadecimal
        • gasUsed - The total used gas by all transactions in this block encoded as hexadecimal
        • output - The value returned by the contract call, and it only contains the actual value sent by the RETURN method. If the RETURN method was not executed, the output is empty bytes
      • subtraces - The traces of contract calls made by the transaction
      • 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

API Endpoint

The format of a MegaNode API endpoint is https://{chain}-{network}.nodereal.io/v1/{API-key}
Here is an example:

https://eth-mainnet.nodereal.io/v1/4c0a1c23661a4e26bcbcwed461e34ea9

For other chains or networks, please refer to this guidance Find API key & endpoint.

Example

Request

curl https://eth-mainnet.nodereal.io/v1/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"method":"trace_replayBlockTransactions","params":["0x2ed119",["trace"]],"id":1,"jsonrpc":"2.0"}'

Result

{
  "jsonrpc": "2.0",
  "result": [
    {
      "output": "0x",
      "stateDiff": null,
      "trace": [
        {
          "action": {
            "callType": "call",
            "from": "0xaa7b131dc60b80d3cf5e59b5a21a666aa039c951",
            "gas": "0x0",
            "input": "0x",
            "to": "0xd40aba8166a212d6892125f079c33e6f5ca19814",
            "value": "0x4768d7effc3fbe"
          },
          "result": {
            "gasUsed": "0x0",
            "output": "0x"
          },
          "subtraces": 0,
          "traceAddress": [],
          "type": "call"
        }
      ],
      "transactionHash": "0x07da28d752aba3b9dd7060005e554719c6205c8a3aea358599fc9b245c52f1f6",
      "vmTrace": null
    },
    {
      "output": "0x",
      "stateDiff": null,
      "trace": [
        {
          "action": {
            "callType": "call",
            "from": "0x4f11ba23bb526c0486d83c6a8f18f632f3fc172a",
            "gas": "0x0",
            "input": "0x",
            "to": "0x7ed1e469fcb3ee19c0366d829e291451be638e59",
            "value": "0x446cde325fbfbe"
          },
          "result": {
            "gasUsed": "0x0",
            "output": "0x"
          },
          "subtraces": 0,
          "traceAddress": [],
          "type": "call"
        }
      ],
      "transactionHash": "0x056f11efb5da4ff7cf8523cfcef08393e5dd2ff3ab3223e4324426d285d7ae92",
      "vmTrace": null
    },
    {
      ...
    }
  ],
  "id": 0
}