# 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?

I'm referring to this question: When do miners stop waiting for new transactions?

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.

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?

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.

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).

Many many thanks to you both for taking the time to help me out. Your responses made me suspect I'm misunderstanding something, think I get it now, although a quick confirmation on the following would be great.

If I understand correctly, this is the input for the hash function

1 - Nonce (32 bit number between 0 and 2^31) 2 - Previous block hash (fixed value) 3 - Current block transaction data (this is where I went wrong, thought it was fixed)

Previously I understood that each run of the hash function took the exact same input from 2 & 3 above, and that the only changing value from one run to the next is the nonce. Hence my assumption that each run would allow the miner to strike one value from the list of 2^31 nonces thus slightly reducing the list size and increasing the probability that the next run would be successful.

However, I now understand that the input for number 3 changes with each run of the hash function as new transactions were added in the meantime. This means that if we reuse the previous nonce the hash function will return a different value.

ps - extra question… is there a benefit if a miner always reuses the exact same nonce? wouldn’t this remove the need to generate a random nonce and therefore reduce processing needs?

• As an aside, it is against site policy to post follow-up Qs as answers, generally it is best to open a new question instead. Here is info on the 6 items that make up a block header (the input for the hash function). There is no extra benefit from reusing the same nonce, in fact the processing power needed to increment the nonce would be less than that needed to recalculate a tx merkle root. Please take some time to read older mining Qs, other knowledgable contributors have provided great answers on this topic in the past. – chytrik Jun 29 '18 at 18:52