Learn · II

On Shares

Receipts for invisible work

Nobody can watch you think. They can only grade your answers.

At most hashrates a block takes days, weeks or years. In between, the pool faces what economists call a principal–agent problem: it cannot see your machine, only what your machine sends. A miner that has been silent for a week might be honest, unlucky or unplugged. Silence is consistent with all three.

The fix is a second target, far easier than the network's. The pool assigns each connection a share difficulty a and asks to see every hash below T1 / a, where T1 is the difficulty-1 target from the previous essay. Any one hash clears that line with probability

q ≈ 1 / (a · 232)

so each share is a receipt for about a · 232 hashes. The receipts cannot be forged: the only way to produce a hash below the line is to compute hashes until one lands there. It is proof of work, sold retail.

Count the receipts and you have the speed. If shares with assigned difficulties a1, a2, … arrive over t seconds, the pool's estimate of your hashrate is

ĥ = (Σ ai) · 232 / t

Shares arrive as a Poisson process, so the count N in a window is Poisson and the estimate carries a relative error of about 1/√N. Notice what is missing from that expression: the share difficulty and the size of the rig. With the share difficulty roughly constant over the window, precision depends on how many receipts you hand over, and on nothing else.

That is the whole reason for variable difficulty. SegPool's stratum aims for about 12 shares a minute from every connection, raising a for fast rigs and lowering it for slow ones. A 1 TH/s miner settles near a ≈ 1,200; a 200 TH/s machine near 230,000. They speak at the same rate, so the hashrate chart is equally sure of both: about ±9% over ten minutes, ±3.7% over an hour and ±0.8% over a day.

Figure 1

A perfectly steady rig, as the chart sees it

One simulated day of a rig whose true hashrate never changes, sending about 12 shares a minute. Each point is the hashrate estimate from one window, as a percentage of the truth. The band is one standard deviation, 1/√N.

So when your ten-minute hashrate dips by 8% and recovers, your rig probably did nothing at all. The dice did.

A share only has to clear the line, but the hash behind it usually went further. Its achieved difficulty is d = T1 / hash, read from the hash itself. Given that a hash cleared the share line, it is uniformly distributed beneath it, which gives one of the cleanest laws in mining:

P(d ≥ y) = a / y,  for y ≥ aa Pareto law with tail index exactly 1

Half of all shares reach 2a. One in a thousand reaches 1,000a. And in the idealised law the expected achieved difficulty is infinite, because the integral of a/y diverges like the harmonic series. (Real hashes have only 256 bits, so the mean is merely about 150a, almost all of it from shares nobody will ever see.) Every share is an infinite expectation wearing a small coat. On log–log axes the law is a straight line of slope −1, and it looks the same at every scale.

Figure 2

How far shares fly

2,000 simulated shares. Each dot is one share: how many times its assigned difficulty it achieved, against the fraction of shares that did at least that well. The line is a/y.

Now the beautiful part. The network's target is just another line, far below the share line. A share becomes a block when d ≥ D, which by the same law happens with probability a/D. Thin a Poisson process by a fixed probability and you get another Poisson process: blocks arrive at a/D times your share rate. And since the block line lies below the share line, every block is a share, and nothing else is a block. The pool checks every share against both lines. One day one clears both, and it goes to the network with your address already written into its coinbase.

The same law says what to expect of your best share. The largest of N shares obeys

P(best < y) = (1 − a/y)N ≈ e−W/yW = N · a, your total work in difficulty units

a Fréchet distribution with median W / ln 2. Your best share is a rough odometer: it tracks how much work you have done in total, not how fast. And P(best ≥ D) ≈ 1 − e−W/D, because the event “best ≥ D” is exactly the event of a block. The best share on your wallet page and your next block are the same random variable seen from below. The next essay is about that view.

Figure 3

Your receipts

At about 12 shares a minute. Difficulty is the network's live figure.

Share difficulty—
Hashes per share—
Median best a day—
Share is a block—

One last game. In a pool that pays per share, there is a well-known sabotage called block withholding: submit every share, quietly throw away the one that is also a block. The saboteur is still paid for shares, and the pool loses the blocks. It is a real strategy, because the payoffs reward it against a rival pool.

In a solo pool it has nothing to stand on. Shares pay nothing, and the block pays the miner who found it, through the address in its own coinbase. Withholding a block would mean burning your own winning ticket. Honesty here is not enforced; it is simply the dominant strategy, the only row of the payoff matrix worth choosing. It is a rare and restful case of virtue and self-interest pointing the same way. Shares, in a solo pool, are only your voice: proof that the work is happening, the measure of its speed, and the record of how close it came.