Ethereum
Prêt à utiliser cela en production ?
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
Ethereum
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
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.
gasPrice field on a type-0 transaction for tooling or hardware wallets that still build pre-1559 transactions.eth_feeHistory percentiles to cross-check your estimator rather than trusting either source alone.Cette méthode ne prend aucun paramètre. Passez un tableau vide [].
| Type | Description |
|---|---|
| string (hex) | Hex-encoded gas price in wei (e.g. "0x4a817c800" = 20 gwei). |
Try it live in the Ethereum playground.
| Code | Message | Cause |
|---|---|---|
-32603 | Internal error | Node could not estimate current gas price. |
maxFeePerGas; reach for eth_maxPriorityFeePerGas and eth_feeHistory instead.