What Is a Mempool and How Does It Work?

Beginner12/3/2023, 12:46:02 PM
This article offers the critical role of the "mempool" in cryptocurrency transactions, providing a deep understanding of its concept and operations. It highlights the dynamics and lifecycles of transactions handled within the mempool, explaining the potential reasons for congestion and delays.

If you have ever executed a cryptocurrency transaction, such as sending funds to another wallet address, you may have noticed a delay. These delayed transactions are usually held in what is called a ‘mempool.’

This guide details what a mempool is, how it works, and why it is an essential part of a cryptocurrency transaction.

)

What is a mempool?

A mempool is a sort of ‘waiting room’ on a blockchain’s node where unmined transactions are stored. The term “mempool” is a combination of two words – “memory” and “pool” and refers to the space where pending transactions wait in line before they are added to the blockchain.

Bitcoin was the first blockchain to introduce and utilize the concept of a transaction memory pool (mempool). Other blockchains like Ethereum also later adopted the term. All blockchains have some type of mempool, even though they may have a different term for it. For example, the Parity blockchain uses the term “Transaction Queue” to represent mempools on their chain.

Role in blockchain transactions

Mempools play a major role in how blockchain nodes operate. For a transaction to be completed and recorded on a blockchain, it must first be added to a block. However, not all nodes on a blockchain network can create a new block. For example, on blockchains that operate using a proof-of-work mechanism, such as Bitcoin, only miners can add transactions to a new block. As for blockchains utilizing a proof-of-stake mechanism, such as Ethereum, only validators or proposers can add transactions to a block.

After initiating a transaction, users must depend on a miner or a validator to approve the transaction and add it to the blockchain. This doesn’t happen instantly. Instead, there is a delay between the time a transaction was initiated and when it will be completed. During this time, the transaction is stored in a mempool awaiting confirmation.

How does the mempool work?

First, you should note that blockchains don’t have just one mempool. On the contrary, every node in a particular blockchain network has its own transaction memory pool. For instance, each node in the Bitcoin blockchain has its own pool of transactions waiting to be added to the public ledger. Together, mempools in individual nodes make up a collective mempool.

When a user initiates a transaction, it’s sent to a node. The node will then add the transaction to its mempool and put it in a queue, awaiting validation. Once the transaction is validated, it will be marked as ‘pending.’ Miners can only add transactions marked as ‘pending’ to a new block.

Mempool dynamics and transaction lifecycle

To illustrate mempool dynamics and transaction lifecycle, let’s assume that you want to send 0.01BTC to a friend.

  1. First, you will key in your friend’s wallet address, accept the blockchain transaction fees, and then hit ‘Send.’

  2. The transaction will be added to the nearest mempool as a ‘queued’ transaction.

  3. Next, the transaction will be broadcasted to other nodes in the network, but it will not be available on the blockchain just yet. Instead, every node performs individual tests to check that the transaction is genuine.

  4. If the nodes approve the transaction, its status changes from “queued” to “pending.”

  5. Eventually, the pending transaction will be picked by a miner and added to a new block.

  6. Next, the miner will broadcast this block back to all the nodes. As a result, all nodes will now have access to all the transactions included in the new block.

  7. At this stage, the nodes that still have your transaction stored in their mempools will delete it.

  8. Finally, your transaction is completed, and your friend receives the 0.01 BTC.

Mempool congestion and backlog

Congestion in a transaction mempool occurs when the demand for transactions exceeds the number of transactions that can fit in one block. Several factors can trigger mempool backlog. These include:

  • Congestion in the network: If the blockchain network is experiencing high transaction volumes, it will pressure the available block space, eventually leading to mempool congestion. For example, the average number of transactions in one block in the Bitcoin blockchain is currently around 2800. If the number of pending transactions greatly surpasses this number for several hours, the network will get congested, and as a result, the mempools will also get congested.

Bitcoin average transactions per block chart: Ycharts.com

  • Events or news: Events and news that directly affect the blockchain industry, like token launches, airdrops, or support from famous personalities, can cause sudden spikes in transaction demand. These spikes may lead to a temporary mempool backlog.
  • Forks or network upgrades: Network activities like forks or an upgrade to a blockchain network may cause momentary mempool congestion as the nodes in the network update the changes.

Understanding these factors and how they impact mempool congestion is important for users and developers. It enables them to anticipate potential delays and make the necessary adjustments to save on gas fees and avoid delays.

Managing transaction priority and fees

With many transactions occurring at the same time, there are several factors that determine which transactions get prioritized within a mempool. We highlight some of them below.

Fee estimation and transaction inclusion

One of the primary factors determining the order of executing transactions within a mempool is the fees attached to each transaction. Miners and validators are driven by profit, and they get to choose which transactions they want to add to a new block. Unsurprisingly, they favor transactions with higher fees attached to them since this translates to greater rewards.

Therefore, the fees associated with a transaction heavily influence its chances of being included in a block. Miners normally organize transactions inside their mempools in terms of fees per unit of transaction data, commonly represented as satoshis/byte. From there, they prioritize transactions with the highest rates of fees until the block is full.

This fee-based approach creates a competitive market within mempools. It forces users to choose between paying higher fees for fast transaction completion or lower fees at the expense of longer waiting periods.

Nonetheless, users can estimate the optimal fee that is not too expensive but would still secure a timely confirmation. This can be achieved by considering some factors such as historical data, transaction volume, network congestion, and fee distribution within the mempool. Most popular platforms, like crypto wallets and exchanges, have tools that can analyze the current state of a mempool and recommend the most appropriate fees.

Still, making accurate fee estimates is not an exact science, and challenges remain. For instance, network conditions can quickly change, rendering historical data unreliable. Furthermore, fees can become highly volatile during high-demand periods, leading to unexpected fee fluctuations.

Impact of network congestion

Network congestion impacts how transactions are processed and the gas fees dynamics in various ways:

  1. Increased confirmation times: When there is congestion, miners will begin to prioritize transactions that pay higher gas fees. This generally leads to longer confirmation times. If the mempool remains congested, transactions paying the lowest gas fees may take hours or even days to go through.
  2. Fee competition: Congestion in the mempool often causes users to start competing to have their transactions added to a block quickly. This means for miners or validators to prioritize your transaction, you have to pay higher fees. This results in higher fees during peak hours.

Mempool synchronization and block space

Mempools don’t have to keep a matching list of all transactions waiting to be added to a block. However, they have to know which transactions have already been added to the blockchain so that they can remove it from their mempool in case it is still stored there. When a miner broadcasts a new block to the nodes, they can check for this information and thus achieve mempool synchronization. This ensures that only unmined transactions are kept in mempools.

Block space, on the other hand, is the capacity available to include transactions in a new block. Since this space is limited, miners or validators prioritize transactions with higher gas fees while the rest are sent to the mempools awaiting confirmations.

Mempool size and eviction

Every transaction added to a mempool is a piece of data not more than a few kilobytes (kb). The sum of all the bytes making up the transactions is the size of the mempool. A larger mempool size indicates that there are numerous transactions awaiting confirmation. It could also signify a spike in network traffic.

Mempool size chart. Source: Blockchain.com

While mempools don’t have a predefined maximum size, nodes can set size limits for their mempools. This is normally set at 300MB for Bitcoin. When the mempool reaches this threshold, nodes may enforce a minimum transaction fee requirement. Any transactions with a fee rate lower than this limit are evicted from the mempool. By doing so, nodes can avoid crashing due to an overload of pending transactions.

Understanding how mempool size affects transaction fees and times is important since it enables users to pick the best times to carry out a transaction. There are several websites that track the global mempool size on the Bitcoin network, such as mempool.space and BitcoinTicker.co.

Mempool in Bitcoin and Ethereum Networks

Now, let’s look at how mempools function in Bitcoin and Ethereum, the two biggest blockchains worldwide.

Bitcoin mempool

All valid transactions sent across the Bitcoin network are not added to the blockchain instantly. They have to wait in the Bitcoin mempool.

Originally, transaction fees in Bitcoin were measured in the number of satoshis per byte of transaction. However, this changed after the SegWit upgrade. Now, transactions in a Bitcoin mempool are measured in weight units. This upgrade introduced what is known as a SegWit feature.

As a result of the upgrade, Bitcoin blocks can now accommodate up to four times more transactions.

Ethereum mempool

Like Bitcoin, the Ethereum blockchain initially utilized the Ethereum mempool to serve as temporary storage for transactions awaiting to be added onto a block by miners. However, after Ethereum’s move from a proof-of-work to a proof-of-stake consensus mechanism, the network introduced the concept of a block-builder.

Block builders are specialized third-party entities that compile transactions to create an optimized transaction bundle that can form a block. They do so by reordering or including certain transactions in the bundle from a transaction memory pool. Eventually, they offer the bundles to proposers/validators for inclusion in a block at a fee.

The value of a block depends on the transactions it contains. Therefore, it incentivizes block builders to create the most lucrative blocks as they are likely to be prioritized and confirmed quicker by validators. Consequently, like in other blockchains, the more fees you pay on Ethereum, the higher the chances that your transaction will be confirmed sooner.

Mempools are key to decentralized transactions

A mempool is a vital component in blockchain transactions. It acts as a form of a ‘waiting room’ where unconfirmed transactions await validation and, ultimately, inclusion in a new block. Understanding the mechanics of a mempool, such as transaction queuing, validation, and fee prioritization, is essential for cryptocurrency users.

Disclaimerïžš

  1. This article is reprinted from [Beincrypto]. All copyrights belong to the original author [Alex Lielacher]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.

What Is a Mempool and How Does It Work?

Beginner12/3/2023, 12:46:02 PM
This article offers the critical role of the "mempool" in cryptocurrency transactions, providing a deep understanding of its concept and operations. It highlights the dynamics and lifecycles of transactions handled within the mempool, explaining the potential reasons for congestion and delays.

If you have ever executed a cryptocurrency transaction, such as sending funds to another wallet address, you may have noticed a delay. These delayed transactions are usually held in what is called a ‘mempool.’

This guide details what a mempool is, how it works, and why it is an essential part of a cryptocurrency transaction.

)

What is a mempool?

A mempool is a sort of ‘waiting room’ on a blockchain’s node where unmined transactions are stored. The term “mempool” is a combination of two words – “memory” and “pool” and refers to the space where pending transactions wait in line before they are added to the blockchain.

Bitcoin was the first blockchain to introduce and utilize the concept of a transaction memory pool (mempool). Other blockchains like Ethereum also later adopted the term. All blockchains have some type of mempool, even though they may have a different term for it. For example, the Parity blockchain uses the term “Transaction Queue” to represent mempools on their chain.

Role in blockchain transactions

Mempools play a major role in how blockchain nodes operate. For a transaction to be completed and recorded on a blockchain, it must first be added to a block. However, not all nodes on a blockchain network can create a new block. For example, on blockchains that operate using a proof-of-work mechanism, such as Bitcoin, only miners can add transactions to a new block. As for blockchains utilizing a proof-of-stake mechanism, such as Ethereum, only validators or proposers can add transactions to a block.

After initiating a transaction, users must depend on a miner or a validator to approve the transaction and add it to the blockchain. This doesn’t happen instantly. Instead, there is a delay between the time a transaction was initiated and when it will be completed. During this time, the transaction is stored in a mempool awaiting confirmation.

How does the mempool work?

First, you should note that blockchains don’t have just one mempool. On the contrary, every node in a particular blockchain network has its own transaction memory pool. For instance, each node in the Bitcoin blockchain has its own pool of transactions waiting to be added to the public ledger. Together, mempools in individual nodes make up a collective mempool.

When a user initiates a transaction, it’s sent to a node. The node will then add the transaction to its mempool and put it in a queue, awaiting validation. Once the transaction is validated, it will be marked as ‘pending.’ Miners can only add transactions marked as ‘pending’ to a new block.

Mempool dynamics and transaction lifecycle

To illustrate mempool dynamics and transaction lifecycle, let’s assume that you want to send 0.01BTC to a friend.

  1. First, you will key in your friend’s wallet address, accept the blockchain transaction fees, and then hit ‘Send.’

  2. The transaction will be added to the nearest mempool as a ‘queued’ transaction.

  3. Next, the transaction will be broadcasted to other nodes in the network, but it will not be available on the blockchain just yet. Instead, every node performs individual tests to check that the transaction is genuine.

  4. If the nodes approve the transaction, its status changes from “queued” to “pending.”

  5. Eventually, the pending transaction will be picked by a miner and added to a new block.

  6. Next, the miner will broadcast this block back to all the nodes. As a result, all nodes will now have access to all the transactions included in the new block.

  7. At this stage, the nodes that still have your transaction stored in their mempools will delete it.

  8. Finally, your transaction is completed, and your friend receives the 0.01 BTC.

Mempool congestion and backlog

Congestion in a transaction mempool occurs when the demand for transactions exceeds the number of transactions that can fit in one block. Several factors can trigger mempool backlog. These include:

  • Congestion in the network: If the blockchain network is experiencing high transaction volumes, it will pressure the available block space, eventually leading to mempool congestion. For example, the average number of transactions in one block in the Bitcoin blockchain is currently around 2800. If the number of pending transactions greatly surpasses this number for several hours, the network will get congested, and as a result, the mempools will also get congested.

Bitcoin average transactions per block chart: Ycharts.com

  • Events or news: Events and news that directly affect the blockchain industry, like token launches, airdrops, or support from famous personalities, can cause sudden spikes in transaction demand. These spikes may lead to a temporary mempool backlog.
  • Forks or network upgrades: Network activities like forks or an upgrade to a blockchain network may cause momentary mempool congestion as the nodes in the network update the changes.

Understanding these factors and how they impact mempool congestion is important for users and developers. It enables them to anticipate potential delays and make the necessary adjustments to save on gas fees and avoid delays.

Managing transaction priority and fees

With many transactions occurring at the same time, there are several factors that determine which transactions get prioritized within a mempool. We highlight some of them below.

Fee estimation and transaction inclusion

One of the primary factors determining the order of executing transactions within a mempool is the fees attached to each transaction. Miners and validators are driven by profit, and they get to choose which transactions they want to add to a new block. Unsurprisingly, they favor transactions with higher fees attached to them since this translates to greater rewards.

Therefore, the fees associated with a transaction heavily influence its chances of being included in a block. Miners normally organize transactions inside their mempools in terms of fees per unit of transaction data, commonly represented as satoshis/byte. From there, they prioritize transactions with the highest rates of fees until the block is full.

This fee-based approach creates a competitive market within mempools. It forces users to choose between paying higher fees for fast transaction completion or lower fees at the expense of longer waiting periods.

Nonetheless, users can estimate the optimal fee that is not too expensive but would still secure a timely confirmation. This can be achieved by considering some factors such as historical data, transaction volume, network congestion, and fee distribution within the mempool. Most popular platforms, like crypto wallets and exchanges, have tools that can analyze the current state of a mempool and recommend the most appropriate fees.

Still, making accurate fee estimates is not an exact science, and challenges remain. For instance, network conditions can quickly change, rendering historical data unreliable. Furthermore, fees can become highly volatile during high-demand periods, leading to unexpected fee fluctuations.

Impact of network congestion

Network congestion impacts how transactions are processed and the gas fees dynamics in various ways:

  1. Increased confirmation times: When there is congestion, miners will begin to prioritize transactions that pay higher gas fees. This generally leads to longer confirmation times. If the mempool remains congested, transactions paying the lowest gas fees may take hours or even days to go through.
  2. Fee competition: Congestion in the mempool often causes users to start competing to have their transactions added to a block quickly. This means for miners or validators to prioritize your transaction, you have to pay higher fees. This results in higher fees during peak hours.

Mempool synchronization and block space

Mempools don’t have to keep a matching list of all transactions waiting to be added to a block. However, they have to know which transactions have already been added to the blockchain so that they can remove it from their mempool in case it is still stored there. When a miner broadcasts a new block to the nodes, they can check for this information and thus achieve mempool synchronization. This ensures that only unmined transactions are kept in mempools.

Block space, on the other hand, is the capacity available to include transactions in a new block. Since this space is limited, miners or validators prioritize transactions with higher gas fees while the rest are sent to the mempools awaiting confirmations.

Mempool size and eviction

Every transaction added to a mempool is a piece of data not more than a few kilobytes (kb). The sum of all the bytes making up the transactions is the size of the mempool. A larger mempool size indicates that there are numerous transactions awaiting confirmation. It could also signify a spike in network traffic.

Mempool size chart. Source: Blockchain.com

While mempools don’t have a predefined maximum size, nodes can set size limits for their mempools. This is normally set at 300MB for Bitcoin. When the mempool reaches this threshold, nodes may enforce a minimum transaction fee requirement. Any transactions with a fee rate lower than this limit are evicted from the mempool. By doing so, nodes can avoid crashing due to an overload of pending transactions.

Understanding how mempool size affects transaction fees and times is important since it enables users to pick the best times to carry out a transaction. There are several websites that track the global mempool size on the Bitcoin network, such as mempool.space and BitcoinTicker.co.

Mempool in Bitcoin and Ethereum Networks

Now, let’s look at how mempools function in Bitcoin and Ethereum, the two biggest blockchains worldwide.

Bitcoin mempool

All valid transactions sent across the Bitcoin network are not added to the blockchain instantly. They have to wait in the Bitcoin mempool.

Originally, transaction fees in Bitcoin were measured in the number of satoshis per byte of transaction. However, this changed after the SegWit upgrade. Now, transactions in a Bitcoin mempool are measured in weight units. This upgrade introduced what is known as a SegWit feature.

As a result of the upgrade, Bitcoin blocks can now accommodate up to four times more transactions.

Ethereum mempool

Like Bitcoin, the Ethereum blockchain initially utilized the Ethereum mempool to serve as temporary storage for transactions awaiting to be added onto a block by miners. However, after Ethereum’s move from a proof-of-work to a proof-of-stake consensus mechanism, the network introduced the concept of a block-builder.

Block builders are specialized third-party entities that compile transactions to create an optimized transaction bundle that can form a block. They do so by reordering or including certain transactions in the bundle from a transaction memory pool. Eventually, they offer the bundles to proposers/validators for inclusion in a block at a fee.

The value of a block depends on the transactions it contains. Therefore, it incentivizes block builders to create the most lucrative blocks as they are likely to be prioritized and confirmed quicker by validators. Consequently, like in other blockchains, the more fees you pay on Ethereum, the higher the chances that your transaction will be confirmed sooner.

Mempools are key to decentralized transactions

A mempool is a vital component in blockchain transactions. It acts as a form of a ‘waiting room’ where unconfirmed transactions await validation and, ultimately, inclusion in a new block. Understanding the mechanics of a mempool, such as transaction queuing, validation, and fee prioritization, is essential for cryptocurrency users.

Disclaimerïžš

  1. This article is reprinted from [Beincrypto]. All copyrights belong to the original author [Alex Lielacher]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
āđ€āļĢāļīāđˆāļĄāļ•āļ­āļ™āļ™āļĩāđ‰
āļŠāļĄāļąāļ„āļĢāđāļĨāļ°āļĢāļąāļšāļĢāļēāļ‡āļ§āļąāļĨ
$100