6

I set out to test the claim: "Every nonce has an equal chance of winning."

Time Evolution

So, I plotted, with gnuplot, the nonce values vs. hashes for all the valid blocks in the blockchain:
Nonces vs. Hashes
Nonces vs. Hashes (cummulative)
Nonces vs. Hashes (1,000 blocks shown at a time)
(Also, in the last plot, you can really visualize the change in the difficulty and even see where the difficulty was decreased.)

Histograms

It makes sense that the nonces found are skewed toward 0 because this is a selection effect: most everyone starts searching for nonces starting at 0, so the lower nonces are found first, even though there may be also higher nonces that could produce a winning block: nonces histogram

Why are the hashes distributed this way, though?: hashes distribution

2-D histogram of hashes and nonces (logarithmic color scale): 2-D histogram of hashes and nonces

  • @Cryptognome Yes, silly me, I thought there were the same numbers of integers between equal intervals on a log graph…, viz., e.g.: log(100) - log(10) = log(1000) - log(100), but 100 - 10 < 1000 - 100. – Geremia Mar 11 '15 at 22:15
  • 1
    Why is so much of this question struck out? If it's incorrect, just remove it. Striking it out makes it harder to read, and I can't even tell what the question is anymore. – Chris Hayes Mar 12 '15 at 1:37
  • I think the problem is that the initial question made no sense, as it was based on a false understanding of the presented graphs. However, as Chris already said: The question should either be edited to fit the answers it got, or deleted if it is not deemed useful. As it is I'd vote on "not useful". – Murch Mar 12 '15 at 11:45
  • Even if the graphs were correct, it wouldn't prove that nonces had an unequal chance of winning. If you look at the numbers on winning lottery tickets, 7 will be over-represented. But it's not because 7 comes up more as a winner, it's because people play 7 more. If, for example, many miners try nonces sequentially from zero and stop when they find a share, you'll see a lower incidence of higher nonces. – David Schwartz Mar 13 '15 at 6:01
  • @DavidSchwartz But these graphs are of winning nonces (nonces that produce a block), not all nonces tried. – Geremia Mar 14 '15 at 2:05
6

It's not unevenly distributed. The reason it appears that way in the graphs above is because the x-axis is plotted in logarithmic units. Here's what it looks like in linear units:

Nonces vs. Hashes (semi-log-y plot)

5

As you noted, the logarithmic scale skews it right, because the number of nonces within log(10, nonce) > 9 is 3 times larger than log(10, nonce) < 9

The other factor that might skew the nonces on your chart is that a pattern in the nonces on the blockchain doesn't necessarily mean that it's caused by a problem in the mining algorithm. As a trivial example, imagine if I wrote a mining program that never searched odd nonces. This wouldn't affect its mining power, but a person looking at the output might conclude that odd nonces never produced blocks.

As a more realistic example, mining clients spend more time searching low ranges of nonces than high ranges of nonces, simply because they start at 0, and reset every block. This effect becomes less pronounced over time as hashpower per mining client increases.

2

Whatever non-uniformity you see in the distribution of found nonces is because due to the fact that not every nonce has the same chance of being tried. Every tried hash, however, has exactly the same chance of winning.

Switching to a new proposed block is cheap. For example, if a 3GH/s mining chip increases the timestamp or modifies the extranonce every second, it will only ever find nonces in the range 0-3000000000.

If not every tried hash has the same chance of winning, SHA256 would be utterly broken.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.