🟪 Polygon
eth_gasPrice

Polygon API Documentation


eth_gasPrice RPC method

Returns

Gas price - Actual gas price in wei as an integer.

Parameters

None.

Request

POST https://<network>.chainnodes.org/YOUR-API-KEY

Example

Need RPC API keys?

Get 12.5M archival requests for free today.

  • HTTPS POST Request with a JSON RPC call in the body
  • Replace YOUR-API-KEY with the API key from your CHAINNODES.ORG Dashboard
  • You can use a different supported network by replacing polygon-mainnet
curl https://polygon-mainnet.chainnodes.org/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_gasPrice"","params":[],"id":1}'

Body

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x922e5f200"
}

Some use cases:

  1. Transaction Cost Estimation: Before sending a transaction, a user or a wallet can call eth_gasPrice to get an estimate of the current gas price. This can be used to estimate the transaction fee, which is the product of the gas price and the gas used by the transaction.
  2. Dynamic Fee Adjustment: DApp developers can use eth_gasPrice to dynamically adjust the transaction fees in their applications based on the current network conditions. This can help to make sure that transactions are processed fast, even when the network is congested.
  3. Gas Price Analysis: Data analysts and researchers can use eth_gasPrice to study the trends in gas prices on the Polygon or any other Ethereum network network. This can provide insights into network congestion, the economics of Ethereum, and the behavior of users and miners.

💡 Confusing?

Ask our experienced blockchain developers in Telegram

JSON-RPC API Documentation by CHAINNODES is based on Erigon node client. Contact us if you are interested in specific methods that are only available on geth, besu, Nethermind or reth