Imagine Ana has just sent 2 BTC to Bruno...
The transaction was broadcast and some Bitcoin nodes accepted it. However, it still hasn't appeared in any block....


In the previous section, we learned how transactions reach nodes and propagate through the network.
But now a fundamental question arises...
WHERE DO NODES KEEP THESE TRANSACTIONS WHILE THEY REMAIN UNCONFIRMED?
The answer lies in an essential component of Bitcoin: THE MEMPOOL.


WHAT IS THE MEMPOOL, REALLY?
Its name comes from “Memory Pool,” an English expression related to storing data in memory.
In Bitcoin, it is the set of unconfirmed transactions that a node temporarily holds after accepting them according to its rules and policies.


Let’s go back to Ana’s example.
When a node accepts her transaction, it adds it to its mempool.
It keeps the transaction’s data there while the transaction remains

pending and has not been removed for some reason.
BUT KEEP IN MIND... BEING IN A MEMPOOL DOES NOT MEAN BEING PART OF THE BLOCKCHAIN.
The transaction has not yet been included in a block in the chain.


IS THERE A SINGLE MEMPOOL FOR THE ENTIRE BITCOIN NETWORK?
No. And here’s a very important distinction.
THERE IS NO CENTRAL MEMPOOL OR UNIVERSAL LIST OF PENDING TRANSACTIONS.
Each node that maintains a mempool manages its own.
Let’s imagine two nodes.
- The first retains Ana’s transaction.
- The second has not received it yet or decided not to include it.
Therefore, both can have different information about pending transactions.
Why does this happen?
Because not everyone receives the same transactions at the same time. In addition, they may apply different acceptance policies and storage limits.
TWO NODES DO NOT NEED TO HAVE IDENTICAL MEMPOOLS TO PARTICIPATE IN THE SAME BITCOIN NETWORK...


DO TRANSACTIONS STAY THERE UNTIL THEY ARE CONFIRMED?
Not necessarily.
A transaction can leave the mempool when it is confirmed, but it can also be removed beforehand.


WHY WOULD A NODE REMOVE A PENDING TRANSACTION?
Because its computing resources are limited.
A mempool can accumulate numerous transactions and consume a considerable amount of memory.
When it reaches its configured limit, Bitcoin Core can remove certain transactions to free up space.
It can also discard transactions that have been pending for too long.
And here’s an interesting fact...


IS IT TRUE THAT TRANSACTIONS EXPIRE AFTER 14 DAYS?
Not exactly.
By default, Bitcoin Core uses a period of 336 hours, equivalent to 14 days, to discard old transactions from its mempool.
But that value can be changed....
IT IS NOT AN EXPIRATION RULE IMPOSED BY THE BITCOIN PROTOCOL.
Nor does it mean that all transactions disappear from the network once that period has elapsed.


SO WHAT HAPPENS IF A NODE REMOVES ANA’S TRANSACTION?
The transaction is no longer stored as pending on that node.
But other nodes might still keep it.
It could even be broadcast again and, if it is still valid, eventually be confirmed.


A TRANSACTION DISAPPEARING FROM A MEMPOOL DOES NOT MEAN IT HAS BEEN DEFINITIVELY CANCELED....


CAN WE LOOK AT A REAL MEMPOOL?
Yes. We can visit:
https://mempool.space
This explorer lets you view pending transactions, recent blocks, and other Bitcoin data.
But keep in mind...
The information it displays depends on what its own infrastructure observes...
WE ARE NOT LOOKING AT A UNIVERSAL MEMPOOL, BECAUSE NO SUCH MEMPOOL EXISTS...


AND WHAT HAPPENS WHEN A TRANSACTION IS CONFIRMED?
When a node accepts a valid block containing that transaction in its chain, it stops keeping the transaction as pending in its mempool.
The transaction is now part of a block...


WHAT HAVE WE JUST LEARNED?
That the mempool lets nodes keep unconfirmed transactions.
That each node manages its own mempool, and they do not necessarily all contain the same transactions.
And that a transaction can be removed from a mempool without having been confirmed or definitively canceled.


But now an especially interesting question comes up...
IF MANY TRANSACTIONS ARE PENDING, WHY DO SOME GET CONFIRMED BEFORE OTHERS?
Imagine Ana’s transaction arrived first, and Bruno’s arrived several seconds later...
And yet Bruno’s transaction ends up being confirmed first....


HOW IS THAT POSSIBLE?
Is the order of arrival respected? Do fees matter? Who decides which transactions are included in the next block?
That is precisely what we will discover in the next section...


BECAUSE A TRANSACTION CAN BE IN THE MEMPOOL OF NUMEROUS NODES AND STILL REMAIN UNCONFIRMED...
IN BITCOIN, BEING PENDING DOES NOT GUARANTEE A PLACE IN THE NEXT BLOCK.


$BTC $ETH $BNB

#Bitcoin #Mempool #blockchain #TransaccionesBitcoin