The main function of mempool is to store transactions before they are validated.
Bitcoin and Ethereum are examples of blockchains that use mempools.
Blockchain congestion is the main reason why transactions get stuck for a long time.
If you want a transaction to go through fast use suitable gas fees.
We often make transactions on various blockchains like Ethereum and Bitcoin but we may not fully understand some of their technicalities. Nevertheless, knowing how some components of the blockchains work may help us to speed up our transactions or to lower their costs.
In this analysis we discuss Mempool in blockchain and how it works. We will also explain how you can handle pending or delayed transactions on the Bitcoin and Ethereum networks.
Read also: What Is a Blockchain Explorer?
Mempool, an abbreviated form of memory pool, is a node space for storing information such as unconfirmed transactions. It acts as a waiting room for transactions that have not yet been confirmed or approved. Remember that transactions are only included in a block when they are verified or approved.
In other words, a mempool is a space where pending transactions wait before they are added to a block.
When the transaction is verified, it means that all the peers on the blockchain can access the information. Nevertheless, before the transaction is approved various nodes verify the signature, check if output is not greater than the input and that the has not yet sent the digital assets. If any of these conditions is not met the validators or miners reject the transaction.
It is important to understand that there is no single mempool for a blockchain. As such, every node on the blockchain network has its own memory pool, also called transaction pool. Therefore, the mempools of the various nodes make up a collective blockchain’s memory pool.
As an instance, the transactions that are made on the Bitcoin network are not added directly to the blockchain. Each node stores the transactions in a temporary storage for transactions called the mempool or txpool. As a result, they form a queue that needs to be checked and validated.
Therefore, we can simply define a mempool as an organized queue of transactions that need to be sorted and added to a block.
Memory Pool (Mempool) in a Node- Babypips
Remember that transactions only exist in a mempool before they are confirmed or packaged into blocks. In the diagram above, the blue-colored section is the mempool space that exists within a node. The next diagram shows the distribution of mempools in a network.
Full nodes in the Bitcoin Network have Mempools - Babypips
As seen in the above picture, every full node in a network such as bitcoin or Ethereum has a mempool. However, every transaction will be broadcast around the network nodes as indicated in the next diagram.
A network of Bitcoin Nodes - Babypips
As we note in the diagram, the user in purple initiates a bitcoin transaction that is stored in the mempool before approval. It is essential to note that once the transaction is verified it is added to a block as the next illustration shows.
A Transaction is Added to the File (Block) - Babypips
The blue arrow in the diagram shows what happens when a transaction is verified, it is moved from the txpool to a block. At that stage all computers will have the updated file of the confirmed transaction.
Generally, Mempools do not work in exactly the same way. How they operate depends on the architecture of each blockchain. In other words, they work differently depending on the types of the consensus mechanisms of the networks. The transactions are either verified by validators or miners depending on the networks.
As an example, transactions on the bitcoin blockchain are verified by miners since it uses the proof-of-work consensus mechanism. On the other hand, transactions on the Ethereum network are approved by validators because the blockchain uses the proof-of-stake consensus mechanism.
Read also: Reshaping Ethereum and Potential Network Health Concerns
The bitcoin network requires a minimum of six confirmations per transaction while the Ethereum blockchain needs at least seven confirmations. Basically, each transaction in a mempool has a specific status. It is either pending or queued. When a validator or miner validates a queued transaction, it turns into a pending one.
Read also: What Is the Bitcoin Lightning Network?
Let’s look at a simple example of what occurs when you send ETH to a friend. The procedure involves inputting the wallet address, setting the gas fee and confirming the transaction.
Once you perform these your transaction is queued, waiting for verification. At that point it is broadcast to the entire network of nodes but it is not part of any block as yet.
If the validators check the transaction and find that it meets all the conditions it is moved from the queued status to the pending one, waiting for confirmation. From there one of the validators picks the transaction from the mempool and adds it to a new block.
At that stage several validators approve it which enables your friend to receive the ETH.
Step1: The sender inputs the destination address, accepts network transaction fees and hits ‘SEND’
STEP 2: The transaction is added to the nearest mempool and is queued.
STEP 3: The mempool data is broadcast to the other nodes in the network.
STEP 4: A node approves the transaction and its status changes from Queued to Pending.
STEP 5: A miner picks the pending transaction and adds it to a block.
STEP 6: The rest of the nodes drop the transaction from their mempools.
STEP 7: The transaction is completed and the asset gets into the destination wallet.
Now that you understand what delays your transaction when you process it, let’s look at the reasons some transactions get stuck and what action you can take.
The main reason why transactions are stuck in the mempool is network congestion. When there is high transaction volume pressure mounts on the available block space which triggers the mempool backlog. This occurs if the number of pending transactions is more than the average transactions in a block.
Some events and news that affect the level of traffic on the blockchain may cause congestion on the network. For example, airdrops, listing on more exchanges or new partnerships can lead to congestion. However, there are factors that can enable the nodes to prioritize certain transactions.
Transaction Fee: The amount of fees attached to the different transactions determine the ones that are approved first. Since miners and validators are driven by profit, they prioritize transactions that have higher fees because that enables them to get higher rewards.
Therefore, the miners and validators organize the transaction in their mempools based on fees per unit such as satoshis/byte. At the end, they add to the blocks the transactions with the highest fees first. This forces the users to set high fees for their transactions.
Nonetheless, depending on the network traffic the users can set optimal gas fees and still have their transactions confirmed on time. What is important for the users is to check factors like historical data, network congestion, transaction volume and fee distribution in the mempool before setting their own gas fees.
Confirmation times: The users may also need to check confirmation times before setting their fees. When the confirmation times are high it means that the miners and validators give preference to transactions with high fees. In essence, when the mempool is congested it means that the transactions with lower fees will take much time to go through.
Block space: The block space also determines the amount of time that lapses before transactions are approved. Since the block space is always limited, miners and validators give preference to transactions that have higher fees. This means that the transactions with lower fees spend much time in the mempool.
Mempool size and eviction: Each transaction to be added to the block is a piece of data with a size measured in kilobytes. Therefore, large mempools accommodate many transactions. Usually, nodes set the sizes of their mempools which are often 300MB for Bitcoin. When a mempool reaches a threshold, the node may set a minimum transaction fee.
When the users understand such dynamics, it becomes easy for them to set their transaction fees and to have them approved within a reasonable period. For example, they can avoid overpaying during periods of low throughput or underpay during peak times when they have time-sensitive transactions. They can also make near-correct educated guesses of how quickly their transactions will be validated.
Oftentimes, transactions get stuck in the mempool for several reasons but most of them are related to the gas fees. However, the greatest reason why some transactions are stuck in the mempool is network congestion. When there is congestion the transactions with high fees go through first leaving the rest stuck there.
Therefore, the best thing to do during network peak times is to increase the transaction fees. This is because when there is congestion the gas fees spike. So, if you process a transaction during busy times, you should match your fees with ones that other network users are paying.
The other reason why the transactions are stuck in the mempool is a drop in the hash rate. We say that the hash rate has dropped when the network does not have the physical computing power to ute a high number of pending transactions.
You have a few options when your transaction is stuck in the mempool. The first option is to cancel the transaction. In this case, it will cost you another transaction fee. For example, you can resend the transaction with the same nonce.
Secondly, you can choose to speed up the transaction by connecting your Ledger to a third-party wallet such as MetaMask or Electrum. Nevertheless, you will need to pay more for that.
The third option is to wait a bit longer for the transaction to sail through. By doing this you wait for the network traffic to decrease which will allow your transaction to go through without additional cost.
The transactions sent to the Bitcoin network are not added instantly to the blockchain. They first get into the mempool. In the past such transactions would just require fees measured in satoshis per byte.
However, this changed after the SegWit upgrade which enables transactions to be measured in weight units. The good thing is that the segwit features allow more data to be added to a block than before. Specifically, there is 2MB of data per block although it can increase to 4MB.
Initially, the Ethereum network required transactions to get into the mempool before being validated. Nevertheless, when the blockchain moved from the proof-of-work consensus mechanism to the proof-of-stake one, it introduced the concept of a block-builder.
Basically, the block builders are third party players that compile the transactions into an optimized transaction bundle that forms a block. In this case, the third-party entities compile or reorder certain transactions from a mempool into bundles. From there, they offer the transaction bundles to the validators for inclusion into the blocks. The third-party entities get rewards for doing these tasks.
In summary, a mempool is a space where a blockchain node temporarily stores transactions before they are validated. The length of time that a transaction remains in the mempool in Ethereum depends on several factors such as network traffic congestion and the gas fee. Both the Bitcoin and Ethereum blockchains use transaction pools.
A mempool is a space where pending transactions wait before they are added to a block. Once the transaction is validated it is added to a block which exists on the blockchain.
When some transactions are in a mempool some validators or miners pick them and add them to blocks. However, some of the transactions may remain queued or pending for a long period if there is network traffic congestion.
The BTC mempool is the waiting room for transactions that are processed on the Bitcoin network. Usually, every bitcoin blockchain node has its own mempool.
A mempool in Ethereum is the space for storing transactions on the Ethereum nodes before they are confirmed. The time that lapses before these transactions are confirmed depends on the traffic of the Ethereum network within a certain period.