What is a Mempool?
Every time a new transaction is made on a blockchain network, the transaction is not immediately added to the blockchain. The new transactions are first collected and stored in a temporary storage space called “mempool”.
A mempool, or memory pool, is the waiting room for all unconfirmed/pending transactions. It’s like an organized waiting list for storing and sorting blocks before they are added to the blockchain.
Every individual node within the blockchain maintains its own mempool that acts as a repository for the series of transactions that it has checked and validated. This means that a blockchain has as many mempools as there are nodes. In simpler terms, a mempool stores unconfirmed transactions as individual transactions.
How Do Crypto Transactions Get Added to the Blockchain?
It’s the job of validators/miners to add new blocks of transactions to the blockchain through “consensus”. Hence, the transaction remains in a node’s mempool until a miner adds it to the blockchain. The node performs initial transaction validation checks, which involve ensuring that the number of outputs matches the inputs, the transaction is not a double spend, and the digital signatures are valid. The participating nodes update their copies of the transaction and propagate them to their peers across the network.
The transaction is rejected if the validation checks fail. Otherwise, it is added to the mempool of the node as it awaits for a miner/validator to include it in the next block. In the case of proof-of-work blockchains, miners compete to solve a complex mathematical puzzle, where the miner that finds a solution first gets to add a new block to the blockchain. Once a block is added to the blockchain, the transactions in that block are deemed “confirmed” and removed from the mempool.
Can Pending Crypto Transactions Be Rejected?
As a rule of thumb, if a transaction occupies the mempool long enough, around 48 hours, the transaction is dropped and the funds returned to the user’s wallet. This may happen when the individual pays a low transaction fee during periods of high transaction volumes. This is because miners typically prioritize transactions that offer competitive gas fees since they incentivize them to include those transactions in the next block.