The mempool is often referenced as a waiting room for pre-chain transactions, but “waiting room” is too passive of a term. It suggests it’s a casual place for transactions to hang out while they wait to be confirmed on-chain. In reality, it’s more like a battle zone. Bots can force their way in to exploit arbitrage opportunities. Transactions can change out of sight, leaving you and your traders unprepared for battle.
Traders are your end-users, so you are building for them. The more attractive you can make your product, the more traders you will have transacting on your Dapp (decentralized application). To get ahead as a builder, you need to understand the conditions of transaction fees (gas) and replacement transactions—and the data for this required knowledge lives in the mempool.
Enter the mempool
Or should we say mempools? Complicating all of this is the fact that there is no single source of truth for the mempool. “The mempool” can be a misleading phrase to those new to smart contracts and the Ethereum ecosystem. There is not just one mempool; every node has its own version, so there are as many mempools as there are nodes.
Transactions enter the mempool with a competitive gas fee, which is attractive to miners so they will include it in a block. A low gas fee can result in extended wait times for on-chain confirmation, but there are other factors to be cognizant of that could leave a transaction hanging—or worse—stuck.
If the network becomes too crowded, gas prices can increase, rendering existing transactions uncompetitive. Transactions get priced out. Uncompetitive transactions get dropped by miner nodes. These dropped transactions can disappear from the mempool and are hard to keep track of without extensive engineering work and infrastructure.
When transactions get dropped, new transactions originating from that wallet address can result in a stuck transaction—due to a nonce gap. With a stuck transaction, a wallet can’t process other transactions until the nonce gap is resolved. For a trader, these scenarios create perplexing user experiences in Dapps. Traders, especially inexperienced ones, might expect updates from the UI about what is happening to their transactions. But without mempool data, your Dapp doesn’t know what is going on behind the scenes, leaving the trader oblivious to the circumstances.
Understanding the mempool and how to use the data to your advantage will be a boon to building DeFi or NFT Dapps that people want to use.
The very real variables in mempool “immutability”
The mempool is an open arena for transactions. The goal is to get a transaction confirmed both quickly and for the right price. You’ve built a Dapp to facilitate this process for traders, but what does it actually know about the arena?
The word “immutable” gets thrown around when speaking about blockchain technology, but it’s a word that should be used carefully. In truth, there are variables and actions that can change the course of a transaction. Everything in the mempool can be overwritten, and in this case, your Dapp is left in the dark.
Your Dapp will know about buying, pending, and confirmed transactions. Emphasis on the pending. While a transaction is in the mempool, traders can alter the process inside a wallet, which exists outside the knowledge of your Dapp, bypassing it completely.
Two ways a trader can alter transactions are:
In a Speed Up, a trader can attempt to overwrite a pending transaction with a new transaction. A trader has realized their gas fee is too uncompetitive. They enter an identical transaction with a higher gas fee to get it in a block faster than the original transaction.
In a Cancel Transaction, a trader can attempt to overwrite a pending transaction with a zero-dollar transaction. Similar to a Speed Up, they can enter a higher gas fee to get the Cancel Transaction in a block faster than the original transaction.
Both Speed Ups and Cancel Transactions create new hashes—this situation is outside the scope of your Dapp without the proper data from the mempool. When Speed Ups and Cancel Transactions are successful, they leave the incomplete original transactions hanging around in your UI with nowhere to go.
Navigating gas prices and transactions
High fees result in less profit. Low fees result in delays, failed transactions, and stuck web3 wallets. What does this mean for builders? Gas fees can eat into protocol margins and disincentivize users from transacting.
As a builder, you want to provide accurate gas price guidance so that your users have a positive experience. And by helping your users accurately set gas prices, you will avoid the UX headaches that we described above.
ETH gas prices are not just important for traders to understand, but they are equally important for builders to understand. Navigating gas fees can be difficult for traders and builders of all levels. By providing gas price information to traders, you can lessen their transaction anxiety and give them a competitive edge in the mempool marketplace. But finding that goldilocks solution between delays and missed profits is difficult.
After a transaction has entered the mempool, the gas price could fluctuate. If it does, gas fees on pending transactions become unattractive to miners looking to make the most profit. By providing accurate gas price guidance, you equip your users to trade with confidence.
Looking at the last confirmed block kind-of-sort-of gives you an estimation of reasonable current gas fees. But blocks have limited space for transaction records, which leads to congestion. If there is more demand for transactions than blockchain capacity, the last block is not a reliable source of information. The fluctuation in gas price between blocks could be considerable, and you could end up providing incorrect information to traders.
Current mempool data is a more reliable source of information. While this is more reliable, it’s also a lot more work, requiring serious engineering efforts. You will need to monitor the gas price distribution of the mempool in real-time.
Work with mempool data in real-time
If you are a builder, you have end-users. Some of them might be retail buyers (such as NFTs), while others might be more sophisticated DeFi traders running bots. Regardless, you have people on the other end who are interested in exploring and using your new creation. Building mempool data into your Dapp will make it a more attractive product to traders.
Monitoring the mempool doesn’t need to take up all your engineering efforts. Mempool Explorer is easy to integrate and provides real-time transaction event streams by looking at thousands of data points every second. For example, you can easily monitor top pairs on Uniswap or Honeyswap.
Gas Platform is an ETH gas fee API, accurately estimating Ethereum transaction fees based on what is currently in the mempool.
Master the Mempool today.
Blocknative's proven & powerful enterprise-grade infrastructure makes it easy for builders and traders to work with mempool data.Start for free