# Explain the math behind mining profitability calculators

Can anyone explain the math behind the mining calculators like:

http://www.bitcoinx.com/profit/

I'm trying to build a Google spreadsheet that does the same thing.

Suppose your hashrate is H hashes per second.

There are 86400 seconds in a day, so every day you will generate 86400H hashes.

Every hash has roughly 1 in 2^32 chance to be a share, so you'll find 86400 H / 2^32 shares.

Every share has a chance of 1/D to be a block, so you'll find on average 86400 H / (2^32 D) blocks per day (currently D = 267731249).

Every block gives a reward of B, so you'll get on average (86400 H B) / (2^32 D) per day. (Currently B = 25 bitcoins).

Then you can take into account additional factors such as the exchange rate, power costs, difficulty going up over time (requires computing an integral), and so on.

• Shouldn't you take into account total network hashrate? You are competing against that for each block reward right? And block rewards are throttled towards 1 every ten minutes? Oct 22 '13 at 18:03
• @user2130126: The network hashrate is manifested in the difficulty D. And yes, D is adjusted so that in equilibrium, a block is found every 10 minutes. Oct 22 '13 at 19:34
• so lets do an experiment. Lets say I have a 100 GHash/s machine. Right now the Difficulty is 609,480,000. Nov 21 '13 at 1:33
• Can you explain or reference where the 2^32 number comes from and how it's calculated? May 22 '16 at 13:22
• @nallenscott: It comes from the definition of MAX_TARGET, which is 0x00000000FFFF0000000000000000000000000000000000000000000000000000, meaning 2^{224}-2^{208}. The number of possible values of a 256-bit number is meaning 2^{256}. The ratio between those is very close to 2^{32}. A share is defined as a hash which is lower than the max_target (where a block needs to be lower than the current target, which is much lower). May 22 '16 at 19:29