Skip to main content

eth_feeHistory

POST

Returns gas fee history for the requested block range. Use this to set appropriate values for maxFeePerGas and maxPriorityFeePerGas when creating transactions.
param[0]
blockCountintegerrequired
param[1]
blockNumberOrTagstringrequired
Use one of block number or block tag to specify a block.
  • Block number: hex string (ex. "0x1")
  • Block tag: enum string (ex. "latest", "earliest", "pending")
    • earliest: The oldest available block on the chain.
    • finalized: A recently finalized block that can no longer be changed. Primarily used in proof-of-stake (PoS) blockchains.
    • safe: A recent block considered safe by the network (immune to reorgs).
    • latest: The most recent block on the chain (may be subject to reorgs).
    • pending: The next block to be mined, including pending transactions in the mempool.
param[2]
rewardPercentilesarrayrequired
Responses
oldestBlockstring
Oldest block number in the returned range (hex)
rewardarray
Array of priority fees at requested percentiles for each block (in wei, hex)
baseFeePerGasarray
Array of base fees per gas for each block (in wei, hex). Last element is the next block's expected value.
gasUsedRatioarray
Array of gas utilization ratios per block (0 to 1)
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://bnb-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_feeHistory",
"params": [
2,
"latest",
[
0,
100
]
]
}'