A mempool is a data structure which stores unconfirmed transactions sent by users to the Bitcoin network. It acts as a temporary, unsorted holding area before transactions are added to the blockchain. The mempool contains all the transactions that have been broadcast but for some reason, haven’t been picked up by miners yet.
Each node of the Bitcoin network will maintain their own version of the mempool, with all the transactions that that node is aware of. The name ‘mempool’ is derived from ‘memory pool’, since this is an area of memory dedicated to storing unconfirmed transactions.
When a user sends a transaction and broadcasts it throughout the network, it first enters the mempool and waits until it is included in a new block by a miner. After entering the mempool, it is then up to miners to decide which transactions they want to include in their blocks- this process is known as transaction selection.
Miners usually prioritize transactions by their fee rate, meaning they tend to select those with higher fees first. The mempool is an important part of the Bitcoin network, as it allows transactions to remain valid until they are included in a block. Without it, users would have to constantly resend transactions which could lead to more network traffic and higher fees.
In order to ensure transactions remain valid and avoid double-spending, nodes in the network have to keep track of all the unconfirmed transactions in the mempool.