Bitcoin Forum

Other => Beginners & Help => Topic started by: fratrad on January 30, 2019, 10:24:10 AM



Title: Find out max supply just from github source code
Post by: fratrad on January 30, 2019, 10:24:10 AM
Hi, is there a way how I can find out the max supply of on altcoin (SHA256) just from searching in the source code?

https://github.com/Infernoman/C-Bit

Thanks in advance


Title: Re: Find out max supply just from github source code
Post by: mocacinno on January 30, 2019, 10:30:22 AM
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 ;) 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) :)


Title: Re: Find out max supply just from github source code
Post by: fratrad on January 31, 2019, 11:03:35 AM
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 ;) 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) :)

Thank you, I calculated the answer  :)