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?


Take a look at this, its the blockchain.info api. it gives a json feed for many things.


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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