eth_feeHistory RPC Method
Parameters
blockCount
string/integer
REQUIRED
Loading...
newestBlock
string
REQUIRED
Loading...
rewardPercentiles
integer
REQUIRED
Loading...
Returns
oldestBlock
Loading...
baseFeePerGas
Loading...
gasUsedRatio
Loading...
reward
Loading...
Request
curl https://docs-demo.quiknode.pro/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_feeHistory","params":[4, "latest", [25, 75]],"id":1,"jsonrpc":"2.0"}'require 'eth'
client = Eth::Client.create 'https://docs-demo.quiknode.pro/'
payload = {
"jsonrpc": "2.0",
"method": "eth_feeHistory",
"params": [4, "latest", [25, 75]],
"id": "1"
}
response = client.send(payload.to_json)
puts responseimport { ethers } from "ethers";
(async () => {
const provider = new ethers.JsonRpcProvider("https://docs-demo.quiknode.pro/");
const response = await provider.send("eth_feeHistory", [4, "latest", [25, 75]]);
console.log(response);
})();
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"method": "eth_feeHistory",
"params": [
4,
"latest",
[
25, 75
]
],
"id": 1,
"jsonrpc": "2.0"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://docs-demo.quiknode.pro/", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));import requests
import json
url = "https://docs-demo.quiknode.pro/"
payload = json.dumps({
"method": "eth_feeHistory",
"params": [
4,
"latest",
[
25, 75
]
],
"id": 1,
"jsonrpc": "2.0"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "json"
require "net/http"
url = URI("https://docs-demo.quiknode.pro/")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"method": "eth_feeHistory",
"params": [
4,
"latest",
[
25, 75
]
],
"id": 1,
"jsonrpc": "2.0"
})
response = https.request(request)
puts response.read_body
from web3 import Web3, HTTPProvider
provider = Web3.HTTPProvider("https://docs-demo.quiknode.pro/")
result = provider.make_request('eth_feeHistory', [4, "latest", [25, 75]])
print(result)import { Core } from '@quicknode/sdk'
const core = new Core({
endpointUrl: "https://docs-demo.quiknode.pro/",
})
core.client
.getFeeHistory({
blockCount: 4,
rewardPercentiles: [25, 75]
})
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"oldestBlock": "0x1554ec2",
"reward": [
[
"0x4b571c0",
"0x2f23c46c"
],
[
"0x396c1b9",
"0x4d579d50"
],
[
"0x77359400",
"0x77359400"
],
[
"0x2faf080",
"0x3b9aca00"
]
],
"baseFeePerGas": [
"0x3af6c9f1",
"0x3b19496d",
"0x36647614",
"0x302c838b",
"0x359f85b3"
],
"gasUsedRatio": [
0.5091416944444445,
0.18145872222222223,
0.04269041059401201,
0.9524652037856148
],
"baseFeePerBlobGas": [
"0x320b8540d",
"0x384cf5f4e",
"0x3f5694c1f",
"0x44831ac79",
"0x3f5694c1f"
],
"blobGasUsedRatio": [
1,
1,
0.8333333333333334,
0.16666666666666666
]
}
}Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free