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.
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI'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.
gettxoutsetinfo
will return the current supply in total_amount
so it doesn't help. getblockstats
doesn't return supply info for the block.
Bitcoinvisuals has the supply chart and you can move the cursor over the chart to know supply at any given date in past.
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
In 3
the script will not include lot of exceptions mentioned in this answer by sipa: https://bitcoin.stackexchange.com/a/38998/