Understanding the Mempool

Understanding the Mempool

Blockchain Knowledge

Crypto APIs Team

May 23, 2022 • 6 min

Understanding what the mempool is and how it works will give you greater control over your transactions. It will not only mean paying fair transaction fees, but will ensure your transactions are processed on time and give insight into what to do when they aren’t.  

What is the Mempool? 

The mempool is a sort of waiting room for unmined transactions on the blockchain. The term “mempool” is a contraction of “memory” and “pool” and is used to describe the storage area of a node where validated transactions hang out, waiting to be mined and added to the blockchain.  

Although the term was first used by Bitcoin, the mempool has been adopted by the Ethereum network. Other blockchains have their own term for the mempool, for example, Geth calls it the “transaction pool” and for Parity it's the “transaction queue”. But essentially, they are all the same thing.   

However, calling it “the” mempool can be a little misleading, as there is no ONE mempool per blockchain. In fact, every node comprising a network has its own mempool. For example, every node on the Bitcoin blockchain has its own pool of waiting transactions. Those individual nodes with their individual pools, together form a collective global pool. 

How Does the Mempool Work? 

When you broadcast a transaction, it is sent to a node or nodes that it is connected to. Those nodes will validate (or reject) the transaction according to a set criterion, for example, it will ensure the signature is correct, that the coins belong to the seller, and the outputs don’t exceed the inputs. 

Then, if everything checks out, the nodes will pass this transaction on to all the other nodes they are connected to, and so on and so forth, with each node adding it to its memory pool, waiting for a miner to come along and do its thing. 

Let’s look at it in terms of a normal transaction lifecycle: 

  • Users initiate a transaction in their wallet, for example sending funds to another wallet, and sign the transaction with their private key. 
  • The signed transaction is broadcast to a node on the blockchain (Ethereum, Bitcoin, etc.) 
  • The node will check and validate the transaction, adding it to its mempool and broadcasting it to its peers. 
  • Each node that receives the transaction will do the same, replicating the transaction across the network. 
  • Some of these nodes will be mining nodes, which will add the transactions to a block and then compete to solve the hash of the block to be the one to add it to the blockchain. 
  • Once a miner is successful and the block of transactions is added to the chain, the new block is broadcast back across the network.  
  • All the nodes receive the new block and can see the included transactions. If they have any of those mined transactions stored in their mempool, they are removed. 

How the Mempool Effects Transaction Fees 

The mempool isn’t an infinite space— it has its limits. The size of available memory will depend on the individual node. Although the default mempool size is 300MB, each node will have its own rules for which transactions it allows into its own mempool. 

When the node is nearing its RAM limit it will set a minimum fee rate and communicate this to its peers so that they won’t forward transactions below this rate for the time being.  

A node with a smaller or larger mempool may drop transactions earlier or later which results in differing mempool sizes. 

This is what causes congestion and at this point, users can either wait for the congestion to clear (when a block is mined and other transactions are removed from the queue), or they can pay higher fees to try push their transaction through faster. 

How to Speed Up Bitcoin Transactions 

If you find your Bitcoin transaction is “pending” much longer than you’d like, you can make it more attractive to miners to speed it along.  

How you do this will depend on the architecture of the wallet you are using. You may be given the choice of an opt-in Replace-by-Fee (RBF). This lets you resend your transaction replacing the lower fee with a higher fee.  

If your wallet doesn’t support this feature, you may have to use the “child pays for parent” (CPFP) technique. Basically, you broadcast a new transaction (child transaction) using the change (unspent output) from the original parent transaction, but with a much higher fee.  

It’s more attractive, but in order for a miner to access the higher fees, they must validate the original transaction with the lower fee too.   

How to Speed Up an Ethereum Transaction 

Ethereum fees are called gas. You can find out more about Ethereum gas here

On the Ethereum network, you have three options, you can simply wait and see if your transaction finally gets accepted when the congestion eases. Or you can speed up the transaction by adding gas or cancel it to try again later.   

Basically, a cancellation and a “speed up” are overwrites of a pending transaction. The cancellation will overwrite with a zero-value replacement, while a Speed Up is adding gas in an attempt to speed up validation of a pending transaction. Just be aware that these actions are attempts, and your original transaction may still be accepted.  

The best way to have transactions validated in a timely manner is to pay a fair fee from the onset. The way to do that is with mempool data. 

Get Fee Recommendations from Mempool Data with Crypto APIs 

Having an idea about what fees you should pay before broadcasting a transaction can save a lot of headaches and money. You can stop paying higher than necessary fees or stop the endless waiting for transaction validation just by using Crypto APIs Blockchain Data.  

Our Get Fee Recommendations endpoint is based on mempool data with calculations done in real time to provide higher accuracy than recommendations based on already mined blocks.    

About Crypto APIs 

Crypto APIs offer business, SME and organizations the ability to implement blockchain infrastructure and securely scale their operations at a much greater pace while saving on development and operational costs.   

Our quantum secure Wallet as a Service (WaaS), instant access to live and historical blockchain data, market data, webhooks, automations, and powerful and unified endpoints enables a frictionless way to interact with cryptocurrency and digital assets across multiple blockchains. 

If you’d like to know more about the Crypto APIs product suit and how we can help you benefit from blockchain infrastructure, contact the team today! 

Related articles