What is a mempool in blockchain & how it works
Share:
Table of contents
Short intro on transactions
Every transaction on the blockchain needs to be broadcasted by a node to the network participants. It usually takes some time before a transaction has fully propagated throughout the network. Eventually however, each transaction that passes all pre-validation checks and thus is valid will be included by a miner into a block on the blockchain. In the meantime though, transactions will be held in a “buffer”.
Block size
Each block that’s created is limited in size (For Bitcoin the limit is 1MB per block). Every transaction that gets included in a block takes up space in that block. If enough transactions are being broadcasted in a short time period the current block being worked on will eventually become full. When a block becomes full no more transactions can be added to it. This effectively limits the amount of transactions per second (TPS) available. Because of this scalability issue a concept of transaction fees exists.
Transaction fees
Blockchain miners will accept transaction fees from users to include and record a transaction to a block. A miner will generally prioritize transactions with higher transaction fees. This leads to a market where users are trying to outbid each other to have their transactions included in the next block(s).
Transactions waiting to be included in a block
If a transaction is not immediately included in a block it will have to go into some kind of buffer or queue while it waits. While transactions wait to be included in a block they are called unconfirmed transactions.
This is where the mempool comes into play. Every blockchain node will have a local space in its volatile memory (RAM) where they temporarily store unconfirmed transactions, this place is called the mempool.
Mempool
The mempool is a place in a blockchain node’s memory where unconfirmed transactions are temporarily stored while they wait to be included and permanently recorded and confirmed into a block on the blockchain.
Local state
Each node on the blockchain network will have its own mempool with its own state.
There does not exist any global mempool. Each node has its own mempool and therefore the state of a mempool on one node may not be exactly equal to the mempool of another node (at any given time). However, as transactions propagate throughout the network each and every node’s mempool should be more or less the same.
Size
The size of a mempool can be of a varying size depending on network activity. At times when there is more network activity you will often find that unconfirmed transactions on the network increase and thus also the mempool size. Another side effect of increased mempool size is that transaction fees tend to increase dramatically as users become more eager to have their transactions included in the coming blocks.
What can you do with the information in a mempool?
There are multiple things that you might want to do with the information that exists in the mempool of a node.
Here are some of the more common use cases:
Calculating & predicting transaction fees
Predicting how long time it should take for a transaction to be included in a block
Watch transaction movements between DeFi applications to detect profitability changes.
Detecting liquidity movements in / out of Defi applications
Arbitrage detection
Front running
If you are eager to query and explore the mempool of a blockchain there exists many different ways to do so. There are many prebuilt UI’s that can be found online, particularly for Bitcoin & Ethereum. You can also create your own tools for the blockchains you are interested in.
For quickly exploring the mempool of Bitcoin or Ethereum these two web applications are great:
Bitcoin
Ethereum
blockchair.com/ethereum/mempool/transactions
Impression
https://rarible.com/cryptofehed/ownedhttps://opensea.io/collection/wrappedapekidsclub
ANy APEKID TODAY for 2 $ IN THIS STORE FIRST BUYER WIN 11 ETHEREUM
https://r.upland.me/kN1R My Upland Game
https://opensea.io/collection/meebitofficial
https://rarible.com/user/0x7d9FE7f4018942765B3ab944Ca70CA99BE10D6d6/owned
linktr.ee/epicnftstore