Advanced Appendix D: The 21 Million Supply Enforcement Code
From TeachMeBitcoin, the free encyclopedia
Reading time: 1 min
Advanced Appendix D: The 21 Million Supply Enforcement Code
Where exactly is the 21 million limit enforced? In src/validation.cpp, the GetBlockSubsidy function calculates how much new Bitcoin is allowed to be created in a block.
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
// Force block reward to zero when right shift is undefined.
if (halvings >= 64)
return 0;
CAmount nSubsidy = 50 * COIN;
// Subsidy is cut in half every 210,000 blocks (approx. every 4 years).
nSubsidy >>= halvings;
return nSubsidy;
}
This simple piece of code is the most important 10 lines in the history of finance. By running your own node, you are the one enforcing this math.
☕ Help support TeachMeBitcoin
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:
Ethereum:
0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin:
bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana:
4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J