Bitcoin, Blockchain and decentralized technology is revolutionary. While Bitcoin has numerous advantages over traditional currency it is quite complex to comprehend for a normal user. If you are new then before investing it is advised that you have some basic understanding of how Bitcoin and Blockchains work. It will really make things easier.
How often have you gone through this situation where you had to wait a long period of time for the Bitcoin transaction to complete. Not just Bitcoin but this occurrence is also common with all other major crypto currencies. We’ve seen users who’ve waited for several hours or even days for their Bitcoin transaction to get confirmed. This is because the mempool size is huge or the transaction might get stuck in the mempool due to low transaction fee. Also often when the withdrawal amount from exchange is being delayed and if you ask the support team then their reply would be: mempool has spiked and due to this your transactions will take longer than usual to confirm . So what is Mempool, why it matters and how mempool works?
What is Bitcoin Mempool?
Mempool in short means Memory Pool. As the name suggests it is place where the data needs to be processed are stored. So what type of data are stored here? The transaction data and so it is also called as transaction pool. Mempool or Memory pool is a place which consist of all the recent and pending transactions that occurred on the blockchain network. These transactions are waiting in the queue to be validated by miners and included in the next block on the blockchain.
So where is this Mempool located; is it on the blockchain? Memory pools are not stored on the blockchain; instead each nodes on the network has its own mempool and each mempool have a different memory capacity. Okay, so who are these nodes? It’s people like you, me, miners all over the world that has a full copy of the blockchain.
Okay, but why do transactions has to get in to mempool and how it goes into the mempool?
Before Mempool comes into play
Let’s assume that you are going to send few Bitcoin to another address. You open your core wallet, enter the recipient address along with the amount to be send, then choose the transaction fee and hit send.
Now your Bitcoin will not reach the recipient address immediately. Your wallet has to broadcast this transactions to other nodes on the network. To broadcast your wallet will first sign the transaction using private keys, pick unspent transaction outputs to construct transactions and then it will broadcast it onto the network. Technically it does a series of checks which we’ll not be discussing here. Once this verification gets successfully it will then get added to the mempool which is a place for unconfirmed Bitcoin transactions.
How does Memory pool work? Mempool Explained
Now your transaction have arrived to the mempool. Not just your transaction but there are 1000s of other unconfirmed transactions that are waiting in the mempool.
Now all these unverified transactions from the mempool needs to be validated before it can get included in the blockchain ledger. So who validates all these unconfirmed transactions? Miners. For your transaction to reach the recipient address it needs to have atleast one confirmation. To get 1 confirmation the miner needs to pick yours along with several other unconfirmed transaction from the mempool and put it together in a block. Then the miner starts solving a complicated mathematical problem. Once they find a solution the block in which you transaction is stored will become part of the blockchain.
On the other hand if your transaction left unconfirmed for a long period of time then it will get cancelled and returned from the mempool. The current mempool expiry time is set to 2 weeks (source: https://github.com/bitcoin/bitcoin/commit/5f0e27f1a8495d9be43a953bd0371ccbce510105) so if your transaction stays in mempool for more than 2 weeks (which is not practical) then the funds will return back to your wallet.
Okay, but on what metrics are all these transactions chosen from the mempool and why are some transactions being delayed or not chosen.
We’ll come to that shortly. But first do note that to ensure if the transaction is fully valid it is recommended that should atleast got 6 confirmations. To get confirmed 6 times it will take around 60 minutes because the block time of Bitcoin is 10 minutes.
Okay, If the Bitcoin block time is only 10 minutes then why my transactions takes a longer time to get atleast1 confirmation?
Remember the transaction fee which you chose from your wallet before sending coins. It plays a big role. Transaction fees are set by the sender and is presented in satoshi per byte. This transaction fee is usually negligible and is used to compensate the miners. Well, miners gets reward of 12.5 BTC (current reward) for solving a block but in addition to that they are also motivated by these small incentives. Also failing to pay fee could mark your transaction as spam and it will get removed from memory pool completely. So if your transaction takes too long to get confirmed then probably low transaction fee might be the reason. Another reason could be memory pool size.
Once a node receives a valid block all the processed transaction which is stored in the memory pool will get removed. It is to create space for new unconfirmed transaction which needs to be added on the blockchain next. This will result in mempool size drop as you see in the image below.
Mempool size fluctuates depending on the number of transactions that are being relayed. Also you must note that there only a certain number of transactions that a block can hold. Imagine what happens if there are a large number of transactions arrive to the mempool. The mempool will get populated and hence delay in transactions will occur.
Also due to limited number of nodes available the memory required to store all the unconfirmed transactions on the network also becomes limited. So to avoid being crashed due to overload of transactions; the mempool, once it reaches its size limit it will automatically sets a minimum fee threshold. Any transactions that are lower than the threshold will be removed from mempool. Only new transactions that meets mempool fees will get accepted by the mempool.
Transaction backlogs are common in Bitcoin so its better you analyze mempool before making any transactions.
So where can I find this mempool size (in MB) and number of transactions in mempool? Not all coins have some kind of mempool visualization or mempool explorer, but for Bitcoin there is. Following are the websites that you can use to view the mempool size, fees and transactions.
Found this guide helpful.