# Difference between revisions of "Why pooled mining"

(redid the maths adjusting the priorly stated 96% odds of ever finding a block at 500Mh/s to 70%) |
|||

Line 36: | Line 36: | ||

TODO: write in the details of calculating the probabilities, make some pretty charts?, calculate out the hash rate at which you have 25,50,75 percent chance of never generating a block solo under various assumptions. | TODO: write in the details of calculating the probabilities, make some pretty charts?, calculate out the hash rate at which you have 25,50,75 percent chance of never generating a block solo under various assumptions. | ||

+ | |||

+ | == Alternative Perspective == | ||

+ | Mathematically the profit is the same for these conditions: | ||

+ | * chance to make 10,000$ is 0.01% | ||

+ | * chance to make 1$ is 100% | ||

+ | |||

+ | === What are the chances to not ever get a block? === | ||

+ | While a mathematician toying around with bitCoin mining might be fine with knowing it is mathematically fine to not see a BTC forever as the lucky case of getting 50 at a time will totally balance the odds of not finding it, others, especially those who want to get their hands on first bitCoins, might have a different feeling about it. | ||

+ | |||

+ | So what are the odds of never finding a BTC? | ||

+ | |||

+ | ==== How BitCoin Works / Simplifications ==== | ||

+ | The bitCoin block chain readjusts its [[difficulty]] every 2016 blocks trying to make the next 2016 blocks be processed in 10 minutes each given an average performance of the past 2016 blocks. | ||

+ | This process brings in some unsteadiness but to be conform with above equations time frame, we also look at periods of 2016 blocks but take difficulty only into consideration to determine the time frame for 2016 blocks and look at bitCoin as a lottery. | ||

+ | |||

+ | ==== The Maths ==== | ||

+ | * [[genesis block|block 0]] was created January 3rd 2009 | ||

+ | * [http://blockexplorer.com/b/20160 block 2160] was created '''July 25th 2009''' | ||

+ | * block 0 to 2160 took 202 days at difficulty 1. | ||

+ | * 202 days / 20160 blocks = 14 minutes / block | ||

+ | * hashrate = difficulty * 2**32 / time | ||

+ | * The Average hashing speed back then was (2**32 / 14 minutes) 5Mh/s | ||

+ | * Today is June 24th 2011 | ||

+ | * Since block 20160 there have been [http://blockexplorer.com/b/133056 133056] - 20160 = 112896 blocks in 689 days. | ||

+ | * There were '''163''' blocks created per day. | ||

+ | * Net performance increase was on average ((1+p)**112896=(11Th/s)/(5Mh/s)) '''0.00013 per block''' | ||

+ | |||

+ | ==== Assumptions ==== | ||

+ | * 500Mh/s | ||

+ | * total net performance of 11Th/s | ||

+ | * total net performance increase of i=0.013% per block over a long time | ||

+ | * 163 blocks per day over a long time | ||

+ | |||

+ | ==== Results for not finding a single block in 10 years ==== | ||

+ | * For each block odds are o(#block)=1-500M/(11T*(1+i)**#block) | ||

+ | * For all blocks odds are the product of o(0) to o(3600*163) | ||

+ | Until someone brings up the analytic solution to this product, here is a code snipped to calculate it: | ||

+ | private double calculate() { | ||

+ | double odds = 1.0d; | ||

+ | for (int i = 0; i < 3600 * 163; i++) { | ||

+ | if (i % (360 * 163) == 0) | ||

+ | Log.d("", Double.toString(odds)); | ||

+ | odds *= odds(i); | ||

+ | } | ||

+ | return odds; | ||

+ | } | ||

+ | |||

+ | private double odds(int i) { | ||

+ | return 1.0d - 5E8 / (11E12 * Math.pow(1.00013d, i)); | ||

+ | } | ||

+ | Probability for finding no block at all after n years are: | ||

+ | {| cellpadding="10" cellspacing="0" border="1" | ||

+ | |year | ||

+ | |probability of not finding a single block | ||

+ | |- | ||

+ | |0 | ||

+ | |100% | ||

+ | |- | ||

+ | |1 | ||

+ | |70.50196610996503% | ||

+ | |- | ||

+ | |2 | ||

+ | |70.4899742485864% | ||

+ | |- | ||

+ | |3 | ||

+ | |70.48996841288616% | ||

+ | |- | ||

+ | |4-10 | ||

+ | |70.48996841004953% | ||

+ | |} | ||

+ | |||

+ | === Conclusion === | ||

+ | 500Mh/s are definitely not worth mining for a long time but chances to find at least one block are well beyond the above stated 4%. | ||

[[Category:Mining]] | [[Category:Mining]] |

## Revision as of 13:39, 24 June 2011

*This page is a stub. Help by expanding it.*

This page is an analysis of the costs/benefits of pooled mining.

Some people say that no matter what, over the long run mining solo will provide the same return as mining in a pool. This is true in the case of stable difficulty, or in case of hash power being high enough that difficulty doesn't grow significantly in the 'average time' window to generate a block at your hash rate. It also assumes the solo miner has the same technological functionality as the pool (which is generally not the case; e.g., longpolling) Otherwise, as I will show below, it is possible that the probability of generating a block even "at infinity" will be less (far less) than 1.

Let's start with the current conditions...

Current Difficulty | `D = 567358.224571` |
---|---|

Typical mining-rig speed | `R` |

Probability of generating within fourteen days | `P` |

Average time to generate | 56 days, 9 hours, 47 minutes |

~~difficulty of 76193.9710474, and a hash rate of 1000 Khps (a run of the mill single core cpu). The probability to generate a block under these conditions in the course of 14 days (the target time between difficulty adjustments), is 0.00368942702934, and the 'average time' to generate a block is 10 years, 19 weeks, 4 days, 14 hours, 56 minutes, and 53 seconds.~~

Now let's assume that difficulty grows at 10% per period - that means that the average time between difficulty adjustments will be about 13 days. So we're looking at a base probability of 0.00342634853731. Further, the probability to generate a block in 13 days will also keep decreasing by about 10%, with every 10% rise in difficulty.

So now, let's find what our cumulative probability will be to generate a block. As a rough approximation, our cumulative probability of generating a block under these conditions, after N difficulty periods, would be sum(probability for individual periods). Actually the approximation will be higher than actual probability, since they're not really additive - though the addition is a pretty good approximation when the probabilities are so low. So, designating p = 0.00342634853731, our cumulative probability approximation will be about:

p + .9p + .9^2 p + .9^3 p ....

which at infinity sums to 10p. Thus, under these conditions, the upper bound (remember that summing probabilities produces a higher value than the proper multiplicative cumulative probability) is going to be 0.0342634853731. so /at infinity/, your probability of generating a block is only 3.4% or so. And conversely, your probability of /never generating a block even after millions of years/ is about 96+ percent.

Now, let's consider a pooled mining setup. In a fixed-payout mining pool, you get paid for each difficulty-1 share you generate. The probability to generate at least 1 share at difficulty 1, at 1000 khps in 13 days is so close to 1 that my calculator rounds it to 1. :) So with a pool, you have virtually 100% certainty that you will generate at least one share. You will in fact on average generate about 20 shares per day, or 260 shares in the 13 day period. A pool would pay out approximately 0.000656219899 BTC per share, so over the 13 day period you can expect to generate about 0.17 BTC.

So now you have to ask yourself one question (punk), do you want .17 btc with (almost) certainty, (with that amount decreasing by about 9% per period, under our assumptions of 10% difficulty growth per period), or would you like a 96+ percent chance of /never seeing a dime, ever/? And this is a question that every person would answer differently, depending on his risk preference.

Even with losses on pooled mining due to network latency, and pool fees, it is not irrational to choose pooled mining over solo mining, if the ratio of hashrate to difficulty (and difficulty growth) is low enough.

TODO: write in the details of calculating the probabilities, make some pretty charts?, calculate out the hash rate at which you have 25,50,75 percent chance of never generating a block solo under various assumptions.

## Contents

## Alternative Perspective

Mathematically the profit is the same for these conditions:

- chance to make 10,000$ is 0.01%
- chance to make 1$ is 100%

### What are the chances to not ever get a block?

While a mathematician toying around with bitCoin mining might be fine with knowing it is mathematically fine to not see a BTC forever as the lucky case of getting 50 at a time will totally balance the odds of not finding it, others, especially those who want to get their hands on first bitCoins, might have a different feeling about it.

So what are the odds of never finding a BTC?

#### How BitCoin Works / Simplifications

The bitCoin block chain readjusts its difficulty every 2016 blocks trying to make the next 2016 blocks be processed in 10 minutes each given an average performance of the past 2016 blocks. This process brings in some unsteadiness but to be conform with above equations time frame, we also look at periods of 2016 blocks but take difficulty only into consideration to determine the time frame for 2016 blocks and look at bitCoin as a lottery.

#### The Maths

- block 0 was created January 3rd 2009
- block 2160 was created
**July 25th 2009** - block 0 to 2160 took 202 days at difficulty 1.
- 202 days / 20160 blocks = 14 minutes / block
- hashrate = difficulty * 2**32 / time
- The Average hashing speed back then was (2**32 / 14 minutes) 5Mh/s
- Today is June 24th 2011
- Since block 20160 there have been 133056 - 20160 = 112896 blocks in 689 days.
- There were
**163**blocks created per day. - Net performance increase was on average ((1+p)**112896=(11Th/s)/(5Mh/s))
**0.00013 per block**

#### Assumptions

- 500Mh/s
- total net performance of 11Th/s
- total net performance increase of i=0.013% per block over a long time
- 163 blocks per day over a long time

#### Results for not finding a single block in 10 years

- For each block odds are o(#block)=1-500M/(11T*(1+i)**#block)
- For all blocks odds are the product of o(0) to o(3600*163)

Until someone brings up the analytic solution to this product, here is a code snipped to calculate it:

private double calculate() { double odds = 1.0d; for (int i = 0; i < 3600 * 163; i++) { if (i % (360 * 163) == 0) Log.d("", Double.toString(odds)); odds *= odds(i); } return odds; } private double odds(int i) { return 1.0d - 5E8 / (11E12 * Math.pow(1.00013d, i)); }

Probability for finding no block at all after n years are:

year | probability of not finding a single block |

0 | 100% |

1 | 70.50196610996503% |

2 | 70.4899742485864% |

3 | 70.48996841288616% |

4-10 | 70.48996841004953% |

### Conclusion

500Mh/s are definitely not worth mining for a long time but chances to find at least one block are well beyond the above stated 4%.