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

> The eth_estimateGas JSON-RPC method estimates the amount of gas required to execute a transaction without actually executing it on the blockchain.

<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_estimateGas` JSON-RPC method estimates the amount of gas required to execute a transaction without actually executing it on the blockchain. This method is essential for determining gas costs before sending transactions, helping users avoid failed transactions due to insufficient gas.

On Hyperliquid, gas estimation is performed against the latest block state only.

<Check>
  **Get your own node endpoint today**

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

The method takes one parameter: a transaction object containing the transaction details.

### Transaction object

* `from` (string, optional) — The address the transaction is sent from
* `to` (string, optional) — The address the transaction is directed to
* `gas` (string, optional) — Integer of the gas provided for the transaction execution
* `gasPrice` (string, optional) — Integer of the gasPrice used for each paid gas
* `value` (string, optional) — Integer of the value sent with this transaction
* `data` (string, optional) — The compiled code of a contract OR the hash of the invoked method signature and encoded parameters

## Response

The method returns the estimated gas amount as a hexadecimal string.

### Response structure

**Gas estimate:**

* `result` — The estimated gas amount as a hexadecimal string

### Gas estimation accuracy

**Estimation considerations:**

* Estimates are based on the latest block state only (Hyperliquid limitation)
* Actual gas usage may vary if state changes before execution
* Complex transactions may have less accurate estimates
* Include a buffer (10-20%) when using estimates for actual transactions

**Factors affecting accuracy:**

* Contract complexity and execution paths
* State changes between estimation and execution
* Gas price fluctuations and network congestion
* Dynamic contract behavior based on inputs

**Hyperliquid considerations:**

* Estimates are based on latest block state only
* Monitor actual vs estimated gas usage for optimization
* Implement fallback gas limits for critical transactions

## Example request

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

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

## Use cases

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

* **Transaction cost calculation**: Estimate gas costs before sending transactions
* **Wallet applications**: Display transaction fees to users before confirmation
* **DeFi protocols**: Calculate gas costs for complex multi-step transactions
* **Smart contract deployment**: Estimate deployment costs for contracts
* **Batch operations**: Plan gas usage for batch transactions and operations
* **Trading platforms**: Estimate gas costs for trading operations and swaps
* **NFT marketplaces**: Calculate minting and trading gas costs
* **Gaming applications**: Estimate gas for in-game transactions and operations
* **Automated systems**: Set appropriate gas limits for automated transactions
* **Cost optimization**: Compare gas costs across different transaction methods
* **User experience**: Prevent transaction failures due to insufficient gas
* **Analytics platforms**: Analyze gas usage patterns and optimization opportunities
* **Development tools**: Test and optimize smart contract gas efficiency
* **Portfolio management**: Calculate total transaction costs for portfolio operations
* **Cross-chain bridges**: Estimate gas costs for bridge operations
* **Governance systems**: Calculate voting and proposal submission costs
* **Staking platforms**: Estimate gas costs for staking and delegation operations
* **Lending protocols**: Calculate gas costs for lending and borrowing operations
* **Insurance platforms**: Estimate gas costs for claim processing and payouts
* **Supply chain**: Calculate gas costs for supply chain tracking operations
* **Identity systems**: Estimate gas costs for identity verification transactions
* **Subscription services**: Calculate gas costs for recurring payment operations
* **Audit tools**: Analyze gas usage for security and efficiency audits
* **Educational platforms**: Demonstrate gas concepts and optimization techniques
* **Research tools**: Study gas usage patterns and blockchain economics

This method provides essential gas estimation capabilities, enabling cost-effective and reliable transaction execution on the Hyperliquid EVM platform.

<Note>
  On Hyperliquid, `eth_estimateGas` only supports the latest block state. Gas estimates may not be accurate for complex transactions or when the blockchain state changes between the estimate and actual execution. Always include a reasonable buffer when using estimates for actual transactions.
</Note>


## OpenAPI

````yaml /openapi/hyperliquid_node_api/evm_eth_estimate_gas.json post /evm
openapi: 3.0.0
info:
  title: Hyperliquid EVM API - eth_estimateGas
  version: 1.0.0
servers:
  - url: >-
      https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274
security: []
paths:
  /evm:
    post:
      summary: eth_estimateGas
      description: >-
        Estimates the amount of gas required to execute a transaction without
        actually executing it on the blockchain. Only the latest block is
        supported on Hyperliquid.
      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_estimateGas
                  default: eth_estimateGas
                  description: The RPC method name
                params:
                  type: array
                  description: 'Parameters: [transaction object]'
                  default:
                    - from: '0xFC1286EeddF81d6955eDAd5C8D99B8Aa32F3D2AA'
                      to: '0x5555555555555555555555555555555555555555'
                      data: >-
                        0xa9059cbb000000000000000000000000fefefefefefefefefefefefefefefefefefefefe0000000000000000000000000000000000000000000000000de0b6b3a7640000
                id:
                  type: integer
                  default: 1
                  description: Request identifier
            example:
              jsonrpc: '2.0'
              method: eth_estimateGas
              params:
                - from: '0xFC1286EeddF81d6955eDAd5C8D99B8Aa32F3D2AA'
                  to: '0x5555555555555555555555555555555555555555'
                  data: >-
                    0xa9059cbb000000000000000000000000fefefefefefefefefefefefefefefefefefefefe0000000000000000000000000000000000000000000000000de0b6b3a7640000
              id: 1
      responses:
        '200':
          description: Successful response with the estimated gas amount
          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 estimated gas amount as a hexadecimal string
              example:
                jsonrpc: '2.0'
                id: 1
                result: '0x5208'

````