> ## 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.

# ots_traceTransaction | Hyperliquid EVM

> The ots_traceTransaction JSON-RPC method returns the complete execution trace of a transaction on the Hyperliquid EVM blockchain. On Hyperliquid EVM.

<Info>
  This method is available on Chainstack. Not all Hyperliquid methods are available on Chainstack, as the open-source node implementation does not support them yet — see [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown.
</Info>

The `ots_traceTransaction` JSON-RPC method returns the complete execution trace of a transaction on the Hyperliquid EVM blockchain. This Otterscan-specific method extracts all variations of calls, contract creations, and self-destructs, presenting them as a detailed call tree that reveals the full execution flow.

## Parameters

1. **transaction hash** (string, required): The hash of the transaction to trace

## Response

The method returns an array of trace entries representing the complete execution tree, or null if the transaction doesn't exist.

### Response structure

Each trace entry contains:

* `type` — the type of operation (`CALL`, `CREATE`, `CREATE2`, `SELFDESTRUCT`)
* `depth` — the depth in the call stack
* `from` — the address initiating the operation
* `to` — the target address (for calls) or created contract address
* `value` — the amount of ETH transferred (in wei, hex)
* `input` — the input data for the operation
* `output` — the output data from the operation (optional)

## Usage example

<CodeGroup>
  ```shell Shell theme={"system"}
  curl -X POST https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "ots_traceTransaction",
      "params": ["0xf94f3d2ed5b59aefb6a0e566af8e86552014d84f6ed2f38a1366dedffe723381"],
      "id": 1
    }'
  ```

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

  w3 = Web3(Web3.HTTPProvider("YOUR_CHAINSTACK_ENDPOINT"))

  tx_hash = "0xf94f3d2ed5b59aefb6a0e566af8e86552014d84f6ed2f38a1366dedffe723381"

  # ots_traceTransaction has no typed helper in web3.py, so call it directly.
  trace = w3.manager.request_blocking("ots_traceTransaction", [tx_hash])
  print(trace)
  ```

  ```javascript ethers.js theme={"system"}
  import { JsonRpcProvider } from "ethers";

  const provider = new JsonRpcProvider("YOUR_CHAINSTACK_ENDPOINT");

  const txHash =
    "0xf94f3d2ed5b59aefb6a0e566af8e86552014d84f6ed2f38a1366dedffe723381";

  // ots_traceTransaction has no typed helper in ethers, so use the generic send.
  const trace = await provider.send("ots_traceTransaction", [txHash]);
  console.log(trace);
  ```

  ```typescript viem theme={"system"}
  import { createPublicClient, http } from "viem";

  const client = createPublicClient({
    transport: http("YOUR_CHAINSTACK_ENDPOINT"),
  });

  const txHash =
    "0xf94f3d2ed5b59aefb6a0e566af8e86552014d84f6ed2f38a1366dedffe723381";

  // ots_traceTransaction has no typed action in viem, so use the EIP-1193 request.
  const trace = await client.request({
    method: "ots_traceTransaction" as any,
    params: [txHash] as any,
  });
  console.log(trace);
  ```
</CodeGroup>

<Note>
  **Use your own endpoint in your code.** The code examples use a placeholder Chainstack endpoint (YOUR\_CHAINSTACK\_ENDPOINT) — replace it with your own Hyperliquid node endpoint from the [Chainstack console](https://console.chainstack.com/). The curl above uses a shared public endpoint for quick checks only; do not use it in production.
</Note>

### Example response

```json theme={"system"}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "type": "CALL",
      "depth": 0,
      "from": "0x1234567890abcdef1234567890abcdef12345678",
      "to": "0x5555555555555555555555555555555555555555",
      "value": "0x0",
      "input": "0xa9059cbb0000000000000000000000006666666666666666666666666666666666666666000000000000000000000000000000000000000000000000000000000000000a"
    },
    {
      "type": "CALL",
      "depth": 1,
      "from": "0x5555555555555555555555555555555555555555",
      "to": "0x7777777777777777777777777777777777777777",
      "value": "0x0",
      "input": "0x70a08231000000000000000000000000000000005555555555555555555555555555555555",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000064"
    }
  ]
}
```

### Trace types

* `CALL` — Regular function call to a contract
* `DELEGATECALL` — Delegate call preserving msg.sender
* `STATICCALL` — Read-only call that cannot modify state
* `CREATE` — Contract deployment using CREATE opcode
* `CREATE2` — Contract deployment using CREATE2 opcode
* `SELFDESTRUCT` — Contract self-destruction

## Use cases

The `ots_traceTransaction` method is essential for:

* **Transaction debugging**: Understand the complete execution flow of complex transactions
* **DeFi analysis**: Trace token swaps through multiple DEX routers
* **Security auditing**: Identify unexpected contract interactions
* **Gas optimization**: Find expensive operations in the call tree
* **MEV analysis**: Study arbitrage bot strategies and execution paths
* **Contract testing**: Verify expected call patterns in integration tests
* **Forensic investigation**: Analyze exploit transactions step by step
* **Performance profiling**: Identify bottlenecks in contract interactions
* **Educational tools**: Visualize how smart contracts interact
* **Block explorers**: Display detailed transaction execution trees

This method provides the most comprehensive view of transaction execution, making it invaluable for debugging complex smart contract interactions and understanding DeFi protocol operations.


## OpenAPI

````yaml openapi/hyperliquid_node_api/hyperevm/evm_ots_trace_transaction.json post /evm
openapi: 3.0.0
info:
  title: Hyperliquid EVM API - ots_traceTransaction
  version: 1.0.0
servers:
  - url: >-
      https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274
security: []
paths:
  /evm:
    post:
      summary: ots_traceTransaction
      description: >-
        Get a detailed execution trace of a transaction on Hyperliquid EVM.
        Provides comprehensive call stack and state changes.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - method
                - params
                - id
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  default: '2.0'
                  description: JSON-RPC version
                method:
                  type: string
                  enum:
                    - ots_traceTransaction
                  default: ots_traceTransaction
                  description: The RPC method name
                params:
                  type: array
                  description: 'Parameters: [transaction hash]'
                  default:
                    - >-
                      0xf94f3d2ed5b59aefb6a0e566af8e86552014d84f6ed2f38a1366dedffe723381
                id:
                  type: integer
                  default: 1
                  description: Request identifier
            example:
              jsonrpc: '2.0'
              method: ots_traceTransaction
              params:
                - >-
                  0xf94f3d2ed5b59aefb6a0e566af8e86552014d84f6ed2f38a1366dedffe723381
              id: 1
      responses:
        '200':
          description: Successful response with transaction trace
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: JSON-RPC version
                  id:
                    type: integer
                    description: Request identifier
                  result:
                    type: object
                    description: Transaction trace data
              example:
                jsonrpc: '2.0'
                id: 1
                result:
                  txHash: >-
                    0xf94f3d2ed5b59aefb6a0e566af8e86552014d84f6ed2f38a1366dedffe723381
                  calls: []

````