INTRODUCTION
A few days ago, I was poking around the internet looking for some new topic to write about. More specifically, I was looking for something I knew nothing about so my writing would be a learning experience. Well, I stumbled upon 'Mempools' and this topic fit what I was searching for. So, I now share what I've learned about Mempools with you.
WHAT ARE MEMPOOLS?
A mempool (from the contraction of the two words 'memory' and 'pool') is truly nothing more than a waiting room (holding area) for pending unconfirmed blockchain transactions within the chain's nodes. When a transaction passes verification by a node, the transaction is added to the nodes mempool until such time a miner adds the transaction to a block. Once verified and added to the mempool, the transaction is then broadcasted to the other nodes within the chain. If the transaction fails the verification, it does not enter the mempool, is not broadcasted to the other nodes, and is rejected.
But what happens when things in the blockchain get busy by way of the number of unconfirmed transactions? Once a mempool reaches it's capacity and hits the maximum of it's available RAM, a mechanism is in place to prevent the node from crashing. When this happens the mechanism available operates so as to prioritize the mempool transactions through the creation of a minimal fee threshold by which to process the mempool contents.
Under this scenario, unconfirmed transactions with fees set lower than the threshold are immediately removed from the mempool thereby freeing space. Plus, the mechanism only allows new transactions with set fees exceeding the threshold to be added to the mempool. With the passage of time, the number of pending transactions decreases and the node begins to reduce its fees threshold until it reaches its base threshold fee (minrelayfee).
When the block is full and a new block is received by the node, the mempool removes all transactions associated with the full block. This includes any transactions containing faulty inputs.
It is very interesting to note:
... there is no single mempool that is agreed upon by all nodes in a network. The Bitcoin protocol (and other cryptocurrencies) receive transaction requests at different times.
Remember, when you send a transaction out, it takes time to get propagated by the network. Meaning you send it to peers, then it gets passed along to other peers and so on. This is not done in a routine fashion, so different nodes have different transactions in their mempools at different times.
[BRD Blog. "What is a Mempool?!". (Accessed July 17, 2021).
WHY ARE MEMPOOLS IMPORTANT?
The Mempool is the “waiting room” of the Bitcoin network. The faster transactions are cleared from it and added into blocks on the Blockchain, the better experience users will get.
In other words, if new transactions arrive at a higher rate than they are cleared from the mempool into blocks, a “traffic jam” will occur and transactions can take a long time to get approved (depending on their size and attached fee).
When a node receives the latest mined block from the miner, it removes all the transactions contained in this block from its mempool. This results in a sharp drop in the Mempool size.
[Beigel, O. "The Bitcoin Mempool – A Beginner’s Explanation. (Accessed July 17, 2021).
The major take away from this is the relationship between the size of the mempool and the transaction fee associated therewith. The following graph shows this relationship:
As one would expect, there is a very high correlation between the size of the mempool and the value of transaction fees charged. So when the mempool is approaching capacity, fees to have transactions confirmed and added to the block will be higher. Users can snipe the mempool to time their transactions to incur lower fees.
The inherent purpose and importance of a mempool is to permit one node to access another node's mempool for the following uses:
- SPV clients(also known as lite wallets) wishing to obtain zero-confirmation transactions sent or received.
- Avoiding Miners opportunity to miss lucrative fee transactions or download the current “transaction waiting list” in order to start confirming transactions.
- Remote network diagnostics to several attacks like DDoS.
[Ccoingossip. ["What Is the Bitcoin Mempool? All Questions Answered". Accessed July 17, 2021)].
CONCLUSION
Bitcoin’s Mempool has proven to be an effective way to ensure that miners get paid fairly, and users are protected against DDoS attacks. This “holding pen” gives miners the added confidence to select the highest paying transactions. It also provides users with a way to expedite their transactions when needed. As Bitcoin continues to see more use globally, the Mempool will continue to play a pivotal role in the network’s effectiveness.
[Hamilton, D. "Understanding the Bitcoin Mempool and Why It’s So Important". (Accessed July 17, 2021)].