# 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 parameters

### REQUEST

```bash
curl -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
```

#### EXAMPLE

```bash
## JSON-RPC over HTTPS POST
## Replace YOUR-API-KEY with an API key from your chainRPC Dashboard
## You can also replace mainnet with a different supported network
curl https://eth.chainrpc.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 chainRPC Dashboard
## You can also replace mainnet with a different supported network
wscat -c wss://eth.chainrpc.io/v3/YOUR-API-KEY
>{"jsonrpc":"2.0","method":"eth_feeHistory","params":["0x5", "latest", []],"id":1}
```

### RESPONSE

#### RESULT FIELDS

* `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.

#### BODY

```json
{
  "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"
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chainrpc.io/chainrpc/networks/ethereum/json-rpc-methods/eth_feehistory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
