Ethereum
eth_gasPrice
eth_gasPrice gives you the node's single suggested price per unit of gas, in wei of ETH, for Ethereum mainnet. It predates EIP-1559: on London-and-later Ethereum the node derives this figure from the current base fee plus a typical tip and collapses it into one number, the way a legacy type-0 transaction expects. It's a fast, no-parameter read of "what's gas roughly costing right now." Hit https://ethereum.therpc.io/YOUR_API_KEY (chain ID 1) and you get back something like 0x4a817c800 — 20 gwei. For modern type-2 transactions you'll usually want the richer eth_feeHistory data instead, but this remains the quickest pulse-check.
Use cases
- Quick fee pulse. One CU, no params — a fast read to see whether Ethereum gas is sitting at a few gwei or spiking into the hundreds before you decide to transact.
- Legacy transactions. Fill the
gasPricefield on a type-0 transaction for tooling or hardware wallets that still build pre-1559 transactions. - One input to a fee oracle. Blend this single value with
eth_feeHistorypercentiles to cross-check your estimator rather than trusting either source alone.
Parameters
This method takes no parameters. Pass an empty array [].
Response
| Type | Description |
|---|---|
| string (hex) | Hex-encoded gas price in wei (e.g. "0x4a817c800" = 20 gwei). |
Example request
Try it live in the Ethereum playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32603 | Internal error | Node could not estimate current gas price. |
Common pitfalls
- On post-London Ethereum this is a synthesized number (base fee plus an assumed tip) and tends to run high. For a type-2 transaction you'll overpay if you copy it into
maxFeePerGas; reach foreth_maxPriorityFeePerGasandeth_feeHistoryinstead. - The value is wei. To show "20 gwei" divide by 1e9; to show an ETH cost divide by 1e18. Skipping the conversion and printing the raw wei integer is a common UI bug.
Supported networks
- Mainnet — Chain ID: 1
- Sepolia — Chain ID: 11155111