Ethereum API
Multichain API
eth_feeHistory
Summary: Transaction fee history
Returns transaction base fee per gas and effective priority fee per gas for the requested/supported block range.
Parameters
blockCount string
hex encoded unsigned integer
Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
newestBlock oneOf
Block number or tag
rewardPercentiles array
requiredA 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.
Returns
Fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.
Fee history result object
requiredFee history results.
Customize request
Parameter
Value
Connect your MetaMask wallet to run requests successfully.
Request
await window.ethereum.request({
"method": "eth_feeHistory",
"params": [
"0x5",
"latest",
[
20,
30
]
],
});
Example response
{
"oldestblock": "0x10b52f",
"baseFeePerGas": [
"0x3fa63a3f",
"0x37f999ee",
"0x3e36f20a",
"0x4099f79a",
"0x430d532d",
"0x46fcd4a4"
],
"baseFeePerBlobGas": [
"0x7b7609c19",
"0x6dbe41789",
"0x7223341d4",
"0x6574a002c",
"0x7223341d4",
"0x6574a002c"
],
"gasUsedRatio": [
0.017712333333333333,
0.9458865666666667,
0.6534561,
0.6517375666666667,
0.7347769666666667
],
"blobGasUsedRatio": [
0,
0.6666666666666666,
0,
1,
0
],
"reward": [
[
"0x3b9aca00",
"0x59682f00"
],
[
"0x3a13012",
"0x3a13012"
],
[
"0x3a13012",
"0x3a13012"
],
[
"0xf4240",
"0xf4240"
],
[
"0xf4240",
"0xf4240"
]
]
}