eth_feehistory

Ethereum Classic RPC

Overview

The eth_feeHistory retrieves historical gas fee data, providing insights into gas price trends and block utilization over time. This method is valuable for estimating transaction fees and understanding network congestion.

Parameters

The eth_feeHistory method accepts two parameters:

  1. blockCount(number): The number of blocks to include in the history.
    • Example: "1024"
  2. newestBlock(string): The block number at which you want to retrieve the contract code. This can be specified as a hex string or one of the following special keywords:
    • "earliest": The first block in the blockchain
    • "latest": The most recent block in the blockchain
    • "pending": The upcoming block that is being mined
      • Example: "0x1" or "latest"
  3. rewardPercentiles(number[]): An array of percentiles to calculate effective priority fees over the requested blocks.
    • Example: [50, 75, 90, 95, 99]

Returns

The response from the eth_feeHistory method will be a JSON object containing the result, which is the historical gas fee data for the specified blocks. This data includes the base fee per gas, gas used ratio, and priority fees at the specified percentiles.

Request

curl --location 'https://api.tatum.io/v3/blockchain/node/ethereum-classic-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_feeHistory",
  "params":[
    1024,
    "latest",
    [
      10,
      20,
      30
    ]
  ]
}'
// yarn add @tatumio/tatum

import { TatumSDK, EthereumClassic, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<EthereumClassic>({ network: Network.ETHEREUM_CLASSIC })

const code = await tatum.rpc.FeeHistory({
  blockCount: '1234',
  newestBlock: 'latest',
  rewardPercentiles: [10, 20, 30],
})

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs