Skip to main content
POST
/
eth_gasPrice
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>"
}
Monad API method that returns the current gas price in wei. This value is determined by the network and represents the median gas price of recent blocks.
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

  • none

Response

  • result — the current gas price in wei, encoded as hexadecimal.

eth_gasPrice code examples

const { 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();

Use case

A practical use case for eth_gasPrice is calculating transaction costs before sending transactions, allowing users to see estimated fees in their wallet or DApp interface.

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_gasPrice
params
any[]

Response

200 - application/json

The current gas price in wei.

jsonrpc
string
id
integer
result
string