This question already has an answer here:

I'm a newbie.

What is the basic equation for computing profit from mining given gigahash per second of the miner, timeframe, miner costs, and current bitcoin economy stats like mining difficulty and dollars per coin?

And what are some URLs that have these stats always up to date?

I'm looking for the equation, not an online calculator.

marked as duplicate by Murch Feb 21 '16 at 9:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


The average amount of time (in seconds) to find a single share is:

difficulty * 2^32 / hashrate

In that equation, difficulty is the difficulty of a share and hashrate is your hash rate in hashes per second. A day has 86,400 seconds in it, so the number of shares you'll find in 24 hours is:

86,400 / (difficulty * 2^32 / hashrate)

A slightly more complex formula, using PHP:

$hashTime = ((float) $difficulty) * (pow(2.0, 32) / ($hashRate * 1000.0)) ;
$powerCostPerYear = 365.25 * 24.0 * $powerConsumption / 1000.0 * $electricityRate;
$blocksPerYear =  (365.25 * 24.0 * 3600.0) / $hashTime ;
$coinsPerYear = $blockCoins * $blocksPerYear;
$revenuePerYear = $coinsPerYear * $conversionRate;
$profitPerYear = $revenuePerYear - $powerCostPerYear;
$netProfit1st = $revenuePerYear - $costHardware - $powerCostPerYear;
if ($profitPerYear <= 0) $breakEvenTime = -1;
else $breakEvenTime = $costHardware / ($profitPerYear / (365.25 * 24.0 * 3600.0));
  • 3
    There are some unstated things in this formula, like $electricityRate should be in dollars per kilowatt hour, or that $hashRate is measured in Khash/s. If you documented those things, this would be a great answer. – Nick ODell Mar 22 '13 at 15:24
  • 1
    What the heck is a share? How many shares are there per bitcoin? Where does the difficulty number come from? This answer seems quite incomplete. – Qwertie May 13 '14 at 15:25
  • 1
    Can you explain or reference where the 2^32 number comes from and how it's calculated? – nallenscott May 22 '16 at 13:23

You effectively need a spreadsheet to calculate the profit because the difficulty factor changes every 2016 blocks, or about every two weeks. The difficulty factor is currently compounding itself somewhere around 35% to 55% per month. If you don't include this nonlinear effect you are kidding yourself. The compounding difficulty factor is the dominant term that will make or break ROI.

Not the answer you're looking for? Browse other questions tagged or ask your own question.