eth_feeHistory
Returns base fee per gas and transaction effective priority fee per gas history for the requested block range if available. The range between headBlock-4 and headBlock is guaranteed to be available while retrieving data from the pending block and older history are optional to support. For pre-EIP-1559 blocks, the gas prices are returned as rewards and zeroes are returned for the base fee per gas.
blockCount
and newestBlock
are both required parameterscurl -X POST --data '{ "id": 1337, "jsonrpc": "2.0", "method": "eth_feeHistory", "params": ["0x5", "latest", []] }' https://mainnet.infura.io/v3/YOUR-API-KEY
Content-Type: application/json
## JSON-RPC over HTTPS POST
## Replace YOUR-API-KEY with an API key from your Infura Dashboard
## You can also replace mainnet with a different supported network
curl https://mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"id": 1, "jsonrpc": "2.0", "method": "eth_feeHistory", "params": ["0x5", "latest", []] }'
## JSON-RPC over WSS
## Replace YOUR-API-KEY with an API key from your Infura Dashboard
## You can also replace mainnet with a different supported network
wscat -c wss://mainnet.infura.io/ws/v3/YOUR-API-KEY
>{"jsonrpc":"2.0","method":"eth_feeHistory","params":["0x5", "latest", []],"id":1}
oldestBlock
- Lowest number block of the returned range expressed as a hexidecimal number.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 of gasUsed and gasLimit.reward
- An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty.
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"baseFeePerGas": [
"0x92db30f56",
"0x9a47da3c5",
"0x8fb856b5b",
"0xa1a3c78d9",
"0x91a6775ac",
"0x7f71a86f7"
],
"gasUsedRatio": [
0.7022238670892842,
0.2261976964422899,
0.9987387,
0.10431753273738473,
0
],
"oldestBlock": "0xC72641"
}
}
Last modified 6mo ago