Skip to main content

eth_feeHistory

Ethereum API

Returns transaction base fee per gas and effective priority fee per gas for the requested/supported block range.

Params

(3)

1. blockCount (required)

Requested range of blocks. Clients will return less than the requested range if not all blocks are available.

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

2. newestBlock (required)

Highest block of the requested range.

(one of)
string
Match pattern:
^0x([1-9a-f]+[0-9a-f]*|0)$

3. rewardPercentiles (required)

A monotonically increasing list of percentile values. For each block in the requested range, the transactions will be sorted in ascending order by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed.

array[number]

Result

(feeHistoryResult)

Fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.

Fee history results.

oldestBlock
string
required

Lowest number block of returned range.

Match pattern:
^0x([1-9a-f]+[0-9a-f]*|0)$
baseFeePerGas
array[string]
required

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.

gasUsedRatio
array[number]
required

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

reward
array[rewardPercentile]

A two-dimensional array of effective priority fees per gas at the requested block percentiles.

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.

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

Params

blockCount

newestBlock

rewardPercentiles


Request

await window.ethereum.request({
"method": "eth_feeHistory",
"params": [
null,
null,
null
]
});