Pay With Lightning pill shaped image with orange Bitcoin Lightning logo.

Bitcoin T-shirts

Pay With Bitcoin pill shaped image with orange Bitcoin logo.

Bitcoin T-shirts

Pay With Lightning pill shaped image with orange Bitcoin Lightning logo.
Pay With Bitcoin pill shaped image with orange Bitcoin logo.

How Is The 21 Million Bitcoin Supply Limit Enforced? – Athena Alpha

From the article How Many Bitcoins Are There?

Interestingly, there is no actual “21 million supply limit” in the Bitcoin Core code. Instead, the total supply of bitcoin is limited to just under 21 million bitcoins by just 6 lines of code shown below that calculates the block subsidy. This Bitcoin Core code is located in the “validation.cpp” file under bitcoin/src/.

What it does is figure out how many Bitcoin Halving events have happened, then calculates the size of the block subsidy that’s given to miners for that block. Currently there have been 3 halvings and the block subsidy is 3.125 BTC. Due to this specific code, there will only ever be a total of 33 halvings.

GetBlockSubsidy Bitcoin-Core code (Bitcoin Monetary Policy):

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 which will occur approximately every 4 years.
    nSubsidy >>= halvings;
    return nSubsidy;
}

We can also easily use it to calculate the exact amount of bitcoin mined every day, for the rest of all time. As a result, the total bitcoin supply is simply the sum of all these mined bitcoins.

Leave a Comment

Bitcoin Resources

The Bitcoin Standard

by Saifedean Ammous

Bitcoin Whitepaper

by Satoshi Nakamoto

Not Your Keys, Not Your Coins

by Andreas M. Antonopoulos

Pay With Lightning pill shaped image with orange Bitcoin Lightning logo.
Pay With Bitcoin pill shaped image with orange Bitcoin logo.