trace_replayTransaction

Traces a call to eth_sendRawTransaction without making the call, returning the traces.

📘

Supported on ETH, BSC, opBNB, and Polygon.

Parameters

  • hash - The hash of a transaction
  • 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_replayTransaction","params":["0x02d4a872e096445e80d05276ee756cefef7f3b376bcec14246469c0cd97dad8f",["trace"]],"id":1,"jsonrpc":"2.0"}'

Result

{
  "jsonrpc": "2.0",
  "result": {
    "output": "0x",
    "stateDiff": null,
    "trace": [
      {
        "action": {
          "callType": "call",
          "from": "0x00a63d34051602b2cb268ea344d4b8bc4767f2d4",
          "gas": "0x0",
          "input": "0x",
          "to": "0x87cc0d78ee64a9f11b5affdd9ea523872eae14e4",
          "value": "0x810e988a393f2000"
        },
        "result": {
          "gasUsed": "0x0",
          "output": "0x"
        },
        "subtraces": 0,
        "traceAddress": [],
        "type": "call"
      }
    ],
    "vmTrace": null
  },
  "id": 0
}