What Is a Mempool?
KEY TAKEAWAYS: |
— A mempool is a blockchain node’s waiting room for queued and pending transactions. — There isn’t just one mempool for a blockchain, but many – one for each node on the network. — A transaction is only included in a block on the chain after it has been verified and approved in the mempool. |
If you’ve ever bought an NFT, exchanged crypto or simply sent funds from your wallet to another address, you may have experienced delays with your transaction. But have you ever considered where your transaction is during that delay?
Seeing your funds in a pending state can be stressful. You might be thinking, “Did it work?” or “Has my transaction failed? While the transaction is still pending, it goes to a specific place to await approval called a crypto mempool. But what is a mempool exactly, and how does it work?
For a simple definition, the term “mempool” is a contraction of the words “memory” and “pool”. However, when it comes to the mempool’s role in blockchain technology, it’s a bit more complex than that.
So let’s dive in.
What Is a Mempool?
A mempool is a blockchain node’s version of a waiting room for not-yet-approved transactions. Once you initiate it, your transaction automatically joins the queue in the mempool, before being processed on the blockchain.
What Is a Mempool For?
Mempools are an integral part of how a blockchain node functions. To explain, approving a blockchain transaction involves including it in a new block on the blockchain. However, not all participants in a network can create new blocks. For example, on proof-of-work blockchains like Bitcoin, only crypto miners can create blocks. Then on proof-of-stake blockchains like Ethereum, only validators can create blocks.
So, when you sign a transaction, you have to rely on either a miner or a validator to add it to a block and broadcast it to the network. However, there may be some time between you approving the transaction and its broadcasting to the network. In the meantime, the transaction needs a place to wait, and it does so in a place called the mempool.
How Does a Mempool Work?
It’s important to note that there isn’t just one mempool for each chain. In fact, there is a mempool in every node on each chain, and they each receive different transactions at different times. So, how does that work exactly?
Well, transactions in a mempool have two possible states, queued or pending. Queued transactions become pending transactions when the nodes validate them. Then miners can only add pending transactions to a block.
Imagine you decide to send 1 ETH to a friend. You input your friend’s wallet address, set the gas fee, and click on “Send”. At this point, your transaction enters your mempool as a “queued” transaction. From there, it is broadcast across the system of nodes. But it’s not added to the blockchain just yet.
Instead, each node runs checks to ensure the queued transaction is valid. If the nodes don’t find an issue, the transaction moves from a “queued” to a “pending” status. At some point, a miner or validator will pick up the pending transaction from their node’s mempool and add it to a new block. Next, your transaction is approved, and your friend receives that 1ETH. Then the rest of the nodes communicate with each other to remove the transaction from their mempools.
Why Is My Transaction Still in the Mempool?
There are a few key reasons your transaction could be stuck. So let’s explore what they may be.
Network Congestion
The biggest reason why transactions get stuck in the mempool is network congestion.
Remember how the miners and validators will eventually add a valid transaction to a block? Well, thousands of transactions are submitted at any given moment. So, how do they choose which transaction to process first?
Simply, miners and validators choose to process transactions with the highest rewards first. Thus, when the network is congested, fees spike as some participants are more willing to pay higher transaction fees so their transaction will be processed first. That means if you submit a transaction in a busy period, you must match the price others on the network are willing to pay.
In essence, it’s not dissimilar to how some countries’ taxi prices work. If it’s a busy Friday night, your taxi might be expensive and leave you waiting a long time. On a quiet afternoon, the same distance will be half the price and twice as fast. Well on the blockchain, that taxi driver is your miner or validator, and they get the power to accept the transactions they want the rewards for.
While that might make these block creators look greedy, the system is built like that. When the system is too busy, it will automatically prioritize transactions offering the biggest rewards. This means that transactions with too low a fee may get dropped, but don’t think that’s the end of the story. Even a transaction that’s pushed out of the mempool at one point may be picked up by a node and replayed at a later date.
You Set the Gas Fee Too Low
Another reason your transaction may be stuck in the mempool, is that you may have accidentally set the gas fee too low for a miner or validator to ever pick it up. If you offer something obscenely too low, the network will never be quiet enough to process your transaction. To learn more, make sure you read the full article on crypto gas fees.
The Hash Rate Drops
If you’re transacting on the Bitcoin network sometimes transactions get stuck because the hash rate drops. Put simply, in these situations the network doesn’t have the physical computing power to execute the number of pending transactions.
So now you have an idea why, let’s explore some of the solutions there are to the problem.
How Can I Release My Transaction from the Mempool
Releasing your transaction from the mempool can be tricky. You have a few options and it’s certainly not a one-size-fits-all operation. What you decide to choose will depend on how your transaction got stuck in the mempool in the first place.
There are three main options to choose from, but it’s important to note that their exact methods will vary from blockchain to blockchain.
Cancel The Transaction
You can cancel your transactions on blockchains. However, it will cost another transaction fee to do so. This is not possible directly through Ledger Live. So if you want to cancel an Ethereum transaction with your Ledger, make sure to read the Academy guide on how to connect your Ledger to a third-party wallet such as Metamask. Using this method, it’s as simple as hitting “cancel” on your wallet’s interface.
You can also cancel Ethereum transactions using a more advanced method. This involves sending a transaction with the same nonce. If you want to use this method, check out the Ledger support article on how to cancel a transaction using a nonce.
Speed The Transaction Up
You can also speed up transactions on both Ethereum and Bitcoin by connecting your Ledger to third-party wallets such as Metamask and Electrum respectively. However, it will cost you more of your cryptocurrency to do so.
Wait a Bit Longer
Your last option is to wait a little longer. If your gas fee wasn’t too low and the network is just congested, your transaction should eventually go through. In the worst-case scenario, you may have to wait a few days.
Final Thoughts on Mempools
So now you know all about mempools, and how they take part in processing transactions. You know they exist in every node in the network, and they are integral for a blockchain’s validation process. Plus, you even know what to do if your transaction gets stuck in the mempool!
While they aren’t often talked about, mempools provide a core function for blockchain networks; they act as a sort of halfway house for transactions still in processing. That’s why it’s so important to know how they function. How your transaction behaves in the mempool determines its future on the blockchain.
So, before you start transacting, you might want to check out the terms of the deal. It’s all too easy to set up a transaction you wish you didn’t. To avoid that, the best weapon is information. Understanding the transactions you sign is important when navigating the crypto space. Even crypto veterans can make mistakes, and once you send a transaction to the mempool, it’s not always possible to cancel it before someone processes it. If you accidentally buy an expensive NFT, or worse, agree to trade your assets for nothing—there’s no going back once it’s approved.
So, keep your wits about you! Only you have the power to control what you send to the mempool, and which of your transactions get picked up first. You have the agency over your crypto and your blockchain transactions—because that’s what true self-custody is all about.