🎉 Anycoin Direct joins forces with Finst to become the leading European crypto platform

What is a memory pool crypto

- 15 minute read

Bitcoin pool
Paul Hopmans
Crypto Expert
Paul Hopmans

A memory pool is a collection of transactions queued on a blockchain to be executed. Transactions with the highest fees are executed first.

A memory pool, or the term mempool in short, is a way to structure supply and demand when processing transactions on a blockchain. The clearest description is a transaction queue.

Memory pool
  • The best description of a memory pool in crypto is a transaction queue
  • A memory pool is essential for a blockchain, otherwise all transactions would have to be executed immediately
  • When you send crypto from one address to another it enters the mempool, then the nodes check to see if the transaction is valid
  • Those who do not offer enough gas fees may face a transaction that is never executed
  • On hard-to-scale blockchains like Bitcoin and Ethereum, you have to be extra careful about how much gas fees you offer
  • Some transactions are given higher priority because they are high volume or because they are essential transactions for blockchain operation
  • On certain sites you can see how much the current average gas fees are to execute a transaction and you can also see how your transaction is doing through your TXID (Transaction ID)
  • When the mempool is full new transactions may not be able to be made, sometimes nodes throw out the transactions with the lowest gas fees, a special single node remembers all transactions and offers them again in calmer times, this depends on the blockchain
  • Gas fees are calculated by nodes by first processing the transactions with the highest fees into the next block and so on down until the block is full, since they naturally want to earn as much as possible
  • Bitcoin's mempool dates back to 2012 with the Bitcoin Improvement Proposal 35, which processed all transactions on Bitcoin by block time of ten minutes, in order from highest to lower bid gas fees
  • About 4,200 transactions per block can be processed on Bitcoin
  • With the advent of Bitcoin Runes and Ordinals, there were regularly large congestions on Bitcoin and gas fees skyrocketed
  • Traditional financial systems can process all transactions directly
  • On a DEX, the mempool can cause you to pay more for coins because a bot could abuse the mempool via front running and queue-jumping, a good reason to be careful on a DEX
  • In the future it will be imperative that mempools do not fill up, otherwise crypto can never become mainstream, Ethereum in particular has been firmly on this path

Content

  1. Why is there a mempool in a blockchain?
  2. How does a memory pool work?
  3. What happens when the mem pool is full?
  4. How are gas fees calculated?
  5. The mempool of Bitcoin
  6. The difference from traditional financial markets
  7. Mempool on a DEX
  8. The future of memory pools
Waiting row crypto transaction

Why is there a mempool in a blockchain?

If transactions cannot be executed immediately, there must be a system that temporarily stores all transactions somewhere so that they are not lost. This system has been called the mempool and is used on a blockchain , a distributed database, used to store all outstanding transactions in order of the gas fees users are willing to pay to get their transaction executed.

Without a mempool, all transactions would have to be executed immediately. The blockchain system is usually not adequately equipped to do this because it can process fewer transactions than are coming in. So a mempool is essential for a blockchain to work properly.

Another reason for the existence of a mempool is to prevent conflicting transactions. If someone wants to spend the same coins twice at different nodes , a node's blockchain protocol will record these coins once in a block and send it to all other nodes, after which the other transaction will be thrown out of the mempool.

How does a memory pool work?

A transaction of a cryptocurrency is added to the mempool (temporary repository) when someone sends crypto from one address to another. Such a transaction reaches all (often thousands) nodes or miners of a blockchain in their local mempool. Each node has its own settings, including the mempool. It can be larger or smaller, according to preference or software of the node or miner.

Checking whether a transaction is valid

This transaction does not enter a block until a node records it for processing in the next block (persistent storage). All nodes check if the transaction is valid according to the consensus mechanism of the blockchain or protocol and then add it to the mempool. If a transaction is not valid, for example, if the user does not have sufficient funds, the correct private keys or if it is a double spending issue, it is rejected and not added.

At the end of the block period, such as the approximately ten minutes in Bitcoin (it is different on each blockchain), all transactions that are valid and provide enough gas fees to the blockchain are added in the next block made and the new state of the blockchain is known, after which this longest chain is broadcast to the other nodes by the node that made the block.

If you want to make a transaction on a blockchain, these transactions must be approved by nodes. A node keeps track of the blockchain and ensures that only valid blocks are passed through. A node can also choose which transactions they process first. Some wallets can estimate the waiting time before your transaction with these fees are processed on the relevant blockchain, so you can still adjust it.

Unconfirmed transactions in a mempool explained

Person meditating

The memory pool consists of all transactions that have not yet been processed. A node has the choice to include transactions in the next block made that it benefits the most from. Logically, these are those who are willing to pay higher transaction costs (gas fees). When a block on a blockchain is full it is added to the blockchain at the end of the block time. Each block contains the transactions with the highest possible fees and the new coins. Transactions that have been processed are removed from the mempool of all nodes.

If a blockchain is very busy, that is, if many transactions are done, only transactions with high transaction costs will be processed. As a result, transaction costs will rise. That means traders who underbid can wait a very long time for a node to process its transaction. Theoretically, that transaction can remain pending forever, but there are always hours in a day when trading is virtually at a standstill when such a transaction can be processed with a bit of luck. Some blockchains throw out transactions with too few gas fees after a certain amount of time or reject them outright.

Non-scalable blockchains

Turtle running

Some blockchains tend to be always busy, making a transaction with low fees much slower to process and causing congestion. This can be essential at times, such as when there are big changes in the price. So if you are wondering why your trade is not being processed you now know that you need to offer higher fees to get the trade processed faster into the next block.

At such times, transaction fees on certain blockchains, such as Bitcoin and Ethereum, can soar due to high demand. The maximum fees for Bitcoin were 300 euros per transaction in 2018 and those of Ethereum over 100 euros at different times, in 2017 the gas fees for ETH were around 1,000 Gwei, but the price of ETH was much lower. Fun fact: a transaction of 100,000 Tether on Bitfinex in 2023 cost a whopping $23.5 million! All the more reason to keep a close eye on your transaction fees!

Priority unconfirmed transaction

In some cases, certain unconfirmed transactions may also be prioritized regardless of gas fees. Nodes or miners do this with transactions from important addresses they know or with very high volumes from large investor funds, such as pension funds or BlackRock, for example. A transaction from an essential user of a network, such as users who maintain the network, may also be prioritized.

If you want to know what a mempool looks like you can visit all kinds of websites for that, such as https://www.blockchain.com/explorer/mempool/eth or https://mempool.space/ . There are quite a few of these, so choose one that reflects what you are looking for. The most important thing you need to know is approximately how much on average you have to offer in transaction fees to be processed in a block. After all, if you withdraw a transaction, you lose fees and have to pay another time gas fees to get the new transaction into the mempool.

Research your transaction in a mempool

If you get the idea that your transaction is not being executed you can enter the TXID (Transaction ID) and see what is going on with your transaction. This way you avoid the panic you may have when you think your funds are gone, several factors can contribute to this. If you see that it is pending but not offering enough fees, you can change this with an RBF (Replace By Fee) or a CPFP (Child Pays For Parent) transaction with higher fees. It goes too far for this article to explain this completely. At least now you know you can do something about it.

So when you dive into the memory pool and you see that even the wading pool is full you will have to decide whether you are willing to pull out your purse or whether you will take the Bible and read it out and then see if your transaction has already been processed by then.

What happens when the mem pool is full?

As with almost any data collection, there is a maximum amount of information a memory pool can hold. For example, the mempool of standard nodes for Bitcoin can only handle 300 MB. When it is full, miners will start throwing certain transactions out of the mempool. Not surprisingly, these are the transactions where the user offers the lowest gas fees.

However, there are also nodes that still store every incoming transaction with even the lowest fees in their mempool. By the way, this does not mean they will ever be processed, because if the fees offered are too low, miners will never take the transaction into the next block and users wait until hell freezes over.

Every blockchain has such a maximum, although many blockchains that are scalable will be able to process the transaction quickly, by being able to catch up in quieter times in a day. Some blockchains are also so fast that it matters very little.

Twisting by the mempool

Thus, when the mempool is full, the least attractive transactions will be thrown out first. As soon as space becomes available again, these transactions will be added back to the queue, as they are not simply discarded. Some nodes can be set to not "forget" any transactions. As soon as space becomes available again in the mempool, these nodes will send the cheaper transactions again for processing in the quieter times when there are fewer transactions.

If the mempool is full, users who offer too few gas fees may also not even be included in the mempool until the mempool has room again.

"We're twisting by the pool."
Dire Straits

How are gas fees calculated?

Gas fees meter

In a given block time, the mempool consists of a whole series of transactions not yet processed. A block can handle a certain amount of transactions. A node or a miner will want to fill the block maximally with transactions to earn as much as possible. Supply and demand will begin to determine gas fees.

So the next block will consist of as many transactions as possible with the highest possible transaction fees. So to keep it simple, a node will start counting from the user offering the highest gas fees and so on down until the block is full. This way, it can earn maximum and all transactions with the highest gas fees offered will be removed from the mempool and put into the next block.

Gas fees will start to rise if the mempool is constantly full of transactions with high gas fees. This is usually the case when something special is going on, such as extremely high volumes because of a bull market or the introduction of something important on a blockchain. In those times, it can take a very long time to process your transaction if you don't want to pay high gas fees.

The mempool of Bitcoin

Bitcoin memory pool

Bitcoin's mempool was not part of the whitepaper of Bitcoin. After there was enough talk that this was really needed, developers decided to propose it in Bitcoin Improvement Proposal 35 in the year 2012. This proposal was adopted by the miners and implemented, after which every transaction in Bitcoin ended up in Bitcoin's mempool first.

On Bitcoin, a miner has the full copy of the Bitcoin blockchain and uses Proof-of-Work protocols to verify that a transaction is valid. The mempool is maintained by RAM memory so it can be updated as quickly as possible. Each miner or node has its own mempool.

The block time on Bitcoin

Approximately every ten minutes, a new block is created on the Bitcoin blockchain, entirely according to the schedule of Satoshi Nakamoto , so the last Bitcoin will be mined around 2140. Each block contains all transactions recorded by miners in the block, plus the blockreward, which consists of 3,125 BTC since 2024. The miner who solved the cryptographic puzzle may make the block and pocket the reward.

The economic principle of adding transactions to a block is simple. A miner will first add transactions to a block he can earn the most from. Thus, whoever is willing to pay more transaction fees will be first. Once the block is full, since SegWit around a maximum of 4MB, the block is added to the blockchain after ten minutes by the winning miner and all transactions with the highest fees and a valid digital signature have been executed.

Priority of transactions

Bitcoin's mempool is thus filled with all the transactions traders want to make, including how much gas fees (cost per transaction) they are willing to pay. In busy times, only the trades with high gas fees will be included in a block and the other traders will just have to wait until it is a little less busy. If it is important they will have to settle for paying higher fees to get some momentum going.

A mempool fee rate estimate is suggested in many cases by apps and wallets. For high priority, you pay high gas fees. You do this if you want to speed up as quickly as possible, for example for very high amounts or a rapidly changing crypto price. You also have medium, low and no priority. You decide for yourself on the basis of gas fees how quickly you will be helped.

Number of transactions per ten minutes on Bitcoin

Every transaction is reviewed to determine if there is enough UTXO (Unspent Transaction Output), meaning you have enough BTC to pay for the transaction. Bitcoin is not exactly scalable. A maximum of about 7 transactions per second can be processed. A little arithmetic shows that in a ten-minute block 7x60x10 transactions, i.e. 4,200 can be processed. If a transaction is not included in a block after about two weeks, it is removed from the mempool.

Bitcoin gas fees and congestion

Endless row of people

There are times when a lot happens on the Bitcoin blockchain, for example, when BRC-20 (Ordinals) and Bitcoin Runes were made up by Casey Rodarmor. There were occasionally half a million transactions in the mempool, so if you happened to be in the back you had to wait about 1280 minutes, about 22 hours. Also, if the hash rate becomes lower, the Bitcoin network does not have enough computing power to process all pending transactions.

If you start looking at historical gas fees on the Bitcoin blockchain you will see that in early 2018, during the insane bull market, fees per Bitcoin transaction could reach over 300 euros! They have never been that high again, but sometimes the gas fees do get back to around 100 euros when something happens again that fills up the mempool in Bitcoinland.

The difference from traditional financial markets

In a traditional centralized financial system, such as a bank, transactions are processed immediately. They don't have to wait for anything and don't need permission from miners or nodes. A bank's software is supposed to be able to do all this automatically and let only valid transactions through.

A bank has all kinds of revenue, which means they do not have to charge anything for a transaction in most cases. They only require checking for validity and allow the transaction to be processed immediately.

Central versus decentralized

In a blockchain, transactions are collected in a mempool by decentralized nodes, which keep track of the blockchain and ensure that only valid transactions are processed. Moreover, these nodes decide when to process them, according to the rules of the blockchain, but also according to their own interests.

Once a block is approved by a majority of the nodes, all transactions in that block are processed. This can lead to significant delays especially with the less scalable blockchains, such as Bitcoin and Ethereum. There are even times when your transaction may not be processed at all because traders don't offer enough gas fees.

Mempool on a DEX

If you are going to trade on a decentralized exchange (DEX), the mempool can work against you. If you want to make a trade, it will first be placed in the mempool of the DEX. On a DEX, gas fees are also determined by supply and demand.

Front running

There are trading bots who can monitor a mempool and notice advantageous trades. If such a bot sees that by paying higher gas fees he can get ahead of you ( front running ) and can get you to pay a higher price for your coins, it's a simple calculation to see if it's a positive result.

Since there is no supervision on any DEX and everything is done through an Automated Market Maker and smart contracts , a mempool bot can go crawling ahead all day to foist higher prices on you for your coins.

Careful trading on a DEX

A short example would be that you want to buy an obscure coin, a DEX is known for, for 10,000. You will have to pay all kinds of fees in the process, such as gas fees. You offer 50 euros in gas fees and want to buy the cryptocurrency for 10 euros each, with a slippage of 2%. The bot can then count 2% of your 10,000 euros as profit, minus gas fees of more than 50 euros. The bot will then frontrun you and sell you this crypto for 10.20 euros, pocketing about 150 euros.

So be careful about betting large amounts on a DEX, as this occurs on almost all DEXs with an unprotected mempool. The alternative is to buy obscure coins on a DEX that does have trader protection and, for example, offers a limit price when buying or other protection against front running.

The future of memory pools

Futuristic pool

Blockchain is constantly evolving. It is well understood by many blockchains that a memory pool can slow down a blockchain considerably and can be a source of annoyance for users. Especially large blockchains like Ethereum tend to address every problem in the world of blockchain and cryptocurrency.

Ethereum the problem solver

If Ethereum (or another blockchain) has found a solution to network congestion due to a mempool, this solution will soon be picked up by other blockchains and they will try to integrate it into their protocols. Ethereum is known for wanting to accommodate the user as much as possible, and they have already done a lot to increase scalability and lower transaction costs through various protocol updates.

Technological progress

Advanced technology

Technological developments also play a role. Computers and Internet connections are getting faster and faster and can store and process more and more. This will be no different for nodes. To implement such a thing, however, takes money, time and consensus. Nodes and miners in a decentralized system must always approve updates to protocols, which can delay progress.

In database techniques, of which the mempool is a part, one can start working with sharding , a technique that breaks down information processing by dividing a database into smaller pieces, reducing the load on nodes. A number of blockchains already work with this. Ethereum will take a slightly different approach with their (Proto-)Danksharding technology, greatly increasing scalability.

Layer 2 roll ups and other scalability solutions

Another common technique is to have transactions on a popular blockchain rolled up on another network into a bundled number of transactions, which can be processed by the main blockchain as one transaction. This greatly reduces the load on the main blockchain and makes the mempool much less likely to fill up. These layer 2 roll ups , such as Arbitrum or Stacks, are springing up like mushrooms.

Also cross chain techniques like the bridge or the multi chain and the sidechain can unburden a mempool by not having to process everything on the main chain.

Other paths can also be taken, such as increasing the memory of the mempool or decreasing the information in a transaction, allowing more to fit in a mempool and in a block. Hashing and Merkle Trees can lend a hand in this regard.

Scalability determines future of cryptocurrency

Since decentralized techniques like blockchain need nodes to keep the blockchain decentralized, mempools will always be necessary. New transactions simply have to be put into a database somewhere. Eventually blockchains will recognize the need for scalability. Without it, blockchain and cryptocurrency will never become mainstream .

"The pool may be full, but the memory lasts forever."
Unknown author