Home / Education / How Does The Bitcoin Source Code Define Its 21 Million Cap?
6 min read
easy

How Does The Bitcoin Source Code Define Its 21 Million Cap?

Last Updated
Andrew Kamsky
Last Updated

Key Takeaways

  • Satoshi Nakamoto defined Bitcoin’s ‘hard cap’ at a maximum of 21 million coins.
  • Despite its software nature, Bitcoin’s embedded source code and halving events prevents the supply of Bitcoin to surpass 21 million in total.
  • Bitcoin blocks hold transactions and offer rewards to miners, which diminish over time.
  • The 21 million cap emerges from block rewards and their systematic halving events.

Uncovering The Bitcoin Source Code

Bitcoin’s source code is anchored by sophisticated cryptography and mathematical constructs. It incorporates algorithms such as the SHA-256 hash function and the Elliptic Curve Digital Signature Algorithm (ECDSA) to safeguard transactions and uphold the integrity of the blockchain.

A standout feature is the Proof-of-Work (PoW) consensus mechanism. This framework ensures network security and transaction validation. Undertaking PoW demands intricate problem-solving, posing challenges that are labor-intensive to address but straightforward to confirm.

Bitcoins 21 Million Hard Cap

When creator of Bitcoin, Satoshi Nakamoto published the Bitcoin white paper in 2008, Satoshi set a definitive limit on the supply of Bitcoins that could ever be minted, being a total of 21 million. This supply ceiling, commonly referred to as the ‘hard cap,’ is embedded within Bitcoin’s programming and maintained by the network’s nodes.

Bitcoin Inflation Vs Time | Credit: Cypherpunk Cogitations

Can Bitcoin’s Supply Be Increased?

The quick answer is no. Bitcoin, akin to gold and real estate, has a finite supply. Its “halving” event, occurring every four years, reduces new Bitcoin production. By 2140, miners will reach the 21 million Bitcoin cap and thereafter, will earn solely from transaction fees, as block rewards become negligible.

Some argue that because Bitcoin is essentially software, its network rules can be altered without much hassle. Bitcoin’s hard cap is safeguarded by its incentive structure and governance framework. Bitcoin’s protocol design ensures that those governing its rules are motivated to maintain the cap, while those wishing to alter it lack network control. The game theory surrounding the Bitcoin network is to protect the supply cap and not alter the code.

What Is A Bitcoin Block?

A Bitcoin block is a set of data added to the Bitcoin blockchain roughly every 10 minutes containing the transactions made within the network during those 10 minutes. Each block encompasses a collection of verified transactions that took place during that time frame. Whereby, miners, or mining pools, who successfully mine a block, by solving complex mathematical equations, are awarded a “block reward.” 

Initially, this reward was 50 BTC. Yet, after 210,000 blocks mined (approximately every 4 years), this reward amount is halved. The reward currently sits at 6.25 BTC with the halving event falling in 2024. This halving process will continue to diminish the rewards and supply of Bitcoin until the reward diminishes to zero, at which point miners will solely profit from transaction fees. This system ensures a cap of 21 million Bitcoins will ever be in existence.

Understanding The Code Behind Bitcoins Supply

Bitcoin’s 21 million supply cap is not defined in a single line of code, but rather it’s a consequence of the initial block reward and the schedule of its halving events.

Here’s a breakdown of how the code works:

Block Reward

When Bitcoin was launched, the reward for mining a block was set at 50 BTC. This means that the reward given to miners for processing transactions and adding them to the blockchain was 50 BTC every 10 minutes.

Halving Events 

Every 210,000 blocks that are added to the blockchain, the block reward is halved. This event is commonly referred to as the “halving.”

Math Behind the 21 Million Cap

The summation of the series resulting from the initial reward and its subsequent halvings gives us the 21 million Bitcoin hard cap total. Here’s how:

  • Genesis block: 210,000 blocks: 210,000 x 50 BTC = 10,500,000 BTC
  • First halving: 210,000 blocks (halved reward): 210,000 x 25 BTC = 5,250,000 BTC
  • Second halving: 210,000 blocks (halved again): 210,000 x 12.5 BTC = 2,625,000 BTC
  • Third halving: 210,000 blocks (halved again): 210,000 x 6.25 BTC = 1,312,500 BTC
  • Fourth halving: 210,000 blocks (halved again): 210,000 x 3.125 BTC = 656,250 BTC
  • Fifth halving: 210,000 blocks (halved again): 210,000 x 1.56 BTC = 328,125 BTC
  • Sixth halving: 210,000 blocks (halved again): 210,000 x 0.78 BTC = 163,800 BTC
  • Bitcoin mined: This means that by the 6th halving more than 99% of Bitcoin would have already been mined.

When continuing the halving series, the total sum converges to 21 million BTC by the year 2140.

Code Implementation

The reward halving logic is embedded in Bitcoin’s source code once 21 million is hit there will be no more rewards provided to miners.

Final Halving

Eventually, the block subsidy becomes so small that it rounds down to zero after a halving event. At that point, no more new bitcoins are minted, and miners will only earn from transaction fees. This is expected to occur sometime in the year 2140. The combination of the block reward and the halving mechanism ensures that there will never be more than 21 million bitcoins in existence.

Conclusion

Bitcoin’s ingenious design, underpinned by its embedded source code, ensures a finite and predictable supply cap of 21 million coins, drawing parallels to tangible assets like gold and real estate. The logic behind this supply cap, though not stated outright in a single line of code, is the summation of the converging block rewards over the scheduled halving events. 

Despite being software, the structural incentives and governance within Bitcoin’s architecture act as robust safeguards, effectively preventing any alterations to this cap. As we approach 2140, the culmination of these halvings will ensure that Bitcoin remains a scarce and valued digital commodity, with miners then deriving their compensation purely from transaction fees. 

FAQs

What is the significance of the 21 million Bitcoin cap?

Satoshi Nakamoto, the creator of Bitcoin, set a fixed supply limit of 21 million Bitcoins. Termed as the ‘hard cap,’ it’s coded into Bitcoin’s architecture and upheld by the network’s nodes.

Can the supply of Bitcoin be increased beyond 21 million?

Though Bitcoin operates as software, altering its fundamental rules isn’t straightforward. While block subsidies decrease every four years, the embedded code prevents increasing the supply beyond the 21 million cap.

What exactly is a Bitcoin block?

A Bitcoin block is data added to the blockchain every 10 minutes, containing verified transactions from that period. Miners earn block rewards for their efforts, initially set at 50 BTC but halving every 210,000 blocks.

How does the source code ensure a 21 million Bitcoin cap?

The cap isn’t explicitly stated in a single code line. It results from the initial block reward and its scheduled halvings. By continuously halving the initial reward of 50 by half and multiplying the reward by the number of blocks, the cumulative amount converges to 21 million, ensuring that this maximum limit is never surpassed.

Was this Article helpful? Yes No