eth_feeHistory - Polygon
Example code for the eth_feeHistory json-rpc method. Сomplete guide on how to use eth_feeHistory json-rpc in GetBlock.io Web3 documentation.
Parameters
Parameter
Type
Required
Description
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_feeHistory",
"params": ["0x4", "latest", [25, 50, 75]],
"id": "getblock.io"
}'import axios from 'axios';
const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';
const payload = {
jsonrpc: '2.0',
method: 'eth_feeHistory',
params: ["0x4", "latest", [25, 50, 75]],
id: 'getblock.io'
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"oldestBlock": "0x4e83784",
"reward": [
[
"0x1bf08eb000",
"0x1bf08eb000",
"0x246fc4ef80"
],
[
"0x1b72900c80",
"0x1bf08eb000",
"0x20aabe8bab"
],
[
"0x1bf08eb000",
"0x1bf08eb000",
"0x3a7b00d1e3"
],
[
"0x1bf08eb000",
"0x1bf08eb000",
"0x246d85ade0"
]
],
"baseFeePerGas": [
"0x768466dc41",
"0x75df7ac885",
"0x7538f45344",
"0x74e55fd206",
"0x74a85a9cf8"
],
"gasUsedRatio": [
0.4238737089435626,
0.4204278540940883,
0.5341368373683213,
0.5651741156509931
],
"baseFeePerBlobGas": [
"0x0",
"0x0",
"0x0",
"0x0",
"0x0"
],
"blobGasUsedRatio": [
0,
0,
0,
0
]
}
}Response Parameters
Parameter
Type
Description
Use Case
Error Handling
Status Code
Error Message
Cause
Web3 Integration
Last updated
Was this helpful?