I've been reading a little about mining pools and the Stratum protocol for requesting work from mining pools and it got me to wondering. How does an honest mining pool divide up rewards? I see that the protocol allows for workers to request work from the pool, but how does the mining pool know how much work each worker has done? As far as I can tell, workers only report back to the mining pool when they have "solved" a hash and want to submit their answer for consideration. But what if that worker just lucky and there are other miners who have done much more work -- do they get paid the same? Similarly does a miner who is in the pool but hasn't solved anything get paid anything?
Mining pools use a system that is based on shares. Shares are blocks with proof of works for a different difficulty than the network difficulty. Mining pools will set the difficulty for a given miner to be something that is reasonable for it to achieve. So when that miner mines, it is looking for a block hash that meets the pool difficulty. Once it does, it submits the block. That submitted block, although likely not valid to the Bitcoin network, meets the pool difficulty and is known as a share.
So mining pools will count the shares and give weight to each share based upon the difficulty that it was mined at. In this way, the mining pool can determine how much work each miner has done on average and pay them accordingly once a block is actually found.
Blocks are found when a share meets both the pool difficulty and the network difficulty.
Since mining a block (solving the mathematical problem) is random by nature, any miner has a chance at receiving the reward of a finding a block. Miners with more hash power have a higher probability of solving the math problem, finding the block, and winning the block reward. With the large number of miners competing to find blocks, mining pools have materialized to combine the total hash rate of all the pool members to increase the probability of hashing blocks and optimize the probability of gaining block rewards. The pool keeps track of each member’s (miner’s) contribution to the total hash and the block rewards are distributed to each member of the pool based on each miner’s contribution. It doesn’t matter which individual miner mines the block as the rewards are proportionately distributed. It’s similar to office workers pooling funds to buy lottery tickets. They agree to share the winnings no matter which individual actually wins. To be fair, if someone in the office pool buys more tickets to the lottery than everyone else, they would get a proportionately higher percentage of the winnings, even if their tickets didn’t actually win. In mining, pools allow for a more steady income stream instead of an individual going months or years before actually mining a block,if ever, on their own.