> ## 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_call | Hyperliquid EVM

> The trace_call JSON-RPC method executes a call and returns trace information using OpenEthereum-style tracing. 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 `trace_call` JSON-RPC method executes a call and returns trace information using OpenEthereum-style tracing. This method simulates a transaction and provides detailed execution traces without committing changes to the blockchain, making it ideal for transaction analysis, debugging, and testing before actual execution.

## Parameters

1. **Call object** (object, required): Transaction call details
2. **Trace types** (array, required): Array of trace types to include
3. **Block parameter** (string, required): Block number, hash, or "latest"/"earliest"/"pending"

### Call object structure

* `from` (string, optional): Address the transaction is sent from
* `to` (string, required): Address the transaction is directed to
* `gas` (string, optional): Gas provided for transaction execution
* `gasPrice` (string, optional): Gas price for the transaction
* `value` (string, optional): Value sent with the transaction
* `data` (string, optional): Hash of the method signature and encoded parameters

### Trace types

* `"trace"`: Basic execution trace information
* `"vmTrace"`: Virtual machine execution trace
* `"stateDiff"`: State differences caused by the transaction

## Response

The method returns an array of trace objects containing detailed execution information.

### Response structure

**Trace objects:**

* `action` — Details about the call action (from, to, value, gas, input, callType)
* `result` — Execution result (gasUsed, output)
* `traceAddress` — Address path within the call hierarchy
* `type` — Type of trace (call, create, suicide, etc.)

## Usage example

### Basic implementation

```javascript theme={"system"}
// Execute a traced call
const traceCall = async (callObject, traceTypes = ['trace'], blockParam = 'latest') => {
  const response = await fetch('https://hyperliquid-mainnet.core.chainstack.com/YOUR_ENDPOINT/evm', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jsonrpc: '2.0',
      method: 'trace_call',
      params: [callObject, traceTypes, blockParam],
      id: 1
    })
  });
  
  const data = await response.json();
  return data.result;
};

// Analyze contract interaction
const analyzeContractCall = async () => {
  const callObject = {
    from: '0x69835D480110e4919B7899f465aAB101e21c8A87',
    to: '0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5',
    gas: '0x76c0',
    gasPrice: '0x9184e72a000',
    value: '0xde0b6b3a7640000',
    data: '0x'
  };

  const traces = await traceCall(callObject);
  
  console.log('Execution Trace Analysis:');
  traces.forEach((trace, index) => {
    console.log(`Trace ${index + 1}:`);
    console.log(`  Type: ${trace.type}`);
    console.log(`  From: ${trace.action.from}`);
    console.log(`  To: ${trace.action.to}`);
    console.log(`  Gas Used: ${parseInt(trace.result.gasUsed, 16)}`);
    console.log(`  Call Type: ${trace.action.callType}`);
  });
  
  return traces;
};

// Usage
analyzeContractCall().then(traces => {
  console.log('Analysis completed');
});
```

## Example request

<CodeGroup>
  ```shell Shell theme={"system"}
  curl -X POST \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "trace_call",
      "params": [
        {
          "from": "0x69835D480110e4919B7899f465aAB101e21c8A87",
          "to": "0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5",
          "gas": "0x76c0",
          "gasPrice": "0x9184e72a000",
          "value": "0xde0b6b3a7640000",
          "data": "0x"
        },
        ["trace"],
        "latest"
      ],
      "id": 1
    }' \
    https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm
  ```

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

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

  call_object = {
      "from": "0x69835D480110e4919B7899f465aAB101e21c8A87",
      "to": "0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5",
      "gas": "0x76c0",
      "gasPrice": "0x9184e72a000",
      "value": "0xde0b6b3a7640000",
      "data": "0x",
  }

  # trace_call is OpenEthereum-style tracing, not a core eth_* method,
  # so call it through the provider's raw JSON-RPC interface.
  response = w3.provider.make_request(
      "trace_call", [call_object, ["trace"], "latest"]
  )
  print(response["result"])
  ```

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

  const provider = new JsonRpcProvider("YOUR_CHAINSTACK_ENDPOINT");

  const callObject = {
    from: "0x69835D480110e4919B7899f465aAB101e21c8A87",
    to: "0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5",
    gas: "0x76c0",
    gasPrice: "0x9184e72a000",
    value: "0xde0b6b3a7640000",
    data: "0x",
  };

  // trace_call is OpenEthereum-style tracing, not a core eth_* method,
  // so send it as a raw JSON-RPC request.
  const trace = await provider.send("trace_call", [callObject, ["trace"], "latest"]);
  console.log(trace);
  ```

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

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

  const callObject = {
    from: "0x69835D480110e4919B7899f465aAB101e21c8A87",
    to: "0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5",
    gas: "0x76c0",
    gasPrice: "0x9184e72a000",
    value: "0xde0b6b3a7640000",
    data: "0x",
  } as const;

  // trace_call is OpenEthereum-style tracing, not a core eth_* method,
  // so reach it through the client's low-level request method.
  const trace = await client.request({
    method: "trace_call" as any,
    params: [callObject, ["trace"], "latest"] 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>

## Use cases

The `trace_call` method is essential for applications that need to:

* **Transaction simulation**: Simulate transactions before execution to predict outcomes
* **Gas estimation**: Get accurate gas estimates for complex contract interactions
* **Debugging tools**: Debug smart contract execution and identify issues
* **Security analysis**: Analyze potential security vulnerabilities in contract calls
* **DeFi testing**: Test complex DeFi operations before execution
* **MEV analysis**: Analyze Maximum Extractable Value opportunities
* **Development workflows**: Integrate simulation into development pipelines
* **User interfaces**: Provide transaction previews in user applications
* **Risk assessment**: Assess risks before executing high-value transactions
* **Compliance checking**: Verify regulatory compliance before transaction execution
* **Educational tools**: Create educational content about transaction execution
* **Research platforms**: Support blockchain research and analysis
* **Performance optimization**: Optimize contract interactions for better efficiency
* **Integration testing**: Test smart contract integrations thoroughly
* **Protocol development**: Develop and test new blockchain protocols

This method provides comprehensive transaction simulation capabilities with detailed execution traces, enabling thorough analysis and testing on the Hyperliquid EVM platform.


## OpenAPI

````yaml openapi/hyperliquid_node_api/hyperevm/evm_trace_call.json post /evm
openapi: 3.0.0
info:
  title: Hyperliquid EVM API - trace_call
  version: 1.0.0
servers:
  - url: >-
      https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274
security: []
paths:
  /evm:
    post:
      summary: trace_call
      description: >-
        Executes a call and returns trace information using OpenEthereum-style
        tracing. This method simulates a transaction and provides detailed
        execution traces without committing changes to the blockchain.
      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:
                    - trace_call
                  default: trace_call
                  description: The RPC method name
                params:
                  type: array
                  description: >-
                    Parameters: [call object, trace types array, block
                    parameter]
                  default:
                    - from: '0x69835D480110e4919B7899f465aAB101e21c8A87'
                      to: '0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5'
                      gas: '0x76c0'
                      gasPrice: '0x9184e72a000'
                      value: '0xde0b6b3a7640000'
                      data: 0x
                    - - trace
                    - latest
                id:
                  type: integer
                  default: 1
                  description: Request identifier
            example:
              jsonrpc: '2.0'
              method: trace_call
              params:
                - from: '0x69835D480110e4919B7899f465aAB101e21c8A87'
                  to: '0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5'
                  gas: '0x76c0'
                  gasPrice: '0x9184e72a000'
                  value: '0xde0b6b3a7640000'
                  data: 0x
                - - trace
                - latest
              id: 1
      responses:
        '200':
          description: Successful response with trace data
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: JSON-RPC version
                  id:
                    type: integer
                    description: Request identifier
                  result:
                    type: array
                    description: Array of trace objects containing execution information
              example:
                jsonrpc: '2.0'
                id: 1
                result:
                  - action:
                      from: '0x69835D480110e4919B7899f465aAB101e21c8A87'
                      to: '0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5'
                      value: '0xde0b6b3a7640000'
                      gas: '0x76c0'
                      input: 0x
                      callType: call
                    result:
                      gasUsed: '0x5208'
                      output: 0x
                    traceAddress: []
                    type: call

````