Skip to content

Trace Module

The trace module provides APIs to query and execute EVM transaction state changes with full stack traces. These are often used by explorers or developers wanting to inspect the internal sub-calls of transactions (e.g. internal ether transfers).


trace_call

Simulates a transaction execution without publishing it, capturing a full trace of all nested internal EVM calls.

Parameters

  1. Object - Transaction call details (see eth_call).
  2. Array - Trace types to capture: "trace", "vmTrace", "stateDiff".
  3. QUANTITY|TAG - Block number or tag parameter (see the block parameter).

Returns

Object - An object containing trace data:

  • action: Object - Source, destination, input data, gas, and value of the call.
  • result: Object - Gas used and output bytes.
  • subtraces: Number - Number of internal child calls.
  • traceAddress: Array - Path of call positions in the execution tree.
  • type: String - Type of action (call, create, suicide).

Example

js
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"trace_call","params":[{"from":"0x407d73d8a49eeb85d32cf465507dd71d507100c1","to":"0xeb85a5557e5bdc18ee1934a89d8bb402398ee26a","value":"0xde0b6b3a7640000"}, ["trace"], "latest"],"id":1}'
// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "output": "0x",
    "stateDiff": null,
    "trace": [
      {
        "action": {
          "callType": "call",
          "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
          "gas": "0x76c0",
          "input": "0x",
          "to": "0xeb85a5557e5bdc18ee1934a89d8bb402398ee26a",
          "value": "0xde0b6b3a7640000"
        },
        "blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "blockNumber": 0,
        "result": {
          "gasUsed": "0x0",
          "output": "0x"
        },
        "subtraces": 0,
        "traceAddress": [],
        "transactionHash": null,
        "transactionPosition": null,
        "type": "call"
      }
    ],
    "vmTrace": null
  }
}

trace_rawTransaction

Simulates the execution of a signed raw transaction, returning transaction traces.

Parameters

  1. DATA - Signed transaction bytes.
  2. Array - Trace types to capture: "trace", "vmTrace", "stateDiff".

Returns

Object - Simulated trace result object (see trace_call).

Example

js
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"trace_rawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675", ["trace"]],"id":1}'
// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "output": "0x",
    "stateDiff": null,
    "trace": [
      {
        "action": {
          "callType": "call",
          "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
          "gas": "0x76c0",
          "input": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675",
          "to": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f07244567",
          "value": "0x0"
        },
        "result": {
          "gasUsed": "0x5208",
          "output": "0x"
        },
        "subtraces": 0,
        "traceAddress": [],
        "type": "call"
      }
    ]
  }
}

trace_block

Returns traces for all transactions in the specified block.

Parameters

  1. QUANTITY|TAG - Block number or tag (see the block parameter).

Returns

Array - Array of transaction traces (see trace_call).

Example

js
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"trace_block","params":["0x1b4"],"id":1}'
// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
    {
      "action": {
        "callType": "call",
        "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
        "gas": "0x76c0",
        "input": "0x",
        "to": "0xeb85a5557e5bdc18ee1934a89d8bb402398ee26a",
        "value": "0xde0b6b3a7640000"
      },
      "blockHash": "0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2",
      "blockNumber": 436,
      "result": {
        "gasUsed": "0x0",
        "output": "0x"
      },
      "subtraces": 0,
      "traceAddress": [],
      "transactionHash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
      "transactionPosition": 0,
      "type": "call"
    }
  ]
}

trace_transaction

Returns traces for the specified transaction hash.

Parameters

  1. DATA, 32 Bytes - Transaction hash.

Returns

Array - List of execution steps/traces generated by the transaction.

Example

js
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"trace_transaction","params":["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"],"id":1}'
// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
    {
      "action": {
        "callType": "call",
        "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
        "gas": "0x76c0",
        "input": "0x",
        "to": "0xeb85a5557e5bdc18ee1934a89d8bb402398ee26a",
        "value": "0xde0b6b3a7640000"
      },
      "blockHash": "0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2",
      "blockNumber": 436,
      "result": {
        "gasUsed": "0x0",
        "output": "0x"
      },
      "subtraces": 0,
      "traceAddress": [],
      "transactionHash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
      "transactionPosition": 0,
      "type": "call"
    }
  ]
}