Post
Topic
Board Mining
Re: Bitcoin mining profitability calculator
by
mrjones
on 14/04/2011, 17:08:52 UTC
How would you do that? You can still increase the fixed difficulty by hand.
Take a look at this graph.  It shows difficulty versus time on a logarithmic scale.  (There's also a linear scale version available here.)  You can see that difficulty has increased from roughly 200 to 80000 (i.e. by a factor of 400) since the middle of July 2010.  That's 9 months, or 39 weeks.  Difficulty adjusts every two weeks, so that is 19 adjustment periods.  That means an average of roughly a 37% increase in difficulty every two weeks over this time period, since 1.3719 ~= 400.

You can work this into your equations easily.  You start with the equation:

factor(rate, numPeriods) = (1 + rate - (1 + rate)-numPeriods) / rate

In PHP, that would be:

Code:
$factor = (1 + $rate - pow(1 + $rate, -$numPeriods)) / $rate;

You need to allow the user to enter in a rate, which is how much they expect the difficulty to increase per two week period.  You could default this to 0.37 for example, or to a more conservative value like 0.20 if you think the number of people mining bitcoins isn't going to keep increasing at the historical rate.

For your specific code, you'd change it to be something like this:

Code:
...
$blocksInFirstTwoWeeks = $blockCoins * (14.0 * 24.0 * 3600.0) / $hashTime;
$factor = (1 + $rate - pow(1 + $rate, -26)) / $rate;
$blocksPerYear = $blocksInFirstTwoWeeks * $factor;
...

As an example, your current page with the default values shows 2676.80 coins per year (you say blocks, but mean coins). That's 103 per two week period.  We then calculate "factor" as above, assuming a rate of 0.20:

Code:
factor = (1 + 0.20 - (1 + 0.20)^(-26)) / 0.20 = 5.96

For a final answer of 613.88, rather than 2676.80.  This is a huge difference, but is very real.  If you use a rate of 0.37, you get a factor of 3.70, for a final answer of 381.1 coins, which is seven times less.

I would also suggest that you allow people to enter the number of periods, rather than one year.