curl --request POST \
--url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_feeHistory",
"id": 1,
"params": [
1024,
"latest",
[
10,
20,
30
]
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {
"oldestBlock": "<string>",
"baseFeePerGas": [
"<string>"
],
"gasUsedRatio": [
123
],
"reward": [
[
"<string>"
]
]
}
}
curl --request POST \
--url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_feeHistory",
"id": 1,
"params": [
1024,
"latest",
[
10,
20,
30
]
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {
"oldestBlock": "<string>",
"baseFeePerGas": [
"<string>"
],
"gasUsedRatio": [
123
],
"reward": [
[
"<string>"
]
]
}
}
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.
blockCount
— the number of blocks to include in the history.newestBlock
— the newest block (by number or one of the strings "earliest"
, "latest"
, or "pending"
) to include in the history.rewardPercentiles
— an array of percentiles to calculate effective priority fees over the requested blocks.result
— an object containing:
oldestBlock
— the oldest block number in the history.baseFeePerGas
— an array of base fees per gas for each block.gasUsedRatio
— an array of ratios of gas used to gas limit for each block.reward
— an array of arrays containing the priority fees at the specified percentiles for each block.eth_feeHistory
method is essential for:
Historical gas fee data
The response is of type object
.
Was this page helpful?