3.5 C
November 29, 2022
Image default

What is “Bitcoin mempool”? How it works? What happens when it reaches the maximum size? | Blocksats

The Bitcoin network, how it works and comes to a consensus is a real masterpiece. Of course, it would not be possible without some basic mechanisms. One of them is the discussed mempool. If we look at the title of the article, strictly from the technical side, we will find an error in it. What? About this and mempool later in the text.

What is mempool?

From the point of view of a typical Bitcoin wallet holder, every transaction has its beginning right here. But what happens with her? In the rest of the text, I will try to describe in a simple way a very important area in the BTC network, which is mempool.

Each transaction in the network before it reaches the miner is broadcast between nodes. Mempool is a node mechanism used to store information about transactions on the basis of which they can be passed to the block or rejected.

Technically, the wording “Bitcoin mempool” is pointlessbecause mempool refers to nodes. Following this lead, it is reasonable to use the term mempool node. Moreover, the number of mempools is the same as the number of nodes in the Bitcoin network.

Due to the distributed nature of the BTC network, not all nodes receive the same transactions at the same time, so some nodes store more transactions in mempool than others at the moment. The standard mempool capacity is 300 MB. Because everyone can run their own node, all nodes have a different RAM capacity (depending on the hardware) for storing unconfirmed transactions. As a result each node has its own mapping of pending transactions, which explains the variety of sizes and numbers of mempool transactions in different sources.

Minimum requirements to run a full node:

  • Windows, Mac OS X or Linux operating system
  • 200 gigabytes of free disk space, available with a minimum read / write speed of 100 MB / s
  • 2 GB RAM
  • High-speed Internet connection, preferably without limits due to the large amount of data downloaded / received

How does Mempool work?

Nodes are the first stop of every transaction as soon as you leave the wallet. Before registering Tx in mempool, each of them performs a specific series of correctness checks:

  • check syntax;
  • make sure that the output / output lists are not empty, different from 0;
  • size in bytes ;
  • makes sure that none of the input data has a hash = 0, n = -1 (the so-called coinbase transaction, a special type of transaction created only by miners);
  • checks for nLockTime <= INT_MAX, rozmiar w bajtach> = 100 and sig opcount <= 2 - this parameter specifies the minimum time (shown in unix time or block height) before which the transaction cannot be accepted in the block;
  • rejects “custom transactions”;
  • excludes identical transactions by comparing the current pool and Tx from approved blocks;
  • for each input, it checks the main branch and pool of transactions to find a reference output transaction. If there is no output transaction for the input, it will be an orphaned transaction. Next adds to orphan transactions if a matching transaction does not yet exist;
  • for each input, if the reference output does not exist (e.g. never existed or has already been issued), it rejects this transaction;
  • using the reference output transactions to obtain input values, checks that each input value, as well as their sum, is within the allowable monetary range;
  • rejects if the sum of input values ​​
  • rejects if the transaction fee (defined as the sum of the input values ​​minus the sum of the output values) would be too low to get to the empty block;
  • checks whether the scriptPubKey accepts for each input; reject if any are bad;
  • adds to mempool;
  • “Add to wallet if mine”;
  • transfers transactions to peers.

If the transaction meets the above criteria, it is “admitted” to mempool and the node begins to broadcast it. If not, the transaction is not being advertised again by the node.

“Clogged mempool” in the Bitcoin network

As I mentioned earlier, each node has the right to set the maximum capacity. The standard value is 300 MB (most current nodes). It is worth mentioning here that the memory limit does not apply to data that is saved in the block and is displayed in Mempool.

The amount of memory used varies by platform. When the specified limit is reached, transactions with the lowest fee (miners fee) will be abandoned. The next step is to increase the entry threshold by raising the parameter value minMempoolFeeRate.

The next transactions that will want to get to mempool must meet this condition, namely:

your transaction fee> minMempoolFeeRate

After adjusting the minMempoolFeeRate parameter and rejecting the transaction (freeing up space), the node forwards its status update (current value of minMempoolFeeRate) to subsequent nodes. Tx with less than the minimum fee will not be accepted.

In the picture above you can see how the 1-2 sat / B band dropped around 6 am in the morning when the node mempool exceeded the limit.

Note that each node does it individually, so a node with a larger mempool limit or other architecture may drop transactions sooner or later. The nodes will keep a copy of the transactions relevant to their own portfolio. Even if all other nodes have abandoned the transaction, the sender and recipients of the transaction retained a copy. The sender can either force his node to abandon the original transaction and send another conflicting transaction to update it.

Of course, the node can continue to transmit the transaction until the situation in the Bitcoin network calms down. Then the value of the minMempoolFeeRate parameter also decreases.

To sum up, mempool clogged = higher fees.

Bitcoin mempool statistics

Related posts

Russian officials must declare whether they have any cryptocurrencies –

Aparnna Hajirnis

New bitcoin bubble in 2021 – Bitcoin Radio # 19 –

Aparnna Hajirnis

George Soros’ Family Office Started Trading Bitcoin

Anupreet Kaur

Leave a Comment