<p>There is a fixed rate for how many bitcoins are mined each block. The block reward halves every 210,000 blocks, see <a href="https://en.bitcoin.it/wiki/Controlled_supply" rel="nofollow noreferrer">Controlled Supply</a>.</p>

<p>Here is a short term bitcoin distribution projection from the <a href="https://i.sstatic.net/UnN8S.png" rel="nofollow noreferrer">Bitcoin Wiki</a>:</p>

<p><a href="https://i.sstatic.net/UnN8S.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UnN8S.png" alt="enter image description here"></a></p>

<p>To calculate the total coins for a given block, try:</p>

<p><code>coins.py</code></p>

<pre><code>block = 210000 * 10
totalCoins = 0

subsidy = 50.0
for i in range(1,block):
    if(i%210000 == 0):
        subsidy = subsidy / 2
    totalCoins += subsidy
    #print i, subsidy, totalCoins

print totalCoins
</code></pre>

<p>Also, you might find this helpful: <a href="https://github.com/JBaczuk/altcoin_deflation_calculator/blob/master/plot.py" rel="nofollow noreferrer">Deflation Calculator</a></p>

CC BY-SA 4.0
2018-08-10T07:02:43.697Z
Thanks for you answer, I'm looking for the (pseudo) code that would generate this array.
franck
CC BY-SA 4.0
2018-08-10T13:12:16.903Z
Just added some code and a project that might be helpful
JBaczuk
CC BY-SA 4.0
2018-08-09T16:17:35.493Z
2018-08-16T17:26:14.620Z
2018-08-16T17:26:14.620Z
JBaczuk
<p>Is there a library to know the number of bitcoin mined at a given block number ? </p>

<money-supply><library><libbitcoin>
Number of bitcoins mined algorithm
franck
# Number of bitcoins mined algorithm

(Asked by: username_0 on 2018-08-09)

Is there a library to know the number of bitcoin mined at a given block number ?

**Tags:** money-supply, library, libbitcoin


---

## 1 answers

### Answer by username_1 on 2018-08-09. Score: 3 | Accepted answer

There is a fixed rate for how many bitcoins are mined each block. The block reward halves every 210,000 blocks, see [Controlled Supply](https://en.bitcoin.it/wiki/Controlled_supply).

Here is a short term bitcoin distribution projection from the [Bitcoin Wiki](https://i.sstatic.net/UnN8S.png):

[![enter image description here](https://i.sstatic.net/UnN8S.png)](https://i.sstatic.net/UnN8S.png)

To calculate the total coins for a given block, try:

`coins.py`

```
block = 210000 * 10
totalCoins = 0

subsidy = 50.0
for i in range(1,block):
    if(i%210000 == 0):
        subsidy = subsidy / 2
    totalCoins += subsidy
    #print i, subsidy, totalCoins

print totalCoins

```

Also, you might find this helpful: [Deflation Calculator](https://github.com/username_1/altcoin_deflation_calculator/blob/master/plot.py)

> **Comments:**
> **username_0**: Thanks for you answer, I'm looking for the (pseudo) code that would generate this array.  
> **username_1**: Just added some code and a project that might be helpful  

---

