I have seen everywhere that the total BTC supply is permanently capped at 21 million. I understand blockchain, cryptography, SHA256, etc... generally, but where/what is actually capping the supply at 21 million? Looking this up online usually leads to generic 'its written in the code' and this stack question seems to point to the code, but I do not understand it. Is the supply cap really just some hard code in the original protocol? Is this modifiable?
2 Answers
What actually caps Bitcoin's supply at 21 million?
Consensus rules
The supply is capped by the so-called consensus rules that every Bitcoin node enforces.
New coins are minted as block rewards by miners. Every node that receives the new blocks checks that the block reward is not greater than the current limit per block. Any block that exceeds this limit is deemed invalid by every node that receives it and is discarded and not passed on. Any node that passes on a block with an excessive mining reward is in danger of being ostracized by other nodes.
Nodes are made to distrust any other nodes that seem to be acting contrary to the established rules.
One of those consensus rules is the halving of mining rewards every four years approximately and it is this halving that causes the total supply to converge toward 21 million.
Note that many Bitcoin terms are arguably poorly chosen and misleading. This is one of them. These rules are Bitcoin rules or hard rules. Don't get hung up on the word consensus or dictionary definitions of that word.
Is this modifiable?
Rule changes can result in a fork. This can result in the creation of an altcoin. An altcoin is a cryptocurrency that is distinct from Bitcoin and seen by some as an alternative to it (hence the alt in altcoin). One example would be the altcoin "Bitcoin Cash" (BCH) which is the result of rule changes made by a small faction of Bitcoin (BTC) users. The proponents of this change had originally hoped that almost the whole Bitcoin community would adopt their rule changes. If they had succeeded, Bitcoin would now be using the rules of Bitcoin Cash and Bitcoin Cash would not exist. They failed in that original goal.
It is possible to make some rule changes in a way that doesn't trigger the distrust of other nodes that are still using the older rules.
This is a bigger topic than I can cover here but there will be good answers to existing questions on this subject:
- What is a soft fork? What is a hard fork? What are their differences?
- Would it be possible to create a soft-fork for reducing miner reward?
- How do we know which soft-forks were implemented using User-Activated Soft Fork or Miner-Activated Soft Fork?
Tangentially related questions
There are many theories on this, but I'm inclined to believe that Satoshi wanted to pick the maximum number allowed in 32-bit (which is 2147483647); however Satoshi admitted in an e-mail to Mike Hearn that the value was somewhat arbitrary as well.
Below is a visual of that 32-bit int max.
-
4That number (max 32-bit) is 2.1 billion, not 21 million. I'm not sure I follow your reasoning here.– chytrikDec 18, 2020 at 21:08