post https://api.infstones.com/ethereum/mainnet/
Returns a collection of historical gas information
Returns a collection of historical gas information 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. The older history are optional to support. For the blocks before EIP-1559, the gas prices are returned as rewards, and zeroes are returned for the base fee per gas.
Parameters
Key | Required | Type | Detail |
---|---|---|---|
BLOCK COUNT | ✅ | String | A hex code of an integer that represents the number of blocks in the requested range. |
NEWEST BLOCK | ✅ | String | A hex code of an integer that represents the highest block number of the requested range, or "latest" |
REWARD PERCENTILES | ❌ | Array | An increasing list of integers that represents the percentage values to sample from each block's effective priority fees per gas, weighted by gas used. |
"params": [ 5, "latest", [15, 25] ]
Result
An object containing base fee per gas and transaction effective priority fee per gas history.
Result Fields
Key | Type | Detail |
---|---|---|
baseFeePerGas | Array | An array of block base fees per gas. This includes the next block after the highest of the returned range, because this value can be derived from the highest block. Zeroes are returned for blocks before EIP-1559. |
gasUsedRatio | Array | An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit . |
oldestBlock | String | A hex code of integer that represents the lowest block number of the returned range. |
reward | Array | An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty. |
Example
Request
curl <your-endpoint> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_feeHistory","params":[5, "latest", [15, 25]],"id":1}'
Return
{
"jsonrpc":"2.0",
"id":1,
"result":{
"oldestBlock":"0xe8c8ec",
"reward":[
[
"0x3b9aca00",
"0x3b9aca00"
],
[
"0x3b9aca00",
"0x3b9aca00"
],
[
"0x6fe2625b",
"0x6fe2625b"
],
[
"0x2271ccfd",
"0x4190aee9"
],
[
"0x59682f00",
"0x59682f00"
]
],
"baseFeePerGas":[
"0x398f9e68c",
"0x356257d56",
"0x3444684e2",
"0x3acb19896",
"0x3fe7fc09e",
"0x396a62253"
],
"gasUsedRatio":[
0.20974393333333333,
0.4163095333333333,
0.9994443425994516,
0.8478509333333333,
0.09374016666666667
]
}
}