The place is the bitcoin supply code is the 21 million exhausting cap acknowledged?
Nowhere, as a result of there is not really a 21 million cap rule.
The related code is this:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
// Drive block reward to zero when proper shift is undefined.
if (halvings >= 64)
return 0;
CAmount nSubsidy = 50 * COIN;
// Subsidy is minimize in half each 210,000 blocks which can happen roughly each 4 years.
nSubsidy >>= halvings;
return nSubsidy;
}
// consensusParams.nSubsidyHalvingInterval = 210000.
It computes the utmost subsidy a miner can declare at a given block peak, and this perform successfully controls Bitcoin’s inflation schedule. The customarily-stated “21 million” restrict is simply the approximate results of summing all cash this perform permits to be introduced into circulation, over all time.
The code, briefly, implements the next:
- The primary 210000 blocks (roughly 4 years) permit as much as 50 BTC subsidy every.
- Then 210000 blocks with 25 BTC every
- Then 210000 blocks with 12.5 BTC every
- …
- After 10 halvings, the subsidy turns into 0.04882812 BTC fairly than 0.048828125 (which would wish half-satoshi precision, and the code makes use of integer division which rounds down).
- After 33 halvings, the subsidy turns into 0.
If one sums up all of the subsidy values over all halvings, the result’s 20999999.9769 BTC, not 21000000 BTC. Although, as a result of varied trivialities, that is additionally not the actual restrict; this reply goes into extra element.
Now, the code does additionally include this fixed:
/** No quantity bigger than this (in satoshi) is legitimate.
*
* Be aware that this fixed is *not* the overall cash provide, which in Bitcoin
* at present occurs to be lower than 21,000,000 BTC for varied causes, however
* fairly a sanity test. As this sanity test is utilized by consensus-critical
* validation code, the precise worth of the MAX_MONEY fixed is consensus
* important; in uncommon circumstances like a(nother) overflow bug that allowed
* for the creation of cash out of skinny air modification might result in a fork.
* */
static constexpr CAmount MAX_MONEY = 21000000 * COIN;
which, because the remark explains, doesn’t really management the overall provide (as that is fairly the results of summing all of the subsidy), however is used as a sanity test in lots of locations.