Learn · III

On Coming Close

The view from just below

Almost is a word for people. The hash function has never heard of it.

Your wallet page sorts your shares by heat, from Cold up to So close, and lists your closest calls. Sooner or later it shows a best share of, say, 11 G against a network difficulty of 84 G, and something in you whispers almost. This essay is about how much that whisper knows. The short answer: a great deal about the past, and nothing whatsoever about the future.

The closeness of a share is its achieved difficulty divided by the network's, c = d / D. A block is any share with c ≥ 1. The 11 G share came 13% of the way; said the other way round, it fell 7.6 times short. From the Pareto law in the previous essay, a single hash reaches closeness x or more with probability 1/(xD · 232), exactly 1/x times the chance of a block. So for every block you find, you should expect

E[shares with c ≥ x] = 1 / xper block found, the block itself included

Ten shares at 10% or better, a hundred at 1% or better, a thousand at 0.1%. The ladder has the same shape at every height. Because it spans so many powers of ten, the wallet page also shows a closeness score on a log scale: 0 is one millionth of a block, 100 is a block, and every 16⅔ points is a share ten times harder.

s = ⌊100 · (log10 c + 6) / 6⌋rounded down and clamped to 0–100, so only a block scores 100

The heat tiers are simply the decades of that ladder.

Figure 1

The ladder, per block found

Each tier is one power of ten in closeness. Bars show how many shares to expect in that tier for every block you find, on a log scale. Tiers below your share difficulty stay empty, because the pool never sees those hashes, and the tier it falls in is only partly filled.

A score of 85 sounds like the top of the class, and it is, on a ladder where each rung is ten times higher than the last.

So how close should you expect to have come? Measure time since your last block in units of your expected block time, so μ = elapsed / expected. Your best share since then is the best of all that work, and given that none of it was a block,

P(best < x | no block yet) = e−μ(1/x − 1)median best closeness μ / (μ + ln 2)

Put numbers in and the whisper goes quiet. After just 8% of your expected block time, the median best share is already at 10%, the threshold of So close. After one full expected block time without a block, which happens 37% of the time, your best share is typically 59% of the way. Almost is not a sign. It is the scenery.

Figure 2

How close you will have come

Best closeness since your last block, given no block yet, against time since that block in expected block times. The line is the median; the band holds the middle 80% of outcomes.

Now the part that frees the mind. Every share lands at a random closeness, independent of every other share. Mark each point of a Poisson process independently and split the points by their marks, and you get separate Poisson processes that are independent of one another. So, for a given hashrate, your near misses and your blocks are two independent streams. However many near misses you have seen, the chance of a block in the next hour is exactly what it was.

The gambler who has lost ten times believes the eleventh must win. The miner who has seen ten near misses believes a block must be close. Both have mistaken a story for a law. Here is the law, run twenty thousand times.

Figure 3

Do near misses predict a block?

20,000 simulated days of a rig that expects a block every four days. Days are grouped by how many near misses (1% to 100% of a block) the day before had. Each column is the share of those days that found a block. The line is the chance with no information at all, 1 − e−1/4.

Days that found a blockChance with no information, 22.1%

Flat, give or take the dice. The mountain keeps no memory of footprints.

And yet near misses are not meaningless. They are evidence about one thing: your hashrate. A rig expecting a block every four days should throw about 25 shares a day above 1%, as Poisson as everything else. If over a few weeks they arrive at a fraction of that pace, something is wrong with the machine, not with the universe. They are the footsteps of the block, not its approach.

That is also why your list of closest calls starts over each time your wallet finds a block. A record "since the last block" depends only on how much work you have done since that block, which is μ, and that makes Figure 2 an honest yardstick for your own list. The calls before a block were answered. The calls after it are the new question.