Python script to calculate when all coins will be mined shows 2060 and not 2140? Why is this?


My python script is below, it seems that it is calculating all of the coins to be mined by 2060, as it reaches 21million but I see otherwise here https://en.bitcoin.it/wiki/Controlled_supply shows 2140.

def btcCalc():
reward = 6.25
supply = 18375001
maxsupply = 21000000
year = 2020
count = 0
i = 0
while supply <= maxsupply:
print(reward)
print(supply)
if count < 4:
annualcoins = reward * 52560
supply = supply + annualcoins
year = year + 1
count = count + 1
print(“Total supply is ” + str(supply) + ” and year is ” + str(year))

if count == 4:
count = 0
reward = reward / 2

btcCalc()

I have tried changing reward, supply, and maxsupply to int() but that makes it go far too long, past year 2140 which is when all bitcoin will be mined. Bitcoin only goes up to 8 decimal places.

View Reddit by ultimatevertView Source