Skip to main content
EVM

eth_feeHistory

Summary: Get transaction fee history

This request returns historical transaction base fee per gas and effective priority fee per gas for the filtered block range, allowing you to track trends over time.

Parameters

blockCount
string
required

Hexadecimal or decimal integer of the number of blocks for which historical fee data is required; up to maximum of 1024 blocks. Clients will return less than the requested range if not all blocks are available.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$


newestBlock
oneOf
required

Block number or string tag.

Block number
string

Block number in hexadecimal.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Block tag
enum

See the default block parameter.

  • earliest: The lowest numbered block the client has available.
  • finalized: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination.
  • latest: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions.
  • pending: A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool.

Enum:
"earliest"
"finalized"
"latest"
"pending"

rewardPercentiles
array
required

Pass empty array if this request is not required. An ordered array of integers of reward percentile values; from smallest to largest as floating point value between 0 and 100. For each block in the requested range, the transactions are sorted in ascending order by effective tip per gas and the corresponding effective tip for the percentile then determined, accounting for gas consumed.

number

Returns

eth_feeHistoryResponse
object
required

Fee history for the returned block range. If not all blocks are available, this will be a subsection of the requested range.

oldestBlock
string

Hexadecimal of the integer for the lowest number block of returned range.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

baseFeePerGas
array

An array of block base fees per gas. The extra value is the next block after the newest block in the returned range.

string

Hex-encoded unsigned integer.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

gasUsedRatio
array

An array of block gas used ratios. These are calculated as the ratio of gasUsed to gasLimit.

number

Normalized ratio.

reward
array

A two-dimensional array of effective priority fees per gas at the requested block percentiles. The first dimension of the array reflects the percentiles requested. The second reflects the number of blocks that percentile data is returned for.

array

An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty.

string

A given percentile sample of effective priority fees per gas from a single block in ascending order, weighted by gas used. Zeroes are returned if the block is empty.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Customize request
Parameter
Value
string
latest
oneOf
[ 20, 30 ]
array

Request

curl https://linea-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_feeHistory",
"params": ["0x5","latest",[20,30]],
"id": 1
}'

Example response

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"type": "object",
"schema": null,
"properties": {
"oldestBlock": "0x10b52f",
"baseFeePerGas": [
"0x1a4b2c9",
"0x16f3d2c",
"0x1b2d8a0",
"0x1d3e5f2",
"0x20c1234"
],
"gasUsedRatio": [
0.017712333333333333,
0.7458865666666668,
0.5534561,
0.5517375666666667,
0.6347769666666667
],
"reward": [
[
"0x737be7600",
"0x826299e00"
],
[
"0x773594000",
"0x861c46800"
],
[
"0x7aef40a00",
"0x89d5f3200"
],
[
"0x6fc23ac00",
"0x826299e00"
],
[
"0x737be7600",
"0x7aef40a00"
]
]
}
}
}