You probably noticed when a transaction is confirmed, it doesn’t send immediately: there is a slight delay. When a transaction is confirmed but not executed, it is in a mempool. And no, it has nothing to do with memes. The mempool is an invisible but crucial part of blockchain technology that manages transactions, ensuring that they are sent and confirmed on the network. In this article, we will get to know the mempool and understand how it works.
A mempool is a temporary repository for all unconfirmed transactions on a blockchain. It can also be referred to as a «waiting room» located on a blockchain node. This virtual storage contains transactions that have been confirmed but haven’t yet been processed. The term comes from the English words «memory» and «pool».
For example, when someone sends Bitcoins, the transaction first goes into the mempool. There, it waits for miners to accept it, incorporate it into a new block, and add it to the blockchain.
A mempool operates on the First-In-First-Out (FIFO) principle. Transactions that come early in the mempool have a higher priority for confirmation than those that come later. This means that miners tend to select transactions with higher fees to include in the next block.
Thus, if you want your transaction to be processed quickly, you can increase the commission rate.
It is worth clarifying that there can be multiple mempools in a single blockchain network. Each node in the network has its own digital space dedicated to storing transactions waiting to be validated and included in the blockchain. All of these blockchain mempools, scattered across different nodes, are combined into one common collective memepool.
Let's consider the principle of mempool operation in the example of one transaction:
Creating a transaction Let's imagine that Alice wants to send ethers to Steve. She creates a transaction, specifying the address of the recipient (Steve), and the amount she wants to send. Next, Alice pays a fee. After that, the transaction is sent to the blockchain network.
Getting into the mempool Alice's transaction first enters the mempool of one of the network's nodes. The transaction waits in this mempool for its turn to be processed.
Validation The network node that owns the mempool starts validating the transaction. It checks if there are enough funds in Alice's account for the transaction and makes sure that the transaction complies with the blockchain rules.
Waiting in the mempool After successful validation, the transaction goes to wait in the node's mempool. It is now ready to be included in the next block to be added to the blockchain.
Miner selection Miners select transactions from the mempool for inclusion in the new block. They usually choose transactions with higher fees as it is more profitable for them.
Inclusion in the block Alice's transaction is selected by the miner and included in a new block. This block is then added to the blockchain. Alice's transaction becomes visible to all members of the network.
Information dissemination Information about the new block and Alice's transaction is spread throughout the blockchain network.
Mempool overload can vary depending on the activity in the network. Network congestion occurs when an increase in the number of transactions causes a lack of space in the blocks, causing the mempool to overflow.
For example, the average number of transactions that can fit in one block of the Bitcoin blockchain is about 3,150. If the number of pending transactions significantly exceeds this number for several hours, it causes network overload.
The mempool is an integral part of blockchain infrastructure, managing the flow of transactions and ensuring their orderly processing. Understanding how it works and how fees affect its operation helps users make informed decisions when sending transactions.