<p>Take a look at <a href="https://blockchain.info/api/charts_api" rel="nofollow">this</a>, its the blockchain.info api. it gives a json feed for many things.</p>

CC BY-SA 3.0
2014-03-27T23:46:39.960Z
2014-03-27T23:46:39.960Z
Astad
<p>The number of bitcoins in existence at any given time is predictable in advance. To get an approximate number, you just need to look it up in a table based on today's date. The Bitcoin wiki has one at <a href="https://en.bitcoin.it/wiki/Controlled_supply" rel="nofollow">Controlled supply</a>.</p>

<p>To get the precise number of mined bitcoins at any given moment, you would take the current block height (available from any of a number of different places) and apply a fixed formula to get the current total number of rewards claimed so far. This number would be exact because there is no possibility of varying from the predetermined reward schedule (and there is no other way of conjuring bitcoins into existence other than mining).</p>

<p>The following is a simple Python function which calculates the total bitcoins in existence at any time given the block height. It should be straightforward to translate to PHP.</p>

<pre><code>def total_bitcoins(height):
    total = 0
    reward = 50
    while height &gt;= 210000:
        total += reward * 210000
        height -= 210000
        reward /= 2
    total += reward * height
    return total
</code></pre>

<p><a href="https://gist.github.com/ghewgill/9821866" rel="nofollow">https://gist.github.com/ghewgill/9821866</a></p>

CC BY-SA 3.0
2014-03-27T23:34:40.747Z
2014-03-27T23:58:15.330Z
2014-03-27T23:58:15.330Z
Greg Hewgill
<p>I'm running a Bitcoin blog and I'd love to display a ticket of the total amount of Bitcoins in existence. Unfortunately, I'm not sure where I can find a JSON feed for this (now that MTGOX is gone). Is there something like this I can utilize?</p>

<development><php>
How can I find out how much bitcoin is in existence with PHP?
Michael A
# How can I find out how much bitcoin is in existence with PHP?

(Asked by: username_0 on 2014-03-27)

I'm running a Bitcoin blog and I'd love to display a ticket of the total amount of Bitcoins in existence. Unfortunately, I'm not sure where I can find a JSON feed for this (now that MTGOX is gone). Is there something like this I can utilize?

**Tags:** development, php


---

## 2 answers

### Answer by username_1 on 2014-03-27. Score: 4

Take a look at [this](https://blockchain.info/api/charts_api), its the blockchain.info api. it gives a json feed for many things.


---

### Answer by username_2 on 2014-03-27. Score: 2

The number of bitcoins in existence at any given time is predictable in advance. To get an approximate number, you just need to look it up in a table based on today's date. The Bitcoin wiki has one at Controlled supply.
To get the precise number of mined bitcoins at any given moment, you would take the current block height (available from any of a number of different places) and apply a fixed formula to get the current total number of rewards claimed so far. This number would be exact because there is no possibility of varying from the predetermined reward schedule (and there is no other way of conjuring bitcoins into existence other than mining).
The following is a simple Python function which calculates the total bitcoins in existence at any time given the block height. It should be straightforward to translate to PHP.
def total_bitcoins(height):
    total = 0
    reward = 50
    while height >= 210000:
        total += reward * 210000
        height -= 210000
        reward /= 2
    total += reward * height
    return total

https://gist.github.com/ghewgill/9821866


---

