Post
Topic
Board Beginners & Help
Merits 5 from 4 users
Re: Find out max supply just from github source code
by
mocacinno
on 30/01/2019, 10:30:22 UTC
⭐ Merited by OgNasty (2) ,mk4 (1) ,o_e_l_e_o (1) ,pooya87 (1)
https://github.com/Infernoman/C-Bit/blob/73bc5652564d344af6847eefde6d386225d4ad02/src/chainparams.cpp#L73
Halving interval = each 210.000 blocks

https://github.com/Infernoman/C-Bit/blob/73bc5652564d344af6847eefde6d386225d4ad02/src/chainparams.cpp#L81
Average time between 2 blocks = 60* 10 seconds (10 minutes)

https://github.com/Infernoman/C-Bit/blob/73bc5652564d344af6847eefde6d386225d4ad02/src/main.cpp#L1729
subsidy = 500 coins

The rest should be simple math... You start with a block reward of 500, the average time between blocks should be ~10 minutes and the block reward halves every 210.000 blocks.

Hint: bitcoin has a max supply of 21.000.000 BTC (slightly less), and started with a block reward of 50 BTC Wink It also halves every 210.000 blocks and has an average time between blocks of 10 minutes

Last but least, this line is also interesting:
https://github.com/Infernoman/C-Bit/blob/73bc5652564d344af6847eefde6d386225d4ad02/src/main.cpp#L1726
It tells you how many halvings before the subsidy will return 0 (even if the subsidy is > 0 at that time) Smiley