We're now supporting Polygon zkEVM!
Learn more here.

Contents

eth_feeHistory RPC Method

The API credit value for this method is 1 . To learn more about API credits and each method's value, visit the API Credits page.

Parameters:

  1. blockCount - string/integer - The number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. It will return less than the requested range if not all blocks are available
  2. newestBlock - string - The highest number block of the requested range in hexadecimal format or tags. The supported tag values include earliest for the earliest/genesis block, latest for the latest mined block, pending for the pending state/transactions, safe for the most recent secure block, and finalized for the most recent secure block accepted by more than 2/3 of validators. safe and finalized are only supported on Ethereum, Gnosis, Arbitrum, Arbitrum Nova, and Avalanche C-chain
  3. rewardPercentiles - integer - A list of percentile values with a monotonic increase in value. The transactions will be ranked by effective tip per gas for each block in the requested range, and the corresponding effective tip for the percentile will be calculated while taking gas consumption into consideration

Returns:

  1. oldestBlock - The lowest number block of the returned range encoded in hexadecimal format
  2. 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
  3. gasUsedRatio - An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit
  4. reward - (optional) An array of effective priority fees per gas data points from a single block. All zeroes are returned if the block is empty

Code Examples:

import requests
import json

url = "http://sample-endpoint-name.network.quiknode.pro/token-goes-here/"

payload = json.dumps({
  "method": "eth_feeHistory",
  "params": [
    4,
    "latest",
    [
      25,
      75
    ]
  ],
  "id": 1,
  "jsonrpc": "2.0"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
Ready to get started? Create a free account