Skip to main content
POST
/
eth_estimateGas
curl --request POST \
  --url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [
    {
      "to": "0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701",
      "data": "0x06fdde03"
    }
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
Monad API method that generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain.
Monad-specific behavior: Does not accept EIP-4844 (blob) transaction type, as EIP-4844 is not supported on Monad.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • object — the transaction call object:
    • from (optional) — address the transaction is sent from
    • to — address the transaction is directed to
    • gas (optional) — gas provided for the call
    • gasPrice (optional) — gas price for the call
    • value (optional) — value sent with the call
    • data (optional) — hash of the method signature and encoded parameters

Response

  • result — the estimated amount of gas needed for the transaction, encoded as hexadecimal.

eth_estimateGas code examples

const { ethers } = require("ethers");

const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");

async function estimateGas() {
  // Estimate gas for name() call on Wrapped Monad (WMON) contract
  const gasEstimate = await provider.estimateGas({
    to: "0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701",
    data: "0x06fdde03" // name()
  });
  console.log(`Estimated gas: ${gasEstimate.toString()}`);
}

estimateGas();

Use case

A practical use case for eth_estimateGas is providing accurate gas estimates to users before they confirm transactions, preventing failed transactions due to insufficient gas.

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_estimateGas
params
object[]

Response

200 - application/json

The estimated gas amount.

jsonrpc
string
id
integer
result
string