> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# eth_feeHistory | Arc

> Arc API method that returns historical gas information for a range of blocks. Reference for eth_feeHistory on Arc via Chainstack.

Arc API method that returns historical gas information for a range of blocks. This is useful for estimating appropriate gas fees based on recent network activity.

## Parameters

* `blockCount` — number of blocks to return (hex or integer, max 1024)
* `newestBlock` — highest block number or tag (`latest`, `pending`)
* `rewardPercentiles` — (optional) array of percentiles to calculate priority fees

## Response

* `result` — the fee history object:
  * `baseFeePerGas` — array of base fees for each block (plus next block)
  * `gasUsedRatio` — array of gas used ratios for each block
  * `oldestBlock` — the oldest block number in the range
  * `reward` — (optional) array of priority fee percentiles for each block

## `eth_feeHistory` code examples

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const getFeeHistory = async () => {
      // Get fee history for last 10 blocks with 25th, 50th, 75th percentiles
      const feeHistory = await provider.send("eth_feeHistory", [
        "0xa",
        "latest",
        [25, 50, 75]
      ]);

      console.log(`Oldest block: ${parseInt(feeHistory.oldestBlock, 16)}`);
      console.log(`\nBase fees (gwei):`);

      for (let i = 0; i < feeHistory.baseFeePerGas.length; i++) {
        const baseFee = ethers.formatUnits(feeHistory.baseFeePerGas[i], "gwei");
        const gasRatio = feeHistory.gasUsedRatio[i] ? (feeHistory.gasUsedRatio[i] * 100).toFixed(2) : "N/A";
        console.log(`  Block +${i}: ${baseFee} gwei (${gasRatio}% full)`);
      }

      if (feeHistory.reward) {
        console.log(`\nPriority fee percentiles for latest block (gwei):`);
        const latest = feeHistory.reward[feeHistory.reward.length - 1];
        console.log(`  25th: ${ethers.formatUnits(latest[0], "gwei")}`);
        console.log(`  50th: ${ethers.formatUnits(latest[1], "gwei")}`);
        console.log(`  75th: ${ethers.formatUnits(latest[2], "gwei")}`);
      }
    };

  getFeeHistory();
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3

  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3(Web3.HTTPProvider(node_url))

  # Get fee history for last 10 blocks
  result = web3.provider.make_request("eth_feeHistory", [
      "0xa",
      "latest",
      [25, 50, 75]
  ])

  fee_history = result['result']
  oldest = int(fee_history['oldestBlock'], 16)
  print(f"Oldest block: {oldest}")

  print("\nBase fees (gwei):")
  for i, base_fee in enumerate(fee_history['baseFeePerGas']):
      base_fee_gwei = web3.from_wei(int(base_fee, 16), 'gwei')
      gas_ratio = fee_history['gasUsedRatio'][i] * 100 if i < len(fee_history['gasUsedRatio']) else 'N/A'
      print(f"  Block +{i}: {base_fee_gwei} gwei ({gas_ratio:.2f}% full)" if isinstance(gas_ratio, float) else f"  Block +{i}: {base_fee_gwei} gwei")

  if fee_history.get('reward'):
      print("\nPriority fee percentiles for latest block (gwei):")
      latest = fee_history['reward'][-1]
      print(f"  25th: {web3.from_wei(int(latest[0], 16), 'gwei')}")
      print(f"  50th: {web3.from_wei(int(latest[1], 16), 'gwei')}")
      print(f"  75th: {web3.from_wei(int(latest[2], 16), 'gwei')}")
  ```

  ```bash cURL theme={"system"}
  curl -X POST "CHAINSTACK_NODE_URL" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "eth_feeHistory",
      "params": ["0xa", "latest", [25, 50, 75]],
      "id": 1
    }'
  ```
</CodeGroup>


## OpenAPI

````yaml openapi/arc_node_api/gas_data/eth_feeHistory.json POST /
openapi: 3.0.0
info:
  title: Chainstack Node API
  version: 1.0.0
  description: This is an API for interacting with a Chainstack node.
servers:
  - url: https://arc-testnet.core.chainstack.com/6caa7fd90475ac9214f7521dd460fa7c
security: []
paths:
  /:
    post:
      tags:
        - upload
      summary: eth_feeHistory
      operationId: eth_feeHistory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: eth_feeHistory
                params:
                  type: array
                  default:
                    - '0x4'
                    - latest
                    - - 25
                      - 75
      responses:
        '200':
          description: Returns the result of eth_feeHistory.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: object
                    properties:
                      baseFeePerGas:
                        type: array
                        items:
                          type: string
                      gasUsedRatio:
                        type: array
                        items:
                          type: number
                      baseFeePerBlobGas:
                        type: array
                        items:
                          type: string
                      blobGasUsedRatio:
                        type: array
                        items:
                          type: number
                      oldestBlock:
                        type: string
                      reward:
                        type: array
                        items:
                          type: array
                          items:
                            type: string
              example:
                jsonrpc: '2.0'
                id: 1
                result:
                  baseFeePerGas:
                    - '0x4a817c800'
                    - '0x4a817c800'
                    - '0x4a817c800'
                    - '0x4a817c800'
                    - '0x4a817c800'
                  gasUsedRatio:
                    - 0.19888936666666668
                    - 0.019040333333333333
                    - 0.03178106666666667
                    - 0.20058356666666666
                  baseFeePerBlobGas:
                    - '0x1'
                    - '0x1'
                    - '0x1'
                    - '0x1'
                    - '0x1'
                  blobGasUsedRatio:
                    - 0
                    - 0
                    - 0
                    - 0
                  oldestBlock: '0x3480a5f'
                  reward:
                    - - '0x8f0d1800'
                      - '0xaba95000'
                    - - '0x8f0d1800'
                      - '0x19a147800'
                    - - '0x59682f00'
                      - '0x8f0d1800'
                    - - '0x8f0d1800'
                      - '0x32a9f8800'

````