POSTeth_feeHistory

Returns gas fee history for the requested block range. Use this to set appropriate values for maxFeePerGas and maxPriorityFeePerGas when creating transactions.

Request Body
idintegerrequired
jsonrpcstringrequired
methodstringrequired
paramsoneOf[]required

Pass the following parameters as an array with the appropriate types.

  1. block count: Number of blocks to query (1-1024). Fewer blocks may be returned if not all are available.
  2. newest block: The reference block for the query. Block number as hex string or "latest".
  3. reward percentiles: Integer array for sampling priority fee percentiles. Percentiles are weighted by gas used per block. Values 0-100 in ascending order.
params[0]integer

The number of blocks to query. Enter an integer from 1 to 1024. Fewer blocks than requested may be returned if not all blocks are available.

params[1]string

Use one of block number or block tag to specify a block.

  • Block number: hex string (ex. "0x1")
  • Block tag: enum string (ex. "latest", "earliest", "pending")
    • earliest: The oldest available block on the chain.
    • finalized: A recently finalized block that can no longer be changed. Primarily used in proof-of-stake (PoS) blockchains.
    • safe: A recent block considered safe by the network (immune to reorgs).
    • latest: The most recent block on the chain (may be subject to reorgs).
    • pending: The next block to be mined, including pending transactions in the mempool.
params[2]integer[]

An array of percentile values used to sample priority fees. Percentiles are weighted by the gas used in each block. Enter integers from 0 to 100 in ascending order.

Responses
oldestBlockstring

Oldest block number in the returned range (hex)

rewardstring[][]

Array of priority fees at requested percentiles for each block (in wei, hex)

baseFeePerGasstring[]

Array of base fees per gas for each block (in wei, hex). Last element is the next block's expected value.

gasUsedRationumber[]

Array of gas utilization ratios per block (0 to 1)

X-API-KEY
RequestCU10
cURL
curl -X POST "https://arc-mainnet.nodit.io/" \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_feeHistory",
  "params": [
    2,
    "latest",
    [
      0,
      100
    ]
  ]
}'
Response
Example · 200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "oldestBlock": "0x1249315",
    "reward": [
      [
        "0x186a0",
        "0x61ac6361c"
      ],
      [
        "0x0",
        "0xae908e1c8"
      ]
    ],
    "baseFeePerGas": [
      "0x589753de4",
      "0x5634a5a38",
      "0x5a0918fd1"
    ],
    "gasUsedRatio": [
      0.392293,
      0.6777092333333333
    ]
  }
}