eth_feeHistory
JSON-RPC method returns historical gas fee data for a range of blocks. This method provides essential information for gas price estimation, including base fees, gas usage ratios, and priority fee percentiles.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
The method takes three parameters:- Block count - Number of blocks to retrieve fee history for
- Newest block - The newest block to include in the range
- Reward percentiles - Array of percentiles for priority fee rewards
Parameter details
blockCount
(string, required) — Number of blocks in the requested range as a hexadecimal string (maximum 1024)newestBlock
(string, required) — Block identifier:"latest"
,"earliest"
,"pending"
, or a specific block number in hexadecimalrewardPercentiles
(array, optional) — Array of percentile values (0-100) for priority fee rewards
Response
The method returns historical fee data for the specified block range.Response structure
Fee history object:oldestBlock
— The oldest block number in the range as a hexadecimal stringbaseFeePerGas
— Array of base fees per gas for each block (including one extra for the next block)gasUsedRatio
— Array of gas used ratios for each block (0.0 to 1.0)reward
— Array of priority fee rewards at specified percentiles for each block
Data interpretation
Base fee analysis:- Base fees adjust automatically based on network congestion
- Higher base fees indicate network congestion
- Use base fee trends for gas price prediction
- Base fee array includes one extra element for the next block
- Gas used ratio indicates block fullness (0.0 = empty, 1.0 = full)
- Higher ratios suggest network congestion
- Consistent high ratios may indicate sustained demand
- Use for capacity planning and congestion analysis
- On Hyperliquid, priority fees are currently always zero
- Percentile data will reflect this zero priority fee structure
- Transaction ordering is not based on priority fees
- Focus on base fee analysis for gas price optimization
Usage example
Basic implementation
Hyperliquid-specific considerations
Priority fees
Important limitation:- Priority fees are always zero on Hyperliquid
eth_maxPriorityFeePerGas
always returns zero- Transaction ordering is not based on priority fees
- Focus on base fee optimization for cost management
Fee optimization
Base fee analysis:- Monitor base fee trends for optimal transaction timing
- Use gas usage ratios to identify network congestion
- Plan batch operations during low base fee periods
- Implement base fee-based cost optimization strategies
Example request
Shell
Use cases
Theeth_feeHistory
method is essential for applications that need to:
- Gas price estimation: Calculate optimal gas prices for transactions
- Wallet applications: Provide users with fee estimation and recommendations
- DeFi protocols: Optimize transaction costs for automated operations
- Trading platforms: Minimize transaction costs for high-frequency operations
- Analytics platforms: Analyze network congestion and fee trends
- Cost optimization: Schedule transactions during low-fee periods
- Fee prediction: Build predictive models for future gas prices
- Network monitoring: Track network health and congestion patterns
- Arbitrage bots: Optimize transaction timing for profitability
- Portfolio management: Calculate transaction costs for portfolio operations
- Automated systems: Implement dynamic fee adjustment strategies
- Research tools: Study network economics and fee market dynamics
- Development tools: Test applications under various fee conditions
- Infrastructure services: Provide fee estimation APIs to other applications
- Compliance tools: Monitor transaction costs for regulatory reporting
- Risk management: Assess fee volatility risks for operations
- Educational platforms: Demonstrate gas market concepts and dynamics
- Optimization services: Provide fee optimization recommendations
- Monitoring systems: Alert on significant fee changes or anomalies
- Integration services: Connect fee data with external systems
- Planning tools: Plan transaction batches based on fee forecasts
- Cost accounting: Track and analyze transaction cost patterns
- Performance optimization: Optimize application performance based on fees
- User experience: Provide transparent fee information to users
- Economic analysis: Study the economic impact of fee structures
On Hyperliquid, priority fees are always zero (
eth_maxPriorityFeePerGas
always returns zero). Fee history data reflects past network conditions and may not predict future fees accurately during periods of high volatility. Focus on base fee analysis for gas price optimization.Body
application/json
JSON-RPC version
Available options:
2.0
The RPC method name
Available options:
eth_feeHistory
Parameters: [blockCount, newestBlock, rewardPercentiles]
Request identifier