Everyone (except the Keynesian ‘economists’) would agree that it should not be easy to increase the total supply of money. We have seen what hyperinflation did to Weimar Germany and more recently Zimbabwe, Venezuela, and Argentina. Hyperinflation is an extreme example, but even, just inflation itself is theft. It eats away at your money, the fruits of your labor, stealing the time and energy that you have already spent.

Bitcoin is decentralized, there is no intermediary, no government, bank, institution or entity that can control it. So who controls the supply of bitcoin? The Bitcoin network follows a set of rules called *consensus rules* that are enforced by each node (a computer running Bitcoin software). Together these rules ensure that the total supply of Bitcoin will never exceed 21 million. Now, you might ask, but how?

## Blocks: The Heartbeat of Bitcoin

Miners put Bitcoin transactions into a block in an attempt to ‘settle’ them. In case of a bank or any other intermediary, the transactions are recorded in some sort of database (often known as the “ledger”) to keep track of balances. But we know that Bitcoin does not have any intermediaries. While a bank can write to the ledger due to it being an intermediary, Bitcoin is decentralized, which means that writing to Bitcoin’s ledger should be permission-less. Anyone should be able to participate in that process.

Miners mine bitcoin. They have to spend real world energy (electricity) to try to ‘mine’ a block. Anyone can become a miner by running some equipment with appropriate software. Miners essentially turn electricity into bitcoin. Let’s try to understand this better by considering how gold is mined.

The miners dig for gold using all sorts of equipment and then use even more equipment to extract the tiny pieces of gold spread all over. This requires an immense amount of energy, mainly fuel used by the equipment. So you could think of gold miners as using energy to extract gold. Without spending that energy, they will not be able to get that gold out of the ground. Interestingly, the deeper they dig a mine for gold, the more energy they would need to mine the same amount of gold. It gets harder to mine gold the deeper you dig because it requires more energy and time.

Bitcoin is a digital network though. Mining is emulated by requiring the miners to solve a computationally hard problem. What that means is that there is no known way to solve that problem except to keep trying random answers. And guessing requires spending energy. When one of the miners finds a random answer that is correct, they declare to the rest of the network that they have found a new block. Every new block generates new bitcoin. The miner who finds the block gets the block reward and the fees paid for all the transactions included within that block.

Bitcoin miners put transactions in blocks and try to solve a computationally hard problem in order to mine that block. Each block generates new bitcoin (the block reward) that goes to the miner. The block reward is a compensation for the miner for spending real world energy. In a way, you could say that the Bitcoin network is backed by real-world energy.

## Halving

When the Bitcoin network first began in early 2009, the reward for mining each block was 50 BTC. On average, each block is mined every 10 minutes. After every 210,000 blocks (~4 years, aka the “halving epoch”) are mined, something called “the halving” occurs. After the halving, the Bitcoin block reward is halved. So for instance it started with 50 BTC, then in 2012, it halved to 25 BTC. Here is the block reward at different times starting at the very beginning:

Halving Epoch | Date | Block Height | Block Reward |

0 | 03 Jan 2009 | 0 | 50 BTC |

1 | 28 Nov 2012 | 210,000 | 25 BTC |

2 | 09 July 2016 | 420,000 | 12.5 BTC |

3 | 11 May 2020 | 630,000 | 6.25 BTC |

4 | ~ April 2024 | 840,000 | 3.125 BTC |

Since block rewards are how new bitcoin are generated, we can use the table to come up with a formula to calculate the exact supply of bitcoin. Just like a dollar can be divided into 100 cents, 1 BTC consists of 100 million satoshis. So starting from the first block, since we know how many bitcoin are generated by each block and that block reward halves every 210,000 blocks, we can check how long would it take until the last satoshi is generated. In other words, if we start with 50 BTC block reward, how many times to we halve that until we get something that is greater than or equal to 1 satoshi. A halving event divides the current block reward by 2. So the question becomes, how many time do we divide 50 by 2 until we get something that is 1 satoshi or greater. Why 1 satoshi or greater? Because bitcoin software cannot represent anything smaller than 1 satoshi.

### Block Reward

Lets go step by step. Initially, the block reward is 50 BTC:

After two halvings, the block reward becomes 12.5 BTC. By looking at the pattern above, we can generalize the block reward in halving epoch as follows:

You can plug values of starting at 0 into the above formula and see that you get the block reward values mentioned in the table above.

### Halving Count

We have seen that each block generates new bitcoin. We have also seen that after every 210,000 blocks, the number of newly generated bitcoin is halved. To calculate the total supply of bitcoin, we could keep adding the block reward start at block 0. However, we need to stop the addition at some point. How do we know when to stop? Since the block reward is halved every 210,000 blocks, there will come a point when the block reward will be equal to the smallest unit of bitcoin, a satoshi. So, essentially we need to compute the number of halvings it would take to go from the initial block reward of 50 BTC to the last block reward of 1 satoshi.

Let’s go step by step like before. If we know the starting block reward is 50 BTC and we want to compute the number of halvings it would take to go from a block reward of 50 BTC to say 12.5 BTC, we could do the following:

We can see that the power of 2 gives us the number of halvings that are required to go from a block reward of 50 BTC to 12.5 BTC. Now lets apply that a few more times:

We can see in the above examples that the power of two shows the number of halvings required to go from one block reward to another. Notice how the numerator in the above examples is the starting block reward (50 BTC) and the denominator is the ending block reward. Since we know that 1 BTC has 100 million satoshis, we want to find out how many halvings would it take to go from a block reward of 50 BTC to a block reward of 1 satoshi ( BTC).

This gives us a total of 32 halvings to go from 50 BTC block reward all the way down to a block reward of 1 satoshi or higher.

### Bitcoin generated in a halving epoch

Now that we know the total number of halvings, we can compute the maximum supply of bitcoin. We know that in each halving epoch the block reward is where ranges from 0 to 32. Each halving epoch has 210,000 blocks, so to get the number of BTC mined in each halving epoch, we just multiply the above by 210,000, the number of blocks in each halving epoch, and we get:

## Putting it all together

Now that we know how to calculate the BTC mined for each halving epoch, we just need to add the BTC mined across all halving epochs to get the maximum supply of bitcoin:

This is how the maximum supply of bitcoin is determined by taking the initial block reward and applying the halving rule every 210,000 blocks and then adding up everything. I hope you enjoyed this look into how the maximum supply of bitcoin is calculated.