Provided you have ever executed a cryptocurrency transaction or purchased an NFT you may have noticed a delay in your transaction. But have you ever tried to figure out where your funds are during this delay? Well during this period, your delayed transactions are held in a waiting room known as a ‘memepool’. But what is this cryptocurrency waiting room and how does it work?
The mempool is an abbreviation of two words- ‘memory’ and ‘pool’. In blockchain transactions, the mempool is the temporary storage space for pending transactions awaiting to be processed and added in a block by a miner or a validator.
What Is a Mempool
It is a blockchain’s node ‘waiting room’ where transactions awaiting validation are held. Once you initiate a transaction on a blockchain network, the transfer is not immediately approved until a new block is added in the blockchain. This is done by miners in proof-of-work(PoW) chains like Bitcoin and validators in proof-of-stake(PoS) chains like Ethereum.
Until your transactions are added in a block, they are held in a queue along other unapproved transactions in this space.
The concept was first initiated and used by Bitcoin and later adopted by other altcoins like Ethereum. Overall all blockchains have a mempool although they may have a different name which they use to refer to it with. As the blockchain’s temporary storage space, the mempool comprises of two major components:
Pending Blocks: These are unapproved transactions that have been initiated to a blockchain network awaiting to be processed by a miner or a validator. Pending blocks indicate how congested the mempool is and how long the transaction will take before being added to a block.
Confirmed Blocks: These are added blocks on a blockchain which mainly contain approved transactions. The number of confirmed blocks indicates how fast and efficient a network is in completing a transaction.
How Does Mempool Work?
There are as many mempools as there are nodes. This indicates that every blockchain node has its own mempool with different transactions at different times.
Adding Transactions to The Mempool
To add a transaction to the mempool nodes have to broadcast it to each other until it has been passed on to the entire network. When a user initiates a transaction in a node they are sent in the mempool, where they are categorized in two states; queued or pending.
Queued transactions turn into pending transactions after they are checked and then validated by nodes. Once the transactions are in pending state, they can now be added into a block by miners or validators and later approved to complete the transaction. However, it is important to note that not all transactions receive the same remedy. Miners or validators have the freedom to choose which transaction to prioritize over the other when creating a block. In most cases users often pay higher than the average gas fees and offer incentives to miners or validators for their transactions to be approved.
After approving the transaction, the rest of the nodes communicate with each other to remove it from their mempool.
How to Release a Transaction from The Memepool
Sometimes you might find yourself in a situation where you have already signed and transferred a transaction in the mempool yet it has not yet been confirmed. This may occur due to an increase in fees of the current block or congestion in the blockchain which mostly occurs due to an increase in the number of transactions.
When your transaction is stuck in the mempool you are left with the following options:
Wait for reduction of gas fees
In a situation like this you can choose to wait for a decrease in gas fees. However, this might take days, weeks or even months while your transactions are still in the mempool.
Adjust gas fees
This entails increasing your transaction’s gas fees rate using methods like RBF(Replace by Fee) or CPFP(Child Pays for Parents) depending on the situation. This might give your transaction a better chance of approval by miners and validators.
Cancel the transaction
On the other hand you can decide to terminate the transaction by sending a similar transaction using a unique number known as a nonce. This number identifies the previous transaction and prevents replay attacks on the network. This method however will cause you another gas fee, when initiating another transaction.
What Is the Difference Between Mempool and Blockchain
Although the mempool and blockchain are major components of blockchain-based systems they differ. Their major difference lies in the duration in which they store transactions.
Mempool acts as a temporary storage space for pending transactions waiting to be added in a block by miners or validators. Once the transaction has been added to a block, it is permanently removed from the mempool.
Blockchain on the other hand is a permanent decentralized storage space for all confirmed transactions of a network. Every block in the blockchain network contains a cryptographic sum, transaction data and a timestamp of previous blocks added by miners or validators. This makes it a permanent storage space free from altering, deleting or tampering with.
What Is Mempool In Bitcoin And Ethereum Networks
Bitcoin and Ethereum are the two large dominants within the blockchain network. Like other networks within the space they utilize the mempool in their transactions. So let’s look at how they functions within these chains.
As indicated earlier, Bitcoin was the first blockchain network to adopt and use the mempool. In the beginning transactions fees were measured in satoshis per virtual byte(sat/vb). However, in 2017, Segregated Witness(SegWit) protocol was implemented.
The new upgrade saw an increase in Bitcoin’s mempool block size from 1MB to 4MB and a reduction in gas fees. This increased the number of transactions entering a single block and reduced the confirmation time.
Initially Ethereum utilized the proof-of-work mechanism but later moved to the proof-of-stake mechanism. This upgrade saw an introduction of a new concept of block builders within the network. Block builders are third-party entities responsible for building optimized transaction bundles. After forming these bundles they add them to validators or miners who then can add them in a block.
This upgrade however did not have any effect on gas fees, a situation experts believe will only change if Ethereum reaches its sharding phase.
The Future of The Mempool
The future of the mempool remains a field of active research within the crypto realm. Various approaches are being adopted to ensure a promising future of scalability and efficiency within this concept.
One of the approaches is the adoption of Segregated Witness(SegWit) by Bitcoin which improves transaction efficiency with more transactions included within a block.
Also Lightening Network a layer 2 solution which allows transactions off-chain is being utilized. This helps reduce transaction loads in the mempool and the major blockchain network. Additionally various chains are adopting Schnorr signatures scheme. This scheme allows collection of multiple signatures within a single one hence improving the network’s efficiency and privacy.
Although they act as temporary storage spaces, mempools are the determinants of a transaction’s future in a blockchain network. And even if they are overlooked, still they remain an important portion within the Web3 space