> For the complete documentation index, see [llms.txt](https://sodex.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sodex.com/documentation/for-developers/api-reference/json-rpc/eth-feehistory.md).

# eth\_feeHistory

POST `https://mainnet.valuechain.xyz`

Returns historical gas fee data for a range of recent blocks.

## Parameters

| Name                | Type            | Required | Description                                                                                                                                                                                                                    |
| ------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `blockCount`        | quantity        | Yes      | Number of blocks in the requested range.                                                                                                                                                                                       |
| `newestBlock`       | quantity or tag | Yes      | Highest block in the range: hex number, or `earliest`, `latest`, `safe`, `finalized`, or `pending`. See [block tags](/documentation/for-developers/developers/valuechain-evm/differences-from-ethereum.md#consensus-finality). |
| `rewardPercentiles` | number\[]       | No       | Priority-fee percentiles to include in `reward`.                                                                                                                                                                               |

## Result

**Fee history** (object): `oldestBlock`, `baseFeePerGas`, `gasUsedRatio`, and optional `reward`.

## Example

### Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "oldestBlock": "0xd81ea3",
    "baseFeePerGas": [
      "0xf4240",
      "0xf4240",
      "0xf4240",
      "0xf4240",
      "0xf4240"
    ],
    "gasUsedRatio": [
      0.007345866666666667,
      0.0007,
      0.0007,
      0.0007
    ],
    "reward": [
      [
        "0x7a1200",
        "0x7a1200"
      ],
      [
        "0xf4240",
        "0xf4240"
      ],
      [
        "0xf4240",
        "0xf4240"
      ],
      [
        "0xf4240",
        "0xf4240"
      ]
    ]
  }
}
```

## Code examples

### cURL

```bash
curl --request POST \
  --url https://mainnet.valuechain.xyz \
  --header 'Content-Type: application/json' \
  --data '{"jsonrpc": "2.0", "id": 1, "method": "eth_feeHistory", "params": ["0x4", "latest", [25, 75]]}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({"jsonrpc": "2.0", "id": 1, "method": "eth_feeHistory", "params": ["0x4", "latest", [25, 75]]})
};

fetch('https://mainnet.valuechain.xyz', options)
  .then((res) => res.json())
  .then((res) => console.log(res))
  .catch((err) => console.error(err));
```

### Python

```python
import requests

url = "https://mainnet.valuechain.xyz"
payload = {
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_feeHistory",
  "params": [
    "0x4",
    "latest",
    [
      25,
      75
    ]
  ]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
```
