How does the bitcoin source code define its 21 million cap?
Many of bitcoin’s staunchest critics have expressed doubt about its 21 million cap, but perhaps the most mindless criticism relates…,
When Satoshi Nakamoto created bitcoin, he established in its code a fixed number of bitcoin that will ever exist. Since the protocol first launched, new bitcoin have been issued on a regular basis, and the total circulating supply is still growing even today. But it will, eventually, reach its predefined cap.
We’ll explain in detail how this works below, but at the time of this writing:
To see real-time data about the total number of bitcoin in existence, visit Clark Moody’s Bitcoin Dashboard.
New bitcoin are issued as a part of the process for adding new transactions to the bitcoin blockchain. Before we can understand how this works, we must first look at how the bitcoin network verifies transactions and how miners add them to the blockchain.
The miner who wins the proof-of-work contest gets to add a new block of transactions to the blockchain and receives the “block reward” as payment for their services. The block reward consists of two components:
Block subsidies, paid out via coinbase transactions, are the sole means of introducing new bitcoin. For the first four years of bitcoin’s existence, the block subsidy was 50 bitcoin per block.
As expressed in the equation below, the block subsidy halves after every 210,000 blocks (i.e., approximately every four years). Eventually, the block subsidy falls to zero, as we’ll explain below, and new transactions will be added to the blockchain with miners no longer receiving a block subsidy, only transaction fees.
Satoshi himself wrote about the block subsidy eventually ending, as well as referenced the finite limit of 21 million coins, on the BitcoinTalk forum in 2010:
Right. Otherwise we couldn’t have a finite limit of 21 million coins, because there would always need to be some minimum reward for generating. In a few decades when the reward gets too small, the transaction fee will become the main compensation for nodes. I’m sure that in 20 years there will either be very large transaction volume or no volume.
In this context, Satoshi referred to miners performing proof of work when he said “nodes.” This quote is notorious for two reasons: it is a rare place where Satoshi stated plainly the “finite limit of 21 million”, and it speaks to a question that has permeated bitcoin since its inception: Will bitcoin be secure once the block subsidy ends?
The image below shows the section of the bitcoin code that determines its supply cap. This code defines the block subsidy included in the block reward that is paid to miners for winning the proof-of-work contest. This is vital to determining bitcoin’s fixed supply because, as noted above, all new bitcoin originate from block subsidies paid to miners.
We’ve also done a complete breakdown, line by line, of how 21 million is implicitly specified in the bitcoin code.
To understand how the code defines 21 million, there’s one more term you need to know. Halvings were established in the bitcoin code as a way to gradually, predictably, and consistently issue bitcoin over time. The issuance of new coins begins at a fixed rate and slowly reduces until the distribution of coins reaches its cap.
You don’t have to be able to read each line of code above to understand the basic gist: the code defines when the halvings occur and how the block subsidy is calculated. The 21 million limit is then implicitly defined as a result of the issuance schedule, not explicitly stated as a variable in the code:
Sign up to be notified when we publish new blog articles.
While it is helpful to understand how bitcoin’s code calculates its total cap, the integrity of its fixed supply is not merely a function of its code. Code must be run on computers, and computers are run by people. So what stops an individual in the future from changing things in a way that benefits them personally at the expense of other bitcoin owners?
As mentioned above, incoming transactions in bitcoin are validated by nodes, which play a vital role in the bitcoin network. Validation occurs based on bitcoin’s consensus rules, which include the 21 million coin cap, and are embedded in the bitcoin code. These are agreed upon by everyone running a node, and any bitcoin received must follow the ruleset to be considered valid. If a bad actor—even a powerful, wealthy entity or nation—were to try to modify the rules selfishly or otherwise cheat, their non-conforming transaction(s) would be immediately rejected by the broader network.
Outside of the code and node governance described above, another way that bitcoin users can help enforce the 21 million hard cap is through good old market pressure.
While highly unlikely, it is theoretically possible that a portion of the bitcoin userbase might one day decide they’d like to deploy a controversial change to the ruleset to increase the bitcoin supply.
If this happened, they would likely meet resistance from a significant portion of bitcoin users that prefer to keep the hard cap. Each user would have the option to follow the new rules or stick with the old rules on their node or wallet software. This could result in a chainsplit—two blockchains emerging from the original one.
Users could trade coins from one chain for coins on the other. All other things being equal, the scarce version of bitcoin would be preferable for bitcoin users. Because scarcity underpins long-term value, anyone saving in bitcoin would rationally be incentivized to continue collecting as much limited-supply bitcoin as possible, even trading the unlimited-supply “bitcoin” for it.
This chain of events is unlikely to play out simply due to the threat of it happening. Bitcoin users don’t have to engage in these kinds of trades—just the threat that they would is sufficient to discourage someone from trying to make a change to the supply schedule.
Due to its finite scarcity, bitcoin’s attractiveness as money increases over time, which draws more adoption. More adoption means more nodes and wallets, which leads to more decentralized enforcement of the existing ruleset. The combination of these factors sets in motion a virtuous loop driven by participants’ self-interest to preserve and defend the critical aspects that attracted them to bitcoin in the first place, particularly its 21 million coin cap.
Parker Lewis explains in his essay, Bitcoin Obsoletes All Other Money, that the growing number of participants in bitcoin’s network serve to bolster its security and more credibly enforce its 21 million coin supply:
Recognize that there is nothing about a blockchain that guarantees a fixed supply, and bitcoin’s supply schedule is not credible because software dictates it be so. Instead, 21 million is only credible because it is governed on a decentralized basis and by an ever increasing number of network participants. 21 million becomes a more credibly fixed number as more individuals participate in consensus, and it ultimately becomes a more reliable constant as each individual controls a smaller and smaller share of the network over time. As adoption increases, security and utility work in lock-step.
For a deep dive on the importance of bitcoin’s scarcity and how the growth in bitcoin adoption further enforces its 21 million coin cap, see Parker Lewis’ Gradually, Then Suddenly series.
Bitcoin is the ultimate asset for long-term savings, and its limited supply makes it a powerful hedge against inflation. If you’re saving bitcoin for the long-term, it’s worth considering saving in an IRA, which ensures your bitcoin gains are tax-advantaged. To fund your IRA, you can easily transfer funds from a prior employer plan or start a new IRA from scratch—with Traditional, Roth, and SEP IRAs available. Sign up for an upcoming webinar to learn more about ramping up the power of your bitcoin savings today with an Unchained IRA.
Many of bitcoin’s staunchest critics have expressed doubt about its 21 million cap, but perhaps the most mindless criticism relates…Ted Stevenot, Stephen Hall
When Satoshi Nakamoto created bitcoin, he established in its code a fixed number of bitcoin that will ever exist. Since…Ted Stevenot
Originally published in Parker’s dedicated Gradually, Then Suddenly publication. Bitcoin is often described as a hedge, or more specifically, a…Parker Lewis