What is a “mempool”?
By Alex Panasenko 2729 8 Aug 2022
When you inform the blockchain that you want to make a transaction, the validators must check its “legitimacy” and confirm it.
During the validation process, the funds are “hanging in the air”: they have already been deducted from your balance but have not yet transferred to the recipient’s balance. Where is the money, Billy? The place where transactions stay between sending and receiving is called a “mempool”. The word is an acronym for “Memory” and “Pool”. A mempool is often compared to a waiting room, although this does not quite convey its actual purpose and goals. Because of the memory pool, the bitcoin network operates without disruptions or “lunch breaks”, and the average time to form new blocks remains the same.
The size of the mempool varies depending on the level of network activity: when the transaction flow is significant, the pool overflows, forming a “queue” for validation. Correspondingly, when there are few transactions in the network, the mempool becomes empty. Based on the fullness of the mempool, the network can change parameters such as transaction confirmation time and the size of the commission.
If bitcoin transactions were old ladies and mempool was some bank, then the process of transactions promotion in mempool would remind a “live queue” at cash desks: you take place, and if you try to cut in line, someone calls you a junkie or a prostitute. But fortunately, bitcoin is a purely capitalist story, so transaction prioritization is used in this case.
It’s important to know that the maximum block size is limited and that transactions differ in weight. Therefore, the number of transactions in blocks can vary.
The prioritization of transactions for miners depends on their weight (volume) and the amount of commission offered. The volume of a particular transaction may not correspond to the remaining free space in the block, so a more appropriate one may be chosen. As for the fee, the node can raise the lower threshold of the required commission to solve the problem of high competition in the mempool.
Senders can offer the validator a higher reward for confirmation. And transactions with a low fee can be removed from the mempool, freeing up space in the queue for new transactions. As we can see, the principle of discounts on the wholesale market does not work here: the more transactions are performed in the network, the higher the network commission.
A mempool can also be compared to the principle of a check valve. For example, by having such a valve, a washer fluid sprays on your car’s windshield as soon as you press the steering wheel switch. Without the valve, you would have to pump the system repeatedly and for a long time to create enough pressure for the washer fluid to go from the tank to the nozzles.
The mempool allows the blockchain to grow at a programmed speed, despite variable parameters such as network activity and hash rate: transactions accumulate in temporary storage, and miners will always have something to do. And if there are too many miners, the algorithm will automatically increase the complexity of calculations, balancing out the large computational capacity.
However, the downside of this is limited network throughput and poor scalability. Attempts to solve this problem led to periodic forks (e.g., Bitcoin Cash) or the creation of special payment protocols (e.g., Bitcoin Lightning), where payment speed can be higher.