Context
The Gas Price Forecaster was developed by Flexa as a proof of concept for organizations and developers within the blockchain ecosystem, particularly for those dealing with high transaction costs on Ethereum. With frequent fluctuations in gas prices, blockchain users faced unpredictability and inefficiencies that impacted transaction success rates and costs.
Challenge
Fluctuating Ethereum gas fees presented a critical problem for users and applications trying to optimize costs and performance. Without real-time visibility into future gas prices, transactions were frequently delayed or executed at higher fees. The lack of reliable forecasts resulted in significant cost inefficiencies.
Solution
Flexa's AI-powered forecasting System leveraged TensorFlow, Node.js, Infura and Web3.js to predict transaction costs 5 minutes into the future based on historical blockchain data.
Enabling Smarter Decisions Beyond Gas Prices
The success of this gas price forecaster demonstrates the potential for AI-driven prediction models to optimize costs and operations in blockchain and beyond. Its modular architecture can be extended to other pricing-sensitive domains like decentralized exchanges, staking platforms, and NFT marketplaces, helping users and businesses make informed, cost-effective decisions.
Key Components:
- Historical Indexer
Collecting and batching transaction data using Infura APIs - Data Processing Pipeline
Organizing and rebatching data for efficient machine learning input - Custom Machine Learning Model
Trained on Ethereum blockchain data with an adaptive learning rate and custom loss functions to prioritize movement direction accuracy - Developer-Friendly Deployment
A scalable, easy-to-use API was built using AWS services (S3 and Cloudfront CDN), providing real-time, read-only forecasts that developers and dApps can seamlessly integrate into their workflows for instant access to gas price predictions
Training Details
- Training Data
Ethereum blockchain data from Goerli testnet and mainnet - Data Augmentation
Historical block frames created at different time resolutions and prediction offsets - Randomization
Data frames were randomly ordered to prevent over-fitting seasonal patterns - Custom Loss Function
Prioritized directional prediction (up/down movement) over magnitude to optimize actionable decisions