<p>The average time to find a block can be approximated by calculating:</p>
<pre><code>time = difficulty * 2**32 / hashrate
</code></pre>
<p>Where difficulty is the current difficulty, hashrate is the number of hashes your miner calculates per second, and time is the average in seconds between the blocks you find.</p>
<p>Mining is a game of variance and luck. There are times that you could get lucky and generate more blocks than predicted and there will surely be dry spells when blocks do not occur. This can be seen by watching large mining pools as they solve blocks, blocks are not created on a set schedule by any means the network adjusts such that one block should be generated every 10 minutes, but we know that this will need to be adjusted regularly based on new miners coming online all the time. The network hashrate and thus the difficulty will be regularly changing.</p>

CC BY-SA 4.0
2013-12-13T01:57:05.810Z
2024-04-18T17:08:53.090Z
2024-04-18T17:08:53.090Z
Mark S.
<p>I want to give an extended answer as I found the pre-existing here or elsewhere in need of a bit more clarification, specifically for newcomers.</p>

<h2>Formula</h2>

<p>In order to calculate the approximated total bitcoin earnings value per month from a mining operation (not taking into consideration mining costs [electricity, hardware maintenance etc...]) the following formula can be used:</p>

<pre><code>H = Hashrate (hashes / second)
D = Difficulty (Reference for values below)
B = Reward per Block (Reference for value below)
N = Number of days per month (default = 30)
S = Number of seconds per day (S = 60 * 60 * 24 = 86400)
</code></pre>

<p><img src="https://i.sstatic.net/aqXbM.png" alt="Mining Earnings Formula"></p>

<h2>Example</h2>

<pre><code>H = 21,990,232,555,520 h/s (~= 20TH/s)
D = 47,427,554,950.648
B = 25
N = 30
S = 86400
</code></pre>

<p><img src="https://i.sstatic.net/aQODb.png" alt="Mining Earnings Formula"></p>

<p>The total number of bitcoins earned <em>per month</em> as per the defined variables above will be <strong>~6.995</strong>. Dismiss <code>N</code> from the numerator and you'll get the daily value.</p>

<h2>Python</h2>

<p>A quick python statement as an example implementation (you can type this directly in the terminal)</p>

<pre><code>$ python -c "print (30*21990232555520*25*86400)/(47427554950.648*2**32)"
$ 6.99542703277
</code></pre>

<h2>Some References:</h2>

<p><strong>Difficulty</strong> (<a href="http://blockexplorer.com/q/getdifficulty" rel="noreferrer">Current Value</a> | <a href="https://en.bitcoin.it/wiki/Difficulty" rel="noreferrer">Wiki</a>)</p>

<p><strong>Reward per Block</strong> (<a href="https://en.bitcoin.it/wiki/Controlled_supply" rel="noreferrer">Current and Future values</a>)</p>

CC BY-SA 3.0
2015-03-14T00:37:45.140Z
2015-03-14T00:51:54.423Z
2015-03-14T00:51:54.423Z
Bassem
<p>I want to know how I can calculate the profit of bitcoin mining in bitcoins. I am interested in the formula that is used by calculators. For example lets say I have 700mh/s hashrate, current difficulty is 908350862,437. The calculator says I will mine 0.00038755 BTC per day. What algorithm is used to calculate these figures?</p>

CC BY-SA 3.0
2013-12-12T21:32:59.567Z
possible duplicate of [How much Bitcoin will I mine right now with hardware X?](http://bitcoin.stackexchange.com/questions/118/how-much-bitcoin-will-i-mine-right-now-with-hardware-x)
Murch
CC BY-SA 3.0
2013-12-12T21:33:10.753Z
Check out this answer: http://bitcoin.stackexchange.com/a/135/5406
Murch
<mining-profitability><difficulty><hashpower>
What is the algorithm to create a Bitcoin mining calculator?
user1761818
# What is the algorithm to create a Bitcoin mining calculator?

(Asked by: username_0 on 2013-12-12)

I want to know how I can calculate the profit of bitcoin mining in bitcoins. I am interested in the formula that is used by calculators. For example lets say I have 700mh/s hashrate, current difficulty is 908350862,437. The calculator says I will mine 0.00038755 BTC per day. What algorithm is used to calculate these figures?

**Tags:** mining-profitability, difficulty, hashpower

> **Comments:**
> **username_1**: possible duplicate of [How much Bitcoin will I mine right now with hardware X?](http://bitcoin.stackexchange.com/questions/118/how-much-bitcoin-will-i-mine-right-now-with-hardware-x)  
> **username_1**: Check out this answer: http://bitcoin.stackexchange.com/a/135/5406  

---

## 2 answers

### Answer by username_3 on 2015-03-14. Score: 8 | Accepted answer

I want to give an extended answer as I found the pre-existing here or elsewhere in need of a bit more clarification, specifically for newcomers.
Formula
In order to calculate the approximated total bitcoin earnings value per month from a mining operation (not taking into consideration mining costs [electricity, hardware maintenance etc...]) the following formula can be used:
H = Hashrate (hashes / second)
D = Difficulty (Reference for values below)
B = Reward per Block (Reference for value below)
N = Number of days per month (default = 30)
S = Number of seconds per day (S = 60 * 60 * 24 = 86400)


Example
H = 21,990,232,555,520 h/s (~= 20TH/s)
D = 47,427,554,950.648
B = 25
N = 30
S = 86400


The total number of bitcoins earned per month as per the defined variables above will be ~6.995. Dismiss N from the numerator and you'll get the daily value.
Python
A quick python statement as an example implementation (you can type this directly in the terminal)
$ python -c "print (30*21990232555520*25*86400)/(47427554950.648*2**32)"
$ 6.99542703277

Some References:
Difficulty (Current Value | Wiki)
Reward per Block (Current and Future values)


---

### Answer by username_2 on 2013-12-13. Score: 3

The average time to find a block can be approximated by calculating:
time = difficulty * 2**32 / hashrate

Where difficulty is the current difficulty, hashrate is the number of hashes your miner calculates per second, and time is the average in seconds between the blocks you find.
Mining is a game of variance and luck. There are times that you could get lucky and generate more blocks than predicted and there will surely be dry spells when blocks do not occur. This can be seen by watching large mining pools as they solve blocks, blocks are not created on a set schedule by any means the network adjusts such that one block should be generated every 10 minutes, but we know that this will need to be adjusted regularly based on new miners coming online all the time. The network hashrate and thus the difficulty will be regularly changing.


---

