Loading...

Free Python

Python Example to Calculate Bitcoin Supply for any Block Height

Python Example to Calculate Bitcoin Supply for any Block Height

Bitcoin Total Supply
Bitcoin's total supply is capped at 21 million coins, a design choice by its anonymous creator, Satoshi Nakamoto, to introduce digital scarcity into the cryptocurrency. This finite supply is crucial because it mimics the scarcity of precious resources like gold, thereby helping to preserve the value of Bitcoin over time. Unlike traditional fiat currencies, which central banks can print without limit, Bitcoin's fixed limit prevents devaluation through excessive supply.

Bitcoin Supply Calculation
To determine the total supply of Bitcoin by block number, you can follow a straightforward calculation based on the block rewards that halve every 210,000 blocks. Initially, the reward for mining a block started at 50 bitcoins. This reward halves approximately every four years (every 210,000 blocks). By summing the total rewards from all blocks mined up to a given block number, while accounting for these halvings, you can compute the total Bitcoin supply.

The Code
The code, for example purposes, will allow you to enter any Bitcoin block number and find the total available supply at that given block number. This is valuable if you want to know what the total supply of Bitcoin was at a certain time (we provide this information via our API interface and update each daily based on the new Bitcoin block transactions. )

If you want to integrate this into your models or data, we have this viaPlus+ files and via our API interface


Live codebase Python