The "MAX_MONEY" constant in Bitcoin's code represents a sanity check limit, not an exact hard-coded cap on the total supply of bitcoins. Here are the key points:
  • The MAX_MONEY constant is set to 21,000,000 * COIN (where COIN = 100,000,000 satoshis), which equals 2,099,999,997,690,000 satoshis or approximately 20,999,999.9769 BTC.[1][2]
  • This constant is used as a sanity check in consensus validation code to prevent integer overflows or other errors that could create bitcoins out of thin air.[1][2]
  • However, the actual maximum supply of bitcoins is determined by the mining subsidy schedule defined in the GetBlockSubsidy() function, which halves the block reward roughly every 4 years.[3]
  • Summing up all the mining rewards over time until the last halving (around 33 halvings) results in a total supply of approximately 20,999,999.9769 BTC, slightly less than the MAX_MONEY constant.[1][3]
  • So while MAX_MONEY is an important sanity check, it is not the exact rule that caps Bitcoin's supply. The mining subsidy schedule is what effectively determines the maximum supply over time.[1][3]
In essence, the MAX_MONEY constant provides an upper bound for validation purposes, while the precise maximum supply emerges from the diminishing block reward schedule hardcoded into Bitcoin's protocol rules.[1][2][3]
Sources [1] Bitcoin Optech Newsletter #270 https://bitcoinops.org/en/newsletters/2023/09/27/ [2] Where is the bitcoin source code is the 21 million hard cap stated? https://bitcoin.stackexchange.com/questions/119475/where-is-the-bitcoin-source-code-is-the-21-million-hard-cap-stated [3] Total coin supply, how it works, and what the code means? https://stackoverflow.com/questions/47876960/total-coin-supply-how-it-works-and-what-the-code-means [4] The 21 Million Bitcoin Myth: Understanding the Code Behind It https://blog.bitwage.com/21-million-bitcoin-myth/ [5] Technical question about Bitcoin code regarding fixed supply of 21 ... https://www.reddit.com/r/Bitcoin/comments/gcmws5/technical_question_about_bitcoin_code_regarding/?rdt=36630
21 sats \ 0 replies \ @Lumor 15 Jun
Your MAX_MONEY math is off. LLM much?
reply