API Reference

eth_feeHistory

Returns a collection of historical gas information

Returns a collection of historical gas information from which you can decide what to submit as your maxFeePerGas and/or maxPriorityFeePerGas. This method was introduced with EIP-1559.

PARAMETERS

Block Count - (required) The number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.

Newest Block - (required) The highest number block of the requested range.

Reward Percentiles - (optional) 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.

REQUEST

{
    "jsonrpc": "2.0",
    "method": "eth_feeHistory",
    "params": [
        4,
        "latest",
        [
            25,
            75
        ]
    ],
    "id": 1
}

RESPONSE

Result - An object with the following fields:

  • oldestBlock - The lowest number block of the returned range.
  • 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 - (optional) 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": {
        "oldestBlock": "0x2c",
        "reward": [
            [
                "0x4a146b436",
                "0x4a146b436"
            ],
            [
                "0x0",
                "0x0"
            ],
            [
                "0x4a1476ae6",
                "0x4a1476ae6"
            ],
            [
                "0x4a14ad6ba",
                "0x4a14ad6ba"
            ]
        ],
        "baseFeePerGas": [
            "0x2b36c1",
            "0x25d040",
            "0x211638",
            "0x1cf3b4",
            "0x195585"
        ],
        "gasUsedRatio": [
            0.00012211170840832373,
            0,
            0.00012232385167570408,
            0.000150315674779227
        ]
    }
}
Language
Click Try It! to start a request and see the response here!