0

I'm looking for the historic circulated supply of Bitcoin. I'm aware I can get the current supply by creating my own node. But I need the supply at a given date.

Does anyone know of an API to get it.

johnny 5
  • 103
  • 3

1 Answers1

2
  1. gettxoutsetinfo will return the current supply in total_amount so it doesn't help. getblockstats doesn't return supply info for the block.

  2. Bitcoinvisuals has the supply chart and you can move the cursor over the chart to know supply at any given date in past.

supply

  1. Since we know block rewards (new coins added to supply) and they are reduced to half after every 210,000 blocks, we can also write a simple script to know the supply at any given block:
def btcSupplyAtBlock(b):
    if b >= 33 * 210000:
        return 20999999.9769
    else:
        reward = 50e8
        supply = 0
        y = 210000  
        while b > y - 1:
            supply = supply + y * reward
            reward = int(reward / 2.0)
            b = b - y
        supply = supply + b * reward
        return (supply + reward) / 1e8

if name == "main": block = 1000000 print(btcSupplyAtBlock(block))

Source: https://github.com/ndsvw/Bitcoin-Supply-Calculator

  1. There are lot of third party APIs available like coinmetrics to achieve the same.

In 3 the script will not include lot of exceptions mentioned in this answer by sipa: https://bitcoin.stackexchange.com/a/38998/