eth_feeHistory RPC Method
The eth_feeHistory
returns the historical gas fee statistics for a given block range.
Parameters
-
blockCount
- String or Integer - The number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. It will return less than the requested range if not all blocks are available. -
newestBlock
- String - The highest number block of the requested range or on og theTags
"latest", "earliest", "pending", "safe" or "finalized".
"Safe" and "finalized" are only availible on Ethereum and Arbitrum One chains. Read block parameter description (opens in a new tab).
rewardPercentiles
[optional] - Integer - A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used.
Returns
-
oldestBlock
- The lowest number block of the returned range encoded in hexadecimal format. -
baseFeePerGas
- An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks. -
gasUsedRatio
- An array of block gas used ratios. These are calculated as the ratio ofgasUsed
andgasLimit
. -
reward
[optional] - An array of effective priority fees per gas data points from a single block. All zeroes are returned if the block is empty.
Request
POST https://<network>.chainnodes.org/YOUR-API-KEY
Example
Confusing? Ask blockchain developers in Chainnodes Telegram Chat (opens in a new tab)
- 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
mainnet
curl https://mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_feeHistory","params": ["0x8", "earliest", [20,25]],"id":1}'
Body
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"oldestBlock": "0x0",
"reward": [
[
"0x0",
"0x0"
]
],
"baseFeePerGas": [
"0x0",
"0x0"
],
"gasUsedRatio": [
0
]
}
}
Need RPC API keys?
Get 12.5M archival requests for free today.