Mempool

Mempool

how mining works?

what should the miners do in idle time? when all nonce will be exhausted in 4*10^-9 sec. and this time is in nano sec which is less than 1 sec. and timestamp changes in 1 sec. should they wait for timestamp to change? no miner can use mempool to get new hashes. how?and what is mempool read the blog.

mempool

It is an area where all the Unconfirmed transactions are store. mempool is already present in the system just like block, there can be thousands of transactions in a mempool, miners picks transactions from mempool to add in block. The bitcoin Mempool (memory pool) is a** collection of all transaction** data in a block that have been verified by bitcoin nodes, but are not yet confirmed.

how mempool works

In a blockchain, the mempool is a temporary storage area for transactions that have been verified by the network but have not yet been added to a block. This is where transactions wait to be included in the next block that is added to the blockchain.

When a user broadcasts a transaction to the network, it is first verified by the nodes to ensure that it is valid. If the transaction is valid, it is added to the mempool, where it waits to be included in a block. Miners then collect transactions from the mempool and include them in the next block that they are working on.

Once a transaction is added to a block, it is considered to be confirmed and is permanently added to the blockchain. The mempool acts as a sort of buffer between the time a transaction is broadcast to the network and the time it is confirmed and added to the blockchain.

The size of the mempool can vary depending on the number of transactions being broadcast to the network and the rate at which blocks are being added to the blockchain. In general, a larger mempool indicates that there are more unconfirmed transactions waiting to be processed.

How actually mining of transactions happens?

latest-unconfirmed-transaction-mempool-space-bitcoin-briefly.png

suppose there is a miner and he have to mine a block, for that he will pick some transactions from the mempool, how he will decide which transaction to pick ? to add a block miners get rewards and mining fees, and transactions which are made has fees in it, so obviously he will pick those transactions which has higher fees, miner will pick one by one transactions and add those in a block. and miner will try to solve the computational problem, and** if the nonce is exhausted in nano seconds**. then miner will not sit idle waiting for 1 sec to complete. miner did not got the target with those transactions, so miners will** replace a transaction** who's fees is smallest and replace it with other transaction with little less fess from that transaction. when the data in the block is changed due to avalanche effect the hash will also change. and now when hash is change miner can again use nonce with the same timestamp. still if the miner has not hit the target and timestamp has not changes he can again replace transaction and try to hit the target. until** time stamp is changed.** once the timestamp is change and miner still has not hit the target then this time the hash is changed with the change in timestamp not by the data, so miner can add and replace again those transactions who's paying higher fees and again start mining.