In an earlier article on mining, I mentioned that the Bitcoin system periodically changes the difficulty of finding a block to ensure that the average times between blocks is approximately 10 minutes. That means that under normal circumstances, a block is found every 10 minutes on average, an average of 6 blocks are found per hour, 144 blocks per day and 1008 per week. Once there are sufficiently many miners, this means that a single miner may have to wait a long time before he finds a block and gets the reward. This turns mining more and more into a lottery and less of a relatively constant income stream to offset the costs. Fortunately, a system known as a ‘mining pool’ was developed where miners can collaborate on finding a block and are paid out a portion of the block reward. This article describes how pool mining works.

**Share the work**

If I mine with two identical machines, I’ll be able to compute twice as many hash values and will therefore have two times as high a chance of finding a block. This simple logic scales up rather well and it means that it makes no difference if 1000 people mine on their own or if they all submit any valid block they find to a central operator who then broadcasts it to the network.

And herein lies the main idea behind mining in a pool. The mining software is reconfigured to communicate with a central operator (the pool) rather than with the Bitcoin network directly. The pool provides the miner with the ingredients for the block and the miner tries to find a correct nonce. The rewards for finding a block go to the pool, who then distributes it among the miners.

**Share the rewards**

The point of pool mining is that all miners receive part of the block reward, not just the lucky one who computed the winning hash. So how do we go about deciding who gets how much? Clearly the reward a miner gets should be in some relation to the amount of computing power he is contributing. Someone with twice the power should get twice the rewards. But how do we measure how much someone has contributed?

One solution is for the mining software to count the amount of hashes computed and report that to the pool. But this method relies on all miners playing by the rules and not using modified software that reports an inflated amount.

Recall that mining involves computing hash values until one is found that is below the target. This target value is related to the difficulty parameter in the sense that if the difficulty is doubled, the target is halved and the chance to find a hash value below the target is halved as well.

Suppose now that the target is 100, so a hash value less than 100 is needed to make a valid block. The pool now asks the miners to report back all block headers that have a hash value of less than 10000. Any time a miner sends in such a result, the pool can compute the hash value as well and check to see if it’s correct. If so, the miner is credited for the work. This credit is typically called a ‘share’.

Approximately once every 100 reports will have a hash value that is not only below 10000, but also below 100 and thus makes for a valid block. At this point, the pool reports the block to the network and distributes the reward. The miner who reported this will still only get a single share.

**Payday!**

Now that we have a cheat-proof way to measure how much work a miner has done, we need to determine how to distribute the reward. The most obvious solution is to simply distribute the reward between the miners proportionally to the amount of work they contributed. Since we measure work in number of shares, we can add up the number of shares that were submitted while searching for this block, divide the block reward by this total and then pay each miner that much for every share they submitted.

However, there are ways to exploit this payment method by switching pools in a certain way. This gives a pool-switching miner a higher income than a miner that sticks with a single pool. Further details about this problem and the solutions in the form of other payout algorithms I will save for a future article.