The mempool (‘memory pool’) is the ‘waiting room’ for Bitcoin transactions: how it works and why it matters.
The mempool plays a crucial role in the functioning of Bitcoin: it serves as the waiting room for transactions before they are included in the blocks of the blockchain by miners.
Broadcast of a transaction
Once a transaction is signed, it is sent from the sender’s node to neighboring nodes (peers). These nodes, in turn, share it with their own peers, and so on until the transaction reaches all nodes on the network. This process is known as the gossip protocol and is the method by which all transactions and blocks are broadcasted throughout the Bitcoin network.
Since each block has limited capacity and cannot accommodate all transactions simultaneously, they are collected by each node in its own mempool. Essentially, the mempool is the limbo of Bitcoin transactions: the place where each node inserts verified transactions before they are added to a block in the blockchain. Only at that point can a transaction be considered confirmed.
Every mempool, by default, has a maximum limit of 300 MB, which can be customized by the node operator. Therefore, it is common to find Bitcoin nodes on the network with a mempool exceeding 1 GB.
Mempool and fees
It is important to emphasize that not all transactions sent to the mempool are necessarily included in a blockchain block.
Each miner can establish its own policies regarding which transactions to include in the blocks they are attempting to mine. Some mining pools, for example, may impose limits on transaction sizes, while others might prioritize transactions from specific network users. Alternatively, miners may set minimum fees for transactions to be included in blocks, affecting the speed of transaction confirmations.
Miners are incentivized to select transactions with higher fees, measured in terms of satoshis per vByte. The higher the fees, the more likely it is that the transaction will be confirmed quickly. During periods of high transaction volume, the fee required for confirming a transaction may be higher, as each block has limited space, and many transactions compete for a spot in a block.
Ways to speed up a transaction stuck in the mempool
- Use Replace By Fee (RBF): Some wallets allow the replacement of an existing transaction with a new one with a higher fee. When the replacement transaction is sent to nodes, they replace the old transaction with the new one and broadcast it to their peers;
- Use Child Pays For Parent (CPFP): CPFP involves creating a new transaction with a higher fee, compelling the approval of a previous transaction stuck in the mempool. The purpose of CPFP is to incentivize miners to quickly approve both transactions.