# This is how we know there’s only 21 Million Bitcoin

>News anchor: 21 million

>

>Jamie Dimon: Yeah really? How do you know it’s gonna stop at 21 million

​

# Why don’t we take a look at the math?

​

[Bitcoin’s Supply Formula](https://preview.redd.it/uczbuwzaw7da1.jpg?width=916&format=pjpg&auto=webp&v=enabled&s=d6de53a3c5cea17d557badaafb6671b7e9efb8f5)Let me start by explaining this in an easier way

We are gonna multiply the number of blocks (210000) by the number of coins each new block should print (50) which itself, will be divided by 2 which will be to the power of n, n being the halving we are at. So if we know that 2⁰=1, 2¹=2, 2²=4, and so on, we could conclude that 50/2⁰ = 50/1 = 50, 50/2¹ = 50/2 = 25, and so on, which all on itself means that at no halving we have 210000 blocks adding 50 Bitcoin to the supply and at the first halving we have 210K new blocks adding 25 and so on.

***So, let’s do this manually***

We are gonna start at 0 halvings

***210000 * (50 / 2⁰) = 10500000***

*Supply so far= 10500000*

As you can see, we already have the first half of the whole supply, may we reach 21M soon?

Lets see, why don’t we add the first halving to the supply?

***210000 * (50 / 2¹) = 5250000***

*Supply so far= 15750000* [which is the result of: 10500000 + 5250000]

Wait, this is not the same, this is half of what we initially got, what if we add another halving to the supply? We might get closer

**210000 * (50 / 2²) = 2625000**

*Supply so far= 18375000* [15750000+2625000]

Ok, so we are getting closer, but at the same time we can’t reach the goal, we have in Bitcoin’s supply an example of the [Zeno’s Paradox](https://en.wikipedia.org/wiki/Zeno%27s_paradoxes) where whenever you get to the half of a goal you can only move the half of the remaining distance.

After halving 32 we will arrive at a supply of 20,999,999.9769 Bitcoin, not 21M as we were promised but pretty close, we could continue doing this until the 32nd halving (the last one), but then this post would be too long, so here’s a simple [Bitcoin Supply Calculator](https://github.com/ndsvw/Bitcoin-Supply-Calculator) for you to use.

​

# Now that we have the math all figured out, let’s check the code

​

I won’t enter too much into details here because I’ve never been that good with code, but I’ll do my best to explain this as humanly as I can.

​

[Block of code enforcing 50/2ⁱ](https://preview.redd.it/5i5x2gefw7da1.png?width=1659&format=png&auto=webp&v=enabled&s=7278bd736734d425cb16acb5fdd7c5954dafdb41)CAmount nSubsidy = 50 * COIN;

What this line does is multiplying the number of the parameter COIN by 50, COIN being a binary representation of 100000000 which is number of Sats, the smallest unit the Bitcoin Network recognizes and the smallest divisible unit of a Bitcoin, being this number in binary: *100101010000001011111001000000000.*

​

nSubsidy >>= halvings;

This line is a “bitwise right shift” all it does is an arithmetic shift to the right by one bit, or simply put, divides by two in binary.

What this does is taking the number *100101010000001011111001000000000* and remove the last number of bits, being the numbers of bits, the same number of the halving we are at the moment, for this example imagine you have a dot at the end of the number and everything that moves after said dot is removed.

If nSubsidy is 0 our binary number stays the same

*100101010000001011111001000000000 = 5,000,000,000 units of COIN*

If nSubsidy is 1, we move one bit to the right, we remove the last bit by moving the whole number one space to the right, the last 0 being now after the dot and the rest of the number before it.

*10010101000000101111100100000000* (you can count the 0 if you want)*= 2,500,000,000 units of COIN*

If nSubsidy is 3, which is the halving we are at at the time of writing then we move 3 bits

*100101010000001011111001000000 = 625,000,000 units of COIN*This all the way to 32 where we end up we only 1 bit, and after that comes nothing before the hypothetical dot.

​

if (halvings >=64) return 0;

Is a [bug fix](https://github.com/bitcoin/bitcoin/pull/3842), the wont be 64 halvings, it just ensures that if for any reason we ever go above 64 halvings the block subsidy forces itself to 0.

​

[Block of code enforcing an interval of 210K blocks for every reduction of the subsidy](https://preview.redd.it/jq8sqtliw7da1.png?width=606&format=png&auto=webp&v=enabled&s=8368592a26a6180a5cde17889a3a704dfc392f65)consensus.nSubsidyHalvingInterval = 210000;

This line simply ensures the halving happens every 210000 blocks.

​

If you want a more detailed explanation you could check [Unchained Capital’s post about it](https://unchained.com/blog/bitcoin-source-code-21-million/).

​

>But they can update the code to remove the limit

There’s a [whole book](https://www.goodreads.com/book/show/57429394-the-blocksize-war) on how a group of people tried to double the size of the blocks every two years and they couldn’t, all they did was fork the network and now it’s [being delisted by one of the biggest exchanges](https://fortune.com/crypto/2022/11/30/coinbase-delisting-xrp-bitcoin-cash-ethereum-classic-low-usage-wallet-crypto-winter/) for the lack of users. Nobody with at least two fingers of forehead will move to a version of Bitcoin where inflation is re-introduced when we all know the consequences of inflation.

[Original post](https://frverdeja.substack.com/p/this-is-how-we-know-theres-only-21) on Substack ⚡
!lntip 1337

Or simply look at this: [https://docs.google.com/spreadsheets/d/1jsha1YMsKxxmwx03cjL91DPVR94S5kGoQrq1C_sLnpA/edit?usp=sharing](https://docs.google.com/spreadsheets/d/1jsha1YMsKxxmwx03cjL91DPVR94S5kGoQrq1C_sLnpA/edit?usp=sharing)

It also takes the precision loss into account (1 satoshi being the smallest unit and fractions being truncated to the lower whole number due to it being an integer and not a decimal).

It won’t be 21 Million satoshi due to the precision loss. 20’999’999.9769 BTC is the theoretical maximum. But even that is not possible anymore as miners forfeit some of the subsidy. [For example this one that forfeited the entire 12.5 BTC subsidy of the block it mined.](https://bitcoinexplorer.pasukaru.me/tx/9bf8853b3a823bbfa1e54017ae11a9e1f4d08a854dcce9f24e08114f2c921182@501726)

To me, the thing about the halving is it’s in the public domain. That is, you can go look at the blockchain to see it’s actually happening and that’s what counts. Don’t trust, verify. No need to look at the code.

Jamie Demon’s comments will age like milk.

He is an evil fraudster and has some karma coming to him.

Great post!

!lntip 1000

These are the kind of posts that this sub needs more of.

Damn dude. This is front page reddit material. Good work!!! Mods, add to sidebar!

I did hear Satoshi had wanted something more akin to BTC Cash, but that may have been propaganda I was reading. Any idea?

!lntip 500