# How often do miners recalculate the merkle root they're working on?

I think that I understood most of the things about Bitcoin but there is still a mystery.

We can see on https://blockchain.info/ that there are up to 4/5 new transactions every seconds. My question are : Do miners recalculate the Merkle root 4 to 5 times per second ? What happens to transactions made exactly as the same time a block is released?

I have seen that miners can choose the transactions they want to accept, but if it was the case I would be a miner, then accept maybe 2 or 3 transactions, find the nonce and get the 25 bitcoins reward. Why is that not possible?

I thank you a lot for your answers and I hope you will be able to help me. Thank you.

There are indeed many new transactions every second. The way miners deal with it is two-fold:

1. If an appropriate proof-of-work is found on any merkle root, simply publish that block and any transactions that did not make it into the block go into the next block (assuming sufficient fees)

2. Otherwise, calculate a new merkle root every so often (varies per miner, but let's say for the sake of argument that it's 5 seconds) and try to calculate the proof-of-work with the transactions included.

The reason why miners don't accept just 2 or 3 transactions is that it's just as much work to find the nonce for the proof-of-work whether there's 1 transaction or 1000 transactions. The probabilities remain the same. The nice thing about including more transactions as a miner is that you get more mining fees out of them.

• Thank you a lot for your answers and it helps me a lot. However I know don't understand why do we need approximately 10 minutes to solve a block For example, the last block nonce is ~2'909'195'137 and a standard mining machine is able to make more than ~8'000'000'000 hashes per second. If we can do that I will be sure that I will be the first to release the next block and then get the 25bitcoin reward within a few seconds
– user30825
Nov 27, 2015 at 21:21
• anything you change about the block changes the has, i.e. if you use a new timestam, add a transaction, change the order of transactions... there is no guarantee to find a block for any nonce.
– Murch
Nov 28, 2015 at 19:44

Looking at the fields in the block header, the nonce field is a 32 bit integer. This means that the nonce is an integer in the range from 0 to 4,294,967,295. As you point out, a miner with just an off-the-shelf GPU can easily calculate this number of hashes in less than a second.

In the early days of bitcoin, when the difficulty requirement was much lower than it is now, miners would scoop up a bunch of transactions, take the Merkle Root, use the current time as the timestamp, create the header, then iterate through the range of nonces - and they stood a decent chance of finding a nonce that (when combined with the rest of the info in the headers) produced a SHA256 hash that satisfied the difficulty requirement.

But nowadays, with the difficulty requirement much higher, miners stand a very small chance of finding a nonce that (when combined with the rest of the info in the headers) produces a SHA256 hash that satisfies the difficulty requirement after iterating through the range of nonce values. Therefore, they have to try again, by changing something else in the headers (e.g. the timestamp, or the transactions in the block), then iterate through the range of nonce values again in hopes of finding one that satisfies the difficulty requirement. This process repeats many times, until finally a miner finds the winning combination of header information and nonce that produces a hash that satisfies the difficulty requirement - which should happen approximately every 10 minutes by design.