Estimates the amount of gas required to execute a transaction without actually executing it on the blockchain.
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.
from
(string, optional) — The address the transaction is sent fromto
(string, optional) — The address the transaction is directed togas
(string, optional) — Integer of the gas provided for the transaction executiongasPrice
(string, optional) — Integer of the gasPrice used for each paid gasvalue
(string, optional) — Integer of the value sent with this transactiondata
(string, optional) — The compiled code of a contract OR the hash of the invoked method signature and encoded parametersresult
— The estimated gas amount as a hexadecimal stringeth_estimateGas
method is essential for applications that need to:
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.Successful response with the estimated gas amount
The response is of type object
.