{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_feeHistory",
  "params": ["0x5", "latest", [20, 70]]
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "oldestBlock": "0x1",
    "baseFeePerGas": [
      "0x3b9aca00",
      "0x3ba1f3e2",
      "0x3a6db1e6"
    ],
    "gasUsedRatio": [
      0.5265,
      0.4858,
      0.6124
    ],
    "reward": [
      [
        "0x3b9aca00",
        "0x3b9aca00"
      ],
      [
        "0x3ba1f3e2",
        "0x3b9aca00"
      ],
      [
        "0x3a6db1e6",
        "0x3b9aca00"
      ]
    ]
  }
}
Defined in EIP-1559
Returns a collection of historical gas information from which you can recompute gas costs and estimate future gas prices.

Parameters

blockCount
string
required
Number of blocks in the requested range, as a hexadecimal string.
newestBlock
string
required
Highest block number in the requested range (hexadecimal) or “latest”.
rewardPercentiles
array
required
Array of percentile values to sample from each block’s effective priority fees.

Returns

result
object
Fee history data object containing gas information.
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_feeHistory",
  "params": ["0x5", "latest", [20, 70]]
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "oldestBlock": "0x1",
    "baseFeePerGas": [
      "0x3b9aca00",
      "0x3ba1f3e2",
      "0x3a6db1e6"
    ],
    "gasUsedRatio": [
      0.5265,
      0.4858,
      0.6124
    ],
    "reward": [
      [
        "0x3b9aca00",
        "0x3b9aca00"
      ],
      [
        "0x3ba1f3e2",
        "0x3b9aca00"
      ],
      [
        "0x3a6db1e6",
        "0x3b9aca00"
      ]
    ]
  }
}

Error Handling

CodeMessageDescription
-32602Invalid paramsInvalid block count, block number, or percentiles
4100Requested method not supportedThe method is not supported by the wallet
This method is useful for implementing dynamic fee estimation algorithms and understanding network congestion patterns.