eth_gasPrice - Polygon
eth_gasPrice. Retrieve the current gas price
eth_gasPrice - polygon [Value: 15CU]
Helps in estimating the cost for transaction fees, ensuring efficient and accurate gas pricing for transactions on the network
Use cases
- Get the current gas price for transactions
- Calculate the cost of transactions with current gas prices
- Monitor network gas trends
Constraints
- Requires internet access
- Requires an accessible node to get data
- Depends on the latest network gas price data
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl --request POST \
--url https://polygon.drpc.org \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_gasPrice"
}
'
Response
200
{
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"oldestBlock": "0x130b1e6",
"reward": [
[
"0x5041e1e",
"0xdd221b80"
],
[
"0x5041e1e",
"0xb8346df0"
],
[
"0x55d4a80",
"0xb2d05e00"
],
[
"0x4dd9818",
"0x3b9aca00"
]
],
"baseFeePerGas": [
"0x52d80a82c",
"0x50f43f659",
"0x50012de8d",
"0x4e30357d6",
"0x57efff9e7"
],
"gasUsedRatio": [
0.40875283333333334,
0.45308523333333334,
0.4091907,
0.9987537
],
"baseFeePerBlobGas": [
"0x1",
"0x1",
"0x1",
"0x1",
"0x1"
],
"blobGasUsedRatio": [
0.5,
1,
0.6666666666666666,
1
]
}
}
Request params
idinteger
jsonrpcstring
methodstring
Response
200
Retrieves the current gas price in wei from the latest block.Response params
object
idinteger
jsonrpcstring
resultstring