curl --request POST \
--url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": []
}
'{
"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_gasPrice",
"params": []
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}noneresult — the current gas price in wei, encoded as hexadecimal.eth_gasPrice code examplesconst { ethers } = require("ethers");
const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");
async function getGasPrice() {
const feeData = await provider.getFeeData();
console.log(`Gas price: ${ethers.formatUnits(feeData.gasPrice, "gwei")} gwei`);
}
getGasPrice();
eth_gasPrice is calculating transaction costs before sending transactions, allowing users to see estimated fees in their wallet or DApp interface.Was this page helpful?