Total supply

Bitcoin is designed in such a manner that it has a total circulation of approximately 21 million bitcoins (20,999,999.9769 bitcoins). In the header file amount.h, there is a total supply MAX_MONEY sanity check:

Here, COIN is equal to 10^8 satoshi (the smallest Bitcoin unit). As per our design, we will set MAX_MONEY to 20,000,000 (rounded number).

Contrary to what you might think in the actual Bitcoin code, there is actually no total supply parameter that defines how many bitcoins will be generated. Nevertheless, rules are put in place that dictate how many bitcoins will be released depending on the reward and halving rate. The following Python script simulates how the total supply is deduced from the initial reward value and the halving interval. It will print out a total of 1999999.987 units:

COIN = 100 * 1000 * 1000
Reward = 10
Halving = 100000
nSubsidy = Reward * COIN
nHeight = 0
total = 0
while nSubsidy != 0:
nSubsidy = Reward * COIN
nSubsidy >>= nHeight / Halving
nHeight += 1
total += nSubsidy
print "total supply is", total / float(COIN)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset