<p>I think I know the reason behind your confusion here. Here's my interpretation of your original question:
&quot;Out of the finite number of things whose combination is being hashed, all else being the same, the nonce is a 32-bit field with a constant number of possibilities: 2^32. Out of these possibilities, if 1 billion are already exhausted, why does it not mean that you'd have a higher probability of finding the 'correct' nonce using this block header as opposed to 'starting from scratch' using a different block header?&quot;</p>
<p>The answer is that even if all the 2^32 possibilities for the nonce -- using a constant set of block header, timestamp, etc. -- were exhausted, it doesn't mean that one of the hashes you computed would satisfy the difficulty criterion; you might have to keep going by changing the transactions or timestamp and iterating over the nonce possibilities again.</p>

CC BY-SA 4.0
2022-01-07T18:48:45.823Z
2022-01-07T18:48:45.823Z
strangeloop
<blockquote>
  <p>I would have thought that the probability would be slightly higher for the first block (h1) as there are 1 billion nonces that you know do not succeed, i.e. fewer winning possibilities.</p>
</blockquote>

<p>For every computation, you have the <strong>same</strong> probability of generating a valid block hash. Nothing you can do will change this, even if you try every possible nonce value for a given header. Nothing about what you find while testing nonces will tell you anything about what the next nonce value will return as output. Each guess does not get you ‘closer to the goal’, it is just a random chance.</p>

<p>Think of it like this: </p>

<ul>
<li><p>You have a six-sided die (numbered 1 to 6) that you know is fairly weighted. If you roll a 1, you get to make the next block! Every other roll does nothing. </p></li>
<li><p>You roll the die ten times, and don’t get a 1 on any of the rolls. </p></li>
<li><p>Now, on your eleventh roll, you are given the option to switch dice. You can replace the one you were rolling, with a new one that is otherwise the same (also six-sided, printed with 1−6, fairly weighted). Your choice.</p></li>
</ul>

<p>What will give you the better odds of rolling a 1? The answer is: it doesn’t matter. The fact that the first die didn’t roll a 1 yet doesn’t influence what the next roll will be. The same goes for the replacement die. Just because it hasn’t been rolled yet, doesn’t make it any more likely to be a 1 (or any other number). </p>

CC BY-SA 4.0
2018-06-28T09:07:49.360Z
2018-06-29T03:05:23.370Z
2018-06-29T03:05:23.370Z
chytrik
<p>One of the properties we want from cryptographic hash functions (CHF) is that their output looks like random data as much as possible. In particular, when putting two similar messages like <code>header + nonce</code> and <code>header + nonce+1</code> through a CHF, their digests should not be in anyway more related than two completely unrelated inputs.</p>
<p>If the outputs of SHA256 were to follow some pattern, you would be able to get closer to a solution. This would allow the miner with the most hashrate to win more often than their share of the hashrate. Instead, we want mining to be progress-free: every hashing attempt should have an equal minuscule chance of winning.</p>
<p>It's therefore good that the only way to &quot;predict&quot; the digest of any <code>blocktemplate + nonce</code> is to perform the hash, and therefore, we can think of each hashing attempt as an independent random event—regardless of whether you've tried similar inputs before. (Although the same input will obviously have the same outcome and you'd be duplicating work.)</p>
<p>Let's also look at the magnitudes of the search spaces involved:</p>
<p>The nonce space is 32 bits, i.e. allows for 2<sup>32</sup> = 4,294,967,296 different values. The hashrate today is about 175 EH/s, which means that about one in every 175×10<sup>18</sup> H/s × 600 s = 1.05×10<sup>23</sup> H hashing attempts finds a valid block. So clearly, there is not a winning nonce for every block template, in fact, miners exhaust a complete nonce space about 4.07×10<sup>10</sup> times per second.</p>

CC BY-SA 4.0
2022-01-07T22:20:54.257Z
2022-01-07T22:20:54.257Z
Murch
<blockquote>
  <p>I would have thought that the probability would be slightly higher for the first block (h1) as there are 1 billion nonces that you know do not succeed, i.e. fewer winning possibilities.</p>
</blockquote>

<p>Would you agree that every toss of a balanced coin has a 50% probability of coming up heads?</p>

<p>What about if you've previously flipped 9 heads in a row?</p>

<p>A coin has no memory of previous flips, nor does proof-of-work have any memory of previous failed nonces.</p>

<p>Here's a different scenario:</p>

<p>A fishbowl contains 1,000 pieces of paper. Onto 999 of them is printed "lose." On one of them is printed "win."</p>

<p>What's the probability of drawing "win" at the beginning of the game?</p>

<p>1/1,000</p>

<p>What's the probability of drawing "win" after the first unsuccessful round?</p>

<p>1/999</p>

<p>And so on. Your chances of winning improve with every round. The fishbowl has state, and that state carries over to the next round.</p>

<p>Hashing has no state. That's why the miner's chance of finding a proof-of-work on either h1 or h2 is equal.</p>

CC BY-SA 4.0
2018-06-28T20:57:44.600Z
2018-06-28T20:57:44.600Z
Rich Apodaca
<p>I'm referring to this question: <a href="https://bitcoin.stackexchange.com/questions/49549/when-do-miners-stop-waiting-for-new-transactions?noredirect=1&amp;lq=1&amp;newreg=e0d4cf2df64a4988874d904e6d6eca09">When do miners stop waiting for new transactions?</a></p>

<p>More specifically, this statement from the top answer: </p>

<p>"suppose you have a block header h1 on which you have already tried a billion nonce values, and a header h2 which has just been generated and on which no nonces have been tried yet. If you have the choice as to which one to hash next, which should you choose, for the greatest chance of finding a winning nonce? The answer is, it makes no difference - they both have exactly the same probability. So there is no harm in switching to h2"</p>

<p>I would have thought that the probability would be slightly higher for the first block (h1) as there are 1 billion nonces that you know do not succeed, i.e. fewer winning possibilities.</p>

<p>Complete newbie here and to the bitcoin world so apologies if I'm missing something obvious.</p>

<mining-theory><nonce>
Why is the probability of finding a winning nonce exactly the same for a new header and a header where you've already tried 1 billion nonces?
JonT
# Why is the probability of finding a winning nonce exactly the same for a new header and a header where you've already tried 1 billion nonces?

(Asked by: username_0 on 2018-06-28)

I'm referring to this question: [When do miners stop waiting for new transactions?](https://bitcoin.stackexchange.com/questions/49549/when-do-miners-stop-waiting-for-new-transactions?noredirect=1&lq=1&newreg=e0d4cf2df64a4988874d904e6d6eca09)

More specifically, this statement from the top answer:

"suppose you have a block header h1 on which you have already tried a billion nonce values, and a header h2 which has just been generated and on which no nonces have been tried yet. If you have the choice as to which one to hash next, which should you choose, for the greatest chance of finding a winning nonce? The answer is, it makes no difference - they both have exactly the same probability. So there is no harm in switching to h2"

I would have thought that the probability would be slightly higher for the first block (h1) as there are 1 billion nonces that you know do not succeed, i.e. fewer winning possibilities.

Complete newbie here and to the bitcoin world so apologies if I'm missing something obvious.

**Tags:** mining-theory, nonce


---

## 4 answers

### Answer by username_4 on 2018-06-28. Score: 4 | Accepted answer

> I would have thought that the probability would be slightly higher for the first block (h1) as there are 1 billion nonces that you know do not succeed, i.e. fewer winning possibilities.

Would you agree that every toss of a balanced coin has a 50% probability of coming up heads?

What about if you've previously flipped 9 heads in a row?

A coin has no memory of previous flips, nor does proof-of-work have any memory of previous failed nonces.

Here's a different scenario:

A fishbowl contains 1,000 pieces of paper. Onto 999 of them is printed "lose." On one of them is printed "win."

What's the probability of drawing "win" at the beginning of the game?

1/1,000

What's the probability of drawing "win" after the first unsuccessful round?

1/999

And so on. Your chances of winning improve with every round. The fishbowl has state, and that state carries over to the next round.

Hashing has no state. That's why the miner's chance of finding a proof-of-work on either h1 or h2 is equal.


---

### Answer by username_1 on 2022-01-07. Score: 4

I think I know the reason behind your confusion here. Here's my interpretation of your original question:
"Out of the finite number of things whose combination is being hashed, all else being the same, the nonce is a 32-bit field with a constant number of possibilities: 2^32. Out of these possibilities, if 1 billion are already exhausted, why does it not mean that you'd have a higher probability of finding the 'correct' nonce using this block header as opposed to 'starting from scratch' using a different block header?"

The answer is that even if all the 2^32 possibilities for the nonce -- using a constant set of block header, timestamp, etc. -- were exhausted, it doesn't mean that one of the hashes you computed would satisfy the difficulty criterion; you might have to keep going by changing the transactions or timestamp and iterating over the nonce possibilities again.


---

### Answer by username_2 on 2018-06-28. Score: 3

> I would have thought that the probability would be slightly higher for the first block (h1) as there are 1 billion nonces that you know do not succeed, i.e. fewer winning possibilities.

For every computation, you have the **same** probability of generating a valid block hash. Nothing you can do will change this, even if you try every possible nonce value for a given header. Nothing about what you find while testing nonces will tell you anything about what the next nonce value will return as output. Each guess does not get you ‘closer to the goal’, it is just a random chance.

Think of it like this:

* You have a six-sided die (numbered 1 to 6) that you know is fairly weighted. If you roll a 1, you get to make the next block! Every other roll does nothing.
* You roll the die ten times, and don’t get a 1 on any of the rolls.
* Now, on your eleventh roll, you are given the option to switch dice. You can replace the one you were rolling, with a new one that is otherwise the same (also six-sided, printed with 1−6, fairly weighted). Your choice.

What will give you the better odds of rolling a 1? The answer is: it doesn’t matter. The fact that the first die didn’t roll a 1 yet doesn’t influence what the next roll will be. The same goes for the replacement die. Just because it hasn’t been rolled yet, doesn’t make it any more likely to be a 1 (or any other number).


---

### Answer by username_3 on 2022-01-07. Score: 0

One of the properties we want from cryptographic hash functions (CHF) is that their output looks like random data as much as possible. In particular, when putting two similar messages like `header + nonce` and `header + nonce+1` through a CHF, their digests should not be in anyway more related than two completely unrelated inputs.

If the outputs of SHA256 were to follow some pattern, you would be able to get closer to a solution. This would allow the miner with the most hashrate to win more often than their share of the hashrate. Instead, we want mining to be progress-free: every hashing attempt should have an equal minuscule chance of winning.

It's therefore good that the only way to "predict" the digest of any `blocktemplate + nonce` is to perform the hash, and therefore, we can think of each hashing attempt as an independent random event—regardless of whether you've tried similar inputs before. (Although the same input will obviously have the same outcome and you'd be duplicating work.)

Let's also look at the magnitudes of the search spaces involved:

The nonce space is 32 bits, i.e. allows for 232 = 4,294,967,296 different values. The hashrate today is about 175 EH/s, which means that about one in every 175×1018 H/s × 600 s = 1.05×1023 H hashing attempts finds a valid block. So clearly, there is not a winning nonce for every block template, in fact, miners exhaust a complete nonce space about 4.07×1010 times per second.


---

