You may have heard the term “mempool” a lot recently, especially during the recent attacks on the Bitcoin network when the number of unconfirmed transactions rise a lot, fueling rumours of flippenings and collapses that never happen. There is a relation between unconfirmed transactions and the mempool, which we’ll look at next.
As you may have guessed, mempool is a portmanteau of memory pool. In this article we discuss where is this memory is located and why it is called a pool.
The memory it refers to is each full Bitcoin node’s RAM and disk storage. Remember, Bitcoin is a P2P network, similar to Bit Torrent. One person crafts a well formatted chunk of data called a transaction and they send it to the next guy they can reach on the network. When the Bitcoin Core client starts up, it tries to locate peers nearby. As this list of peers is built, the node is then able to send and receive transactions from the network.
There is a delay between the time this data is sent between peers and propagates on the network and the time when a mining pool or large scale solo miner will take that chunk of data and commit it to the permanent blockchain. During this period, the transaction is stored in the nodes’ memory (RAM or disk, doesn’t matter).
Since Bitcoin is a P2P network, all this memory and disk space adds up to terabytes of space, which is Bitcoin’s memory pool or, you guessed it, mempool. Every Bitcoin transaction is first sent to the mempool, it is mined later when the pools decide to include this transaction on the next block.
What if the Mempool fills up?
One of the attacks attempted on the Bitcoin network was to try to “fill” the mempool with useless transactions. Since transactions have to be mined to clear the mempool, if you are able to overwhelm the mining power with enough bogus transactions, then you can fill the mempool.
If the Bitcoin network runs out of space to temporarily store its transactions before they are mined, those transactions will be lost. It’s as if they were “forgotten” in a sea of transactions. In this case a miner will never see the transaction and the funds never will have moved. But the client which sent the transaction assumes it went through, showing a lower (and incorrect) balance than the user really has. Although no money is lost, because the transaction is never committed to the blockchain when a transaction goes missing, it does cause a lot of headaches and user complaints. Social networks flood with complaints and FUD about the end of Bitcon and how it “doesn’t work”.
Photo Credit: Blake Patterson by CC via Flickr