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>"
}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>"
}object — the transaction call object:
from (optional) — address the transaction is sent fromto — address the transaction is directed togas (optional) — gas provided for the callgasPrice (optional) — gas price for the callvalue (optional) — value sent with the calldata (optional) — hash of the method signature and encoded parametersresult — the estimated amount of gas needed for the transaction, encoded as hexadecimal.eth_estimateGas code examplesconst { 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();
eth_estimateGas is providing accurate gas estimates to users before they confirm transactions, preventing failed transactions due to insufficient gas.Was this page helpful?