> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# trace_replayTransaction | Arc

> Arc API method that replays a specific transaction and returns detailed execution traces. trace_replayTransaction on Arc via Chainstack.

Arc API method that replays a specific transaction and returns detailed execution traces. This is useful for debugging transaction behavior with customizable trace options.

## Parameters

* `transactionHash` — the hash of the transaction to replay
* `traceTypes` — array of trace types to include:
  * `trace` — basic execution trace
  * `vmTrace` — full VM execution trace
  * `stateDiff` — state changes

## Response

* `result` — trace result object:
  * `output` — return data from the transaction
  * `trace` — array of trace objects (if requested)
  * `vmTrace` — VM execution trace (if requested)
  * `stateDiff` — state differences (if requested)

## `trace_replayTransaction` code examples

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const replayTransaction = async (txHash) => {
      // Replay with all trace types
      const result = await provider.send("trace_replayTransaction", [
        txHash,
        ["trace", "stateDiff"]
      ]);

      console.log("Transaction Output:", result.output);
      console.log("Traces:", result.trace?.length || 0);

      if (result.trace) {
        for (const trace of result.trace) {
          const callType = trace.action.callType || trace.type;
          const to = trace.action.to || "Contract Creation";
          console.log(`  ${callType}: ${trace.action.from} -> ${to}`);
        }
      }

      if (result.stateDiff) {
        console.log("\nState changes:");
        for (const [address, diff] of Object.entries(result.stateDiff)) {
          console.log(`  ${address}:`);
          if (diff.balance) {
            console.log(`    Balance: ${diff.balance['*']?.from || 'new'} -> ${diff.balance['*']?.to || diff.balance['+']}`);
          }
        }
      }
    };

  replayTransaction("0xfc48f7c70e8ffaa46b1110dc43f32e90f65434a0949edab384d066c820c57ee2");
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3

  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3(Web3.HTTPProvider(node_url))

  result = web3.provider.make_request("trace_replayTransaction", [
      "0xfc48f7c70e8ffaa46b1110dc43f32e90f65434a0949edab384d066c820c57ee2",
      ["trace", "stateDiff"]
  ])

  trace_result = result['result']
  print(f"Transaction Output: {trace_result['output']}")
  print(f"Traces: {len(trace_result.get('trace', []))}")

  for trace in trace_result.get('trace', []):
      call_type = trace['action'].get('callType', trace['type'])
      to = trace['action'].get('to', 'Contract Creation')
      print(f"  {call_type}: {trace['action']['from']} -> {to}")

  if trace_result.get('stateDiff'):
      print("\nState changes:")
      for address, diff in trace_result['stateDiff'].items():
          print(f"  {address}")
  ```

  ```bash cURL theme={"system"}
  curl -X POST "CHAINSTACK_NODE_URL" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "trace_replayTransaction",
      "params": ["0xfc48f7c70e8ffaa46b1110dc43f32e90f65434a0949edab384d066c820c57ee2", ["trace", "stateDiff"]],
      "id": 1
    }'
  ```
</CodeGroup>


## OpenAPI

````yaml openapi/arc_node_api/debug_and_trace/trace_replayTransaction.json POST /
openapi: 3.0.0
info:
  title: Chainstack Node API
  version: 1.0.0
  description: This is an API for interacting with a Chainstack node.
servers:
  - url: https://arc-testnet.core.chainstack.com/6caa7fd90475ac9214f7521dd460fa7c
security: []
paths:
  /:
    post:
      tags:
        - upload
      summary: trace_replayTransaction
      operationId: trace_replayTransaction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: trace_replayTransaction
                params:
                  type: array
                  default:
                    - >-
                      0xfc48f7c70e8ffaa46b1110dc43f32e90f65434a0949edab384d066c820c57ee2
                    - - trace
      responses:
        '200':
          description: Returns the result of trace_replayTransaction.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: object
                    properties:
                      output:
                        type: string
                      stateDiff:
                        type: object
                        nullable: true
                      trace:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                            action:
                              type: object
                              properties:
                                from:
                                  type: string
                                callType:
                                  type: string
                                gas:
                                  type: string
                                input:
                                  type: string
                                to:
                                  type: string
                                value:
                                  type: string
                            error:
                              type: string
                            result:
                              type: object
                              properties:
                                gasUsed:
                                  type: string
                                output:
                                  type: string
                            subtraces:
                              type: integer
                            traceAddress:
                              type: array
                              items:
                                type: object
                      vmTrace:
                        type: object
                        nullable: true
              example:
                jsonrpc: '2.0'
                id: 1
                result:
                  output: >-
                    0x4e487b710000000000000000000000000000000000000000000000000000000000000012
                  stateDiff: null
                  trace:
                    - type: call
                      action:
                        from: '0x19d7cf8ea0ce468417d1eda365a222a9dcbc7d27'
                        callType: call
                        gas: '0x8d1c0'
                        input: >-
                          0xb61d27f60000000000000000000000001ff9c167b50d05910ffdadb82d3d2da4508330ca0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000040a617bee00000000000000000000000000000000000000000000000000000000
                        to: '0xd011948bd0d6d433d4ba6df9dc44eb9a2bfa555f'
                        value: '0x0'
                      error: Reverted
                      result:
                        gasUsed: '0x6f50'
                        output: >-
                          0x4e487b710000000000000000000000000000000000000000000000000000000000000012
                      subtraces: 1
                      traceAddress: []
                    - type: call
                      action:
                        from: '0xd011948bd0d6d433d4ba6df9dc44eb9a2bfa555f'
                        callType: delegatecall
                        gas: '0x89bee'
                        input: >-
                          0xb61d27f60000000000000000000000001ff9c167b50d05910ffdadb82d3d2da4508330ca0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000040a617bee00000000000000000000000000000000000000000000000000000000
                        to: '0xd206ac7fef53d83ed4563e770b28dba90d0d9ec8'
                        value: '0x0'
                      error: Reverted
                      result:
                        gasUsed: '0x5c52'
                        output: >-
                          0x4e487b710000000000000000000000000000000000000000000000000000000000000012
                      subtraces: 2
                      traceAddress:
                        - 0
                    - type: call
                      action:
                        from: '0xd011948bd0d6d433d4ba6df9dc44eb9a2bfa555f'
                        callType: staticcall
                        gas: '0x7530'
                        input: >-
                          0x01ffc9a701ffc9a700000000000000000000000000000000000000000000000000000000
                        to: '0x1ff9c167b50d05910ffdadb82d3d2da4508330ca'
                        value: '0x0'
                      result:
                        gasUsed: '0xf1'
                        output: 0x
                      subtraces: 0
                      traceAddress:
                        - 0
                        - 0
                    - type: call
                      action:
                        from: '0xd011948bd0d6d433d4ba6df9dc44eb9a2bfa555f'
                        callType: call
                        gas: '0x82a56'
                        input: '0x0a617bee'
                        to: '0x1ff9c167b50d05910ffdadb82d3d2da4508330ca'
                        value: '0x0'
                      error: Reverted
                      result:
                        gasUsed: '0xb84'
                        output: >-
                          0x4e487b710000000000000000000000000000000000000000000000000000000000000012
                      subtraces: 0
                      traceAddress:
                        - 0
                        - 1
                  vmTrace: null

````