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

# eth_call | Hyperliquid EVM

> The eth_call JSON-RPC method executes a new message call immediately without creating a transaction on the 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 `eth_call` JSON-RPC method executes a new message call immediately without creating a transaction on the blockchain. This method is essential for reading data from smart contracts, calling view functions, and retrieving blockchain state without modifying it or paying gas fees.

## Parameters

The method takes two parameters and an optional third:

1. **Transaction call object** - Contains the call details
2. **Block parameter** - Specifies which block state to use
3. **State override** (optional) - Changes account state for this call only

### Transaction call object

* `to` (string, required) — The contract address to call
* `data` (string, optional) — The hash of the method signature and encoded parameters
* `from` (string, optional) — The address the call is made from
* `gas` (string, optional) — Gas limit for the call execution
* `gasPrice` (string, optional) — Gas price for the call
* `value` (string, optional) — Value sent with the call

### Block parameter

* Block identifier: `"latest"` (only the latest block is supported on Hyperliquid)

### State override (optional)

`eth_call` accepts an optional third parameter: a state override set that changes account state for this call only. Nothing is written to the chain. The set is an object keyed by account address, and each address can override:

* `balance` — the account balance in wei, hex-encoded
* `nonce` — the account nonce, hex-encoded
* `code` — the bytecode to run at the address
* `state` — storage slot values that replace the account's entire storage
* `stateDiff` — storage slot values to change, keeping the rest of the storage

This example puts bytecode that returns `42` at an unused address, then calls that address:

```bash theme={"system"}
curl --request POST \
  --url YOUR_CHAINSTACK_ENDPOINT/evm \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_call",
    "params": [
      { "to": "0x00000000000000000000000000000000c0ffee42", "data": "0x" },
      "latest",
      { "0x00000000000000000000000000000000c0ffee42": { "code": "0x602a60005260206000f3" } }
    ]
  }'
```

```json theme={"system"}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x000000000000000000000000000000000000000000000000000000000000002a"
}
```

## Response

The method returns the result of the contract call as a hexadecimal string.

### Response structure

**Call result:**

* `result` — The return value of the executed contract method as a hexadecimal string

### Data interpretation

**Return value format:**

* Results are returned as hexadecimal strings
* Decode according to the contract function's return type
* Use ABI decoding libraries for complex return types
* Simple values like uint256 can be converted directly from hex

**Common patterns:**

* `0x` prefix indicates hexadecimal format
* Leading zeros are included in the response
* Empty results return `0x`
* Failed calls may return error data

## Smart contract interaction

### Function calls

**Method signature encoding:**

* Function selector: First 4 bytes of keccak256 hash of function signature
* Parameters: ABI-encoded according to Ethereum standards
* Example: `totalSupply()` → `0x18160ddd`

**Parameter encoding:**

* Use ABI encoding for function parameters
* Combine function selector with encoded parameters
* Tools like web3.js, ethers.js handle encoding automatically

### Common use cases

**ERC-20 token calls:**

* `totalSupply()` → `0x18160ddd`
* `balanceOf(address)` → `0x70a08231` + encoded address
* `allowance(address,address)` → `0xdd62ed3e` + encoded addresses

**Contract state queries:**

* Read public variables and mappings
* Call view and pure functions
* Check contract configuration and parameters
* Validate contract state before transactions

## Development patterns

### Error handling

**Call failures:**

* Calls can fail due to reverts, out-of-gas, or invalid data
* Check for error responses and handle appropriately
* Use try-catch patterns for robust error handling
* Validate contract addresses and function signatures

**Gas considerations:**

* Specify gas limit to prevent out-of-gas errors
* Use reasonable gas limits for complex calls
* Monitor gas usage for optimization opportunities
* Consider gas costs for view function complexity

### Optimization strategies

**Batch calls:**

* Group multiple calls to reduce network overhead
* Use multicall contracts for efficient batch operations
* Cache results when appropriate to reduce API calls
* Implement intelligent caching based on latest state

**State consistency:**

* Only the latest block is supported on Hyperliquid
* All calls are made against the current blockchain state
* Handle potential state changes between calls
* Implement retry logic for temporary failures

## Example request

This an example call with wrapped HYPE (wHYPE) on the Hyperliquid mainnet deployed at [0x5555555555555555555555555555555555555555](https://hyperevmscan.io/token/0x5555555555555555555555555555555555555555).

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

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

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

  result = w3.eth.call({
      "to": "0x5555555555555555555555555555555555555555",
      "data": "0x18160ddd",
  }, "latest")

  print(result.hex())
  ```

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

  const provider = new JsonRpcProvider("YOUR_CHAINSTACK_ENDPOINT");

  const result = await provider.call({
    to: "0x5555555555555555555555555555555555555555",
    data: "0x18160ddd",
  });

  console.log(result);
  ```

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

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

  const result = await client.call({
    to: "0x5555555555555555555555555555555555555555",
    data: "0x18160ddd",
  });

  console.log(result.data);
  ```
</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 `eth_call` method is essential for applications that need to:

* **Smart contract interaction**: Read data from smart contracts without modifying state
* **Token information**: Query ERC-20/ERC-721 token balances, supplies, and metadata
* **DeFi protocols**: Interact with DeFi contracts to read prices, liquidity, and positions
* **Contract validation**: Validate contract state and parameters before transactions
* **Data aggregation**: Aggregate data from multiple contracts efficiently
* **Portfolio tracking**: Track user balances and positions across multiple contracts
* **Price oracles**: Read price data from oracle contracts and price feeds
* **Governance systems**: Query governance proposals, voting power, and delegation status
* **NFT platforms**: Read NFT metadata, ownership, and marketplace information
* **Gaming applications**: Query game state, player stats, and in-game assets
* **Analytics platforms**: Build analytics tools that read blockchain state data
* **Wallet applications**: Display user balances, allowances, and contract interactions
* **Trading interfaces**: Read market data, order books, and trading parameters
* **Lending protocols**: Query lending rates, collateral ratios, and liquidation data
* **Staking platforms**: Read staking rewards, validator information, and delegation data
* **Cross-chain bridges**: Verify bridge state and cross-chain transaction status
* **Audit tools**: Analyze contract state for security audits and compliance
* **Development tools**: Build debugging and testing tools for smart contract development
* **Monitoring systems**: Monitor contract state changes and trigger alerts
* **Integration services**: Integrate blockchain data with external systems and databases
* **Educational platforms**: Create educational tools that demonstrate blockchain concepts
* **Research tools**: Conduct blockchain research and analysis using contract data
* **Compliance tools**: Ensure regulatory compliance by monitoring contract interactions
* **Risk management**: Assess risks by analyzing contract state and parameters
* **Arbitrage bots**: Identify arbitrage opportunities by reading market data from contracts

This method provides fundamental smart contract interaction capabilities, enabling robust and efficient blockchain applications on the Hyperliquid EVM platform.

<Note>
  On Hyperliquid, `eth_call` only supports the latest block. Historical state queries are not supported in the default RPC implementation.
</Note>


## OpenAPI

````yaml openapi/hyperliquid_node_api/hyperevm/evm_eth_call.json post /evm
openapi: 3.0.0
info:
  title: Hyperliquid EVM API - eth_call
  version: 1.0.0
servers:
  - url: >-
      https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274
security: []
paths:
  /evm:
    post:
      summary: eth_call
      description: >-
        Executes a new message call immediately without creating a transaction
        on the blockchain. This method is used to call smart contract functions
        and retrieve data without modifying the blockchain state.
      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:
                    - eth_call
                  default: eth_call
                  description: The RPC method name
                params:
                  type: array
                  description: 'Parameters: [transaction object, block parameter]'
                  default:
                    - to: '0x5555555555555555555555555555555555555555'
                      data: '0x18160ddd'
                    - latest
                id:
                  type: integer
                  default: 1
                  description: Request identifier
            example:
              jsonrpc: '2.0'
              method: eth_call
              params:
                - to: '0x5555555555555555555555555555555555555555'
                  data: '0x18160ddd'
                - latest
              id: 1
      responses:
        '200':
          description: Successful response with the call result
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: JSON-RPC version
                  id:
                    type: integer
                    description: Request identifier
                  result:
                    type: string
                    description: >-
                      The return value of the executed contract method as a
                      hexadecimal string
              example:
                jsonrpc: '2.0'
                id: 1
                result: >-
                  0x0000000000000000000000000000000000000000000000000de0b6b3a7640000

````