eth_feeHistory

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

KeyRequiredTypeDetail
BLOCK COUNTStringA hex code of an integer that represents the number of blocks in the requested range.
NEWEST BLOCKStringA hex code of an integer that represents the highest block number of the requested range, or "latest"
REWARD PERCENTILESArrayAn 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

KeyTypeDetail
baseFeePerGasArrayAn 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.
gasUsedRatioArrayAn array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.
oldestBlockStringA hex code of integer that represents the lowest block number of the returned range.
rewardArrayAn 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
        ]
    }
}
Language
Click Try It! to start a request and see the response here!