What is the mempool?
Unconfirmed transactions sit in the mempool before miners bundle them into blocks. Learn more about what the mempool is and how it works!
The Bitcoin rabbit hole gets deeper, more cavernous, and more complex the further down you go. Today, we're going to look at a crucial term foundational to Bitcoin that even many veterans still don't fully understand: the mempool.
The mempool (a portmanteau of memory and pool) is where unconfirmed transactions sit before miners bundle them into blocks. Think of the mempool like a holding tank: it temporarily stores transactions that have not yet been confirmed.
Before we dive in, let's do a quick refresher on Bitcoin mining.
Since the mempool sits at the core of Bitcoin's mining process, it's essential to review how mining works before we go any further.
In straightforward terms, Bitcoin mining validates transactions and secures the network, rewarding miners for their hard work. Here's a simplified step-by-step as it relates to the mempool.
- Alice sends 0.01 bitcoin to Bob.
- Bitcoin network nodes will relay Alice's transaction throughout the network, called broadcasting.
- Nodes on the network will check that the transaction is valid according to Bitcoin's rules (Alice has the necessary funds, Bob's wallet address is correctly formatted, etc.).
- If the transactions check out, nodes will *"*propagate" or send the transaction to their neighbors: other nodes on the network. Propagation is a signaling mechanism that says, "Hey, I have a new transaction for you — and it's legit."
- If the transaction isn't legit, it will be dropped and never make it into the mempool. But if it is, the transaction will sit in the mempool until a miner picks it up and bundles it into a block.
If you want to read more check out our article about Bitcoin Mining.
Where Transaction Fees Come Into Play
The mempool is often backlogged with thousands to tens of thousands of transactions waiting to be confirmed. So how does a miner choose which transactions to include in the next block?
While miners make the majority of their revenue from the block reward, they also collect small transaction fees from the transactions included in blocks. Depending on network conditions, transaction fees can account for up to 20 percent of total revenue.
When miners construct blocks, they first include the transactions with the highest fees. The reasoning is simple: higher fees mean more revenue for miners, so they're more incentivized to include those transactions. Miners may still include transactions with lower fees in blocks, but they'll take longer because they'll need to compete with other low-fee transactions for a spot.
Price gouging doesn't come into play here because miners have an incentive to accept as many transactions as possible to maximize revenue. If a miner only included high-fee transactions, it would leave money on the table. Transaction fees fluctuate based on network conditions, and the market creates an equilibrium where miners can optimize revenue by including a mix of high and low-fee transactions.
What's the Point of the Mempool?
The mempool's primary purpose is to ensure unconfirmed transactions are valid according to Bitcoin's rules. But the mempool also serves a secondary purpose: it prevents network congestion and spam. Here's how.
If there were no mempool and nodes broadcasted transactions to their neighbors, the network would quickly become bogged down by an influx of low-fee or zero-fee transactions. This is because it's free to create a bitcoin transaction — you only need an internet connection. The mempool provides a buffer against low-fee or zero-fee transactions, allowing the network to function smoothly even when there's a surge in activity.
With no mempool, an attacker could also spam the network with bogus transactions to overload it. This would make it difficult or even impossible for legitimate users to send transactions, discouraging them from using the network.
Picture this scenario — say Damien wanted to spam the Bitcoin network and prevent other transactions from going through. He could do this by creating a bunch of zero-fee transactions and flooding the network with them. Since there's no mempool, miners would have to process Damien's transactions along with everyone else's. This would slow down the network and make it difficult for legitimate users to send transactions. You could effectively bring the entire network to a standstill.
The mempool helps prevent this attack by weeding out most zero-fee transactions and keeping the network running smoothly. In addition, it provides a barrier against spam and allows the network to function as intended.
- The mempool is a pool of unconfirmed transactions.
- People send transactions to the mempool, where they wait to be picked up by miners and included in blocks.
- Miners choose which transactions to include in blocks based on transaction fees — the transactions with the highest fees are included first.
- A transaction fee market equilibrium is reached because miners can optimize revenue by including a mix of high and low-fee transactions.
- The mempool helps prevent network congestion and spam by filtering out most zero-fee transactions, illegitimate transactions, and duplicate transactions.