Introducing Blocknative Gas Platform: A Fresh Take on Ethereum Gas Price Estimation
Every Ethereum transaction is impacted by the price of gas.
This fundamental building block has long been a source of anxiety for both new and experienced Ethereum users. Underpaying for gas leads to missed trades, stuck wallets, and more. While overpaying for gas erodes profitability.
And, as we have previously explored, the price of gas is driven by mempool competition.
To help builders and traders accurately price transaction fees, we are excited to release Blocknative Gas Platform. Originally soft-launched as part of the Gitcoin GR8 Hackathon, we have spent the past several months refining our gas price prediction model to achieve a new standard in Ethereum gas price estimation.
Gas Platform takes a precise, real-time approach to calculating Ethereum gas fees. By leveraging our real-time global mempool data platform, Gas Platform inspects all public pending Ethereum transactions and predicts the minimum gas price required for next-block confirmation.
Specifically, Gas Platform:
- Makes predictions based on block number, rather than time.
- Has an easy-to-integrate API that is fully documented and actively supported.
- Provides estimates at various confidence levels, giving you and your users precise control over your transaction fees.
- Uses an advanced machine learning model – that you can read more about below.
- Leverages our global node network for a comprehensive view of transaction activity
- Integrates with Mempool Explorer so you can quickly watch Gas Feeds in real-time – as long as you are logged in with your (free) Blocknative user account.
Gas Platform is a unique series of accurate, up-to-the-moment gas fee API endpoints – that together take the mystery out of getting your transactions on-chain with confidence.
The Challenge of Accurately Estimating Gas Price
Ethereum's Gas Price auction is a straightforward 'first-price' system. However, the nuances of how this auction is implemented introduce significant complexity - and seemingly randomness. These complexities include:
- Varying block sizes: The number of transactions that will be included in the next block is indeterminate. It can be evaluated by estimating the aggregate gas usage among the top-priced pending transactions. This determines how many of the currently pending transactions can be included in the next block without exceeding the block gas limit.
- Probabilistic block times: The Ethereum proof-of-work function is designed to require a random amount of time – bounded by the block difficulty and global miner hash power. Although average block time is approximately 13.5 seconds, any given block may take as little as one second or well over 30 seconds to create. During this time, many new transactions with higher gas prices can enter the mempool.
- Miner block templates: Ethereum miners are incentivized to include the highest gas price transactions in the current block. New – and possibly more profitable – transactions are constantly streaming into the mempool. In response, mining pools may create new block templates for their members to hash – perhaps as often as every second. And, because of the intentionally random nature of block hashing, there is no benefit to hashing a specific block template for five seconds versus hashing five different block templates for one second each.
- Propagation time: Because of the decentralized nature of the Ethereum network, new transactions and new blocks must propagate from node to node via the peer-to-peer protocol. This takes time. Hence, each node in the network has its own unique mempool, and a correspondingly unique view of current gas price.
- Past results do not correlate with future gas prices: The gas prices of transactions included in prior blocks – even the most recent block – have little bearing on the gas prices of pending transactions that may be included in the next block. Indeed, gas prices are generally volatile.
All of this complexity makes it difficult to accurately estimate what the minimum gas price will be for the next block.
Rethinking the Key Factors of Gas Price Estimation
Given these intrinsic challenges, we set about developing a quantitatively differentiated approach to Ethereum gas price estimation. We focused on several key factors, including:
- Blocks, not time: Since time has little meaning when considering block confirmation, we focus on block number prediction – specifically the next block.
- Accurately predicting minimum gas price: Prediction models must measure the validity of their results against the ground truth of confirmed blocks.
- Avoiding overspend: Confidence in predicting sufficient gas price to be included in the next block must be balanced against overspending. Our goal is to be as close as possible, but not below, the minimum gas price of the next block.
- User control: Since different users have different degrees of urgency for getting transactions into the next block, we were careful to provide a range of confidence levels for next block inclusion.
A New Approach: Quantile Regression Modeling
After running a number of experiments on our several terabyte historic mempool data archive, our data science team selected quantile regression modeling as the basis for our gas price prediction models. Given how quantile regressions handle noise from outlier measurements, this approach is well-suited for the task of accurately and consistently predicting the next block's minimum marketable gas price. [Note that our models ignore artificially low gas prices resulting from private, miner-injected transactions.]
Quantile regression allows precise risk management for traders. Specifically:
- A quantile regression model accepts a parameter, alpha, that specifies the quantile for which the model will make predictions.
- For example, if alpha = 0.50, the model will attempt to predict the median price. In this example, the model will predict above the true price 50% of the time and below the true price 50% of the time.
- And if alpha = 0.90, the model will attempt to predict the 90th percentile of the next minimum gas price. The model will thus be above the true price 90% of the time and below the true price 10% of the time.
- And so on. Gas Platform today offers confidence levels of 99%, 95%, 90%, 80%, and 70%. As we learn more, we may add or adjust these confidence levels.
By using quantile regression, Blocknative is able to achieve a probabilistic prediction of gas prices for the next block. This enables traders to transact with confidence on each and every trade. We plan to continually monitor and improve our gas price estimation models in response to customer feedback, real-world results, and relevant upgrades to the network such as EIP-1559.
By using quantile regression, Blocknative is able to achieve a probabilistic prediction of gas prices for the next block. This enables traders to transact with confidence on each and every trade.
Go Hands-on with Blocknative Gas Platform Today
Blocknative's Gas Platform is now available to all Ethereum builders and traders. Simply create a free Blocknative account to get started. You will then be able to access Gas Platform through Mempool Explorer or by integrating the API into your bot or Dapp. You can also watch our Gas Platform Quickstart for a short overview:
- Our team includes a number of active DeFi traders – all of whom have found Gas Platform an indispensable component of their trading strategies. You can connect with our team in the Blocknative Discord Community.
- Today, not all pending transactions are publicly broadcast to the Ethereum network. These 'dark pool' transactions occupy block space and can negatively impact the probability of other pending transactions successfully getting on-chain in a timely fashion. Our platform has long collected data describing such Miner Extractable Value. We may publish and/or productize this data in the future.