Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Sudeeq3350 on April 02, 2023, 05:28:54 PM



Title: More Explanation on mempool and candidate block
Post by: Sudeeq3350 on April 02, 2023, 05:28:54 PM
I'm a new member in these forums, and while doing research to learn how transactions can be added to blockchain, I came across two terms that confused me: memory pool and candidate block.
As a result, I require additional clarification. Thank you very much.


Title: Re: More Explanation on mempool and candidate block
Post by: un_rank on April 02, 2023, 05:54:00 PM
Mempool[1] or memory pool is the storage of all unconfirmed transactions on the bitcoin network.
You can check the mempool depth to know how much fees to use for your transaction to get confirmed in a reasonable amount of time. This would show as xxmb from the mempool tip, telling you that your transaction would be completed after xxmb has been cleared from the pool.

Each node has their own mempool with transactions they have validated and can chose their desired configuration.

Candidate block is each individuals miner's block of unconfirmed transactions. They still need to compete with other miners (who have their candidate blocks) to solve the puzzle and confirm the next valid block which would be transmitted to all nodes.

[1] https://jochen-hoenicke.de/queue/#BTC,24h,weight

- Jay -


Title: Re: More Explanation on mempool and candidate block
Post by: Zaguru12 on April 02, 2023, 06:30:49 PM
A memory pool (also known as mem pool ) is like a storage for the node where transactions are stored before it is mined. The candidate block is where the nodes pick a transaction to store it temporarily before been mined on the blockchain.

The main difference is mem pool is the overall storage space for transactions but the candidate block is where the the multiple unconfirmed transactions picked from the Mempool are stored temporarily by mining nodes. It is This candidate block that the miner then adds to the blockchain

You can read through here;
 https://learnmeabitcoin.com/technical/memory-pool (https://learnmeabitcoin.com/technical/memory-pool)


Title: Re: More Explanation on mempool and candidate block
Post by: BlackHatCoiner on April 05, 2023, 09:34:28 AM
Memory pool is constisted of the transactions that have been propagated and follow both consensus and standard rules. It is commonly said that each node is likely to have different mempool; besides asynchronous communication, that is also due to standardness. Most nodes for example will not accept and propagate transactions which pay less than 1000 sats/kb. But, there are a few who will even propagate a 0 sats/kb transaction. While all nodes must find consensus, standardness is rather a set of rules each node individually follows according to their standards.

Candidate block is a block whose miner is trying to find a valid Proof-of-Work.


Title: Re: More Explanation on mempool and candidate block
Post by: bitmover on April 05, 2023, 04:48:38 PM
Mempool[1] or memory pool is the storage of all unconfirmed transactions on the bitcoin network.
You can check the mempool depth to know how much fees to use for your transaction to get confirmed in a reasonable amount of time. This would show as xxmb from the mempool tip, telling you that your transaction would be completed after xxmb has been cleared from the pool.


Just to  add to this answer.

The mempool has also a limited space of 300mb by default.
If the mempool exceeds 300mb the cheaper transactions may be dropped and the user will have to rebroadcast them again.

https://bitcoin.stackexchange.com/questions/96068/what-if-the-mempool-exceeds-300-mb


Title: Re: More Explanation on mempool and candidate block
Post by: hZti on April 05, 2023, 06:09:33 PM

Just to  add to this answer.

The mempool has also a limited space of 300mb by default.
If the mempool exceeds 300mb the cheaper transactions may be dropped and the user will have to rebroadcast them again.

https://bitcoin.stackexchange.com/questions/96068/what-if-the-mempool-exceeds-300-mb


This will usually also happen after around 2 weeks, when a transaction was not included into a block because of low fee rate. I’m not shure however if this happens because a specific time countdown or because it has reached the position to get thrown out of the mempool as the next one. Maybe somebody here does know and can clarify.


Title: Re: More Explanation on mempool and candidate block
Post by: un_rank on April 05, 2023, 06:24:16 PM
This will usually also happen after around 2 weeks, when a transaction was not included into a block because of low fee rate
This 14 day window is unrelated to the space in the mempool. By default, unconfirmed transactions transactions are dropped from the memory pool of nodes, it could be earlier or later for different nodes depending on their configuration. But when majority of nodes no longer have it on their mempool, it is best to rebroadcast it.

This is different from what bitmover is talking about. If a node exceeds their memory space (300mb by default) they can drop low fee transactions to free up space and include higher priority transactions (based on weight), even though those low fee transactions have not lasted close to 14 days unconfirmed.

- Jay -


Title: Re: More Explanation on mempool and candidate block
Post by: o_e_l_e_o on April 06, 2023, 09:08:48 AM
As un_rank says, they are two entirely different things.

Here is where they are defined in the code:

https://github.com/bitcoin/bitcoin/blob/5a8bd4505687a7ec76d731b1a8249ee04d641990/src/kernel/mempool_options.h#L19-L20
Code:
/** Default for -maxmempool, maximum megabytes of mempool memory usage */
static constexpr unsigned int DEFAULT_MAX_MEMPOOL_SIZE_MB{300};

https://github.com/bitcoin/bitcoin/blob/5a8bd4505687a7ec76d731b1a8249ee04d641990/src/kernel/mempool_options.h#L23-L24
Code:
/** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
static constexpr unsigned int DEFAULT_MEMPOOL_EXPIRY_HOURS{336};