What Is a Mempool?
A mempool, short for “memory pool,” is a crucial component of a cryptocurrency node.
It serves as a storage mechanism for information on unconfirmed transactions, functioning as a waiting room for transactions that have not yet been included in a block.
When a user submits a transaction, it needs to be relayed to other nodes in the network until it has propagated across the entire network.
Each node maintains its own mempool, a collection of all the unconfirmed transactions it has encountered. This allows the node to determine whether or not to relay a new transaction.
Transaction Storage and Validation
Since not all nodes receive the same transactions simultaneously, the mempools can vary in size and transaction counts among different nodes.
When a node receives a new valid block, it removes the transactions in that block from its mempool, including transactions with conflicting inputs.
This results in a sharp drop in the size of the mempool.
Optimizing Mempool Management
Running a node does not provide a direct financial incentive, and the hardware resources dedicated to it are often limited.
In older versions of Bitcoin, a node’s mempool could max out its available RAM, causing the node to crash and restart with an empty mempool.
However, recent updates have introduced improvements.
If the mempool size approaches the RAM capacity, the node sets a minimal fee threshold.
Transactions with fees per kilobyte (kB) lower than this threshold can be immediately removed from the mempool, allowing only new transactions with a fee per kB large enough to remain in the mempool.