This is how we know there's only 21 Million Bitcoin

This is how we know there's only 21 Million Bitcoin
fverdeja
0
0

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

Let me start by explaining this in an easier way

We are gonna multiply the number of blocks (210,000) 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 210,000 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

210,000 * (50 / 2⁰) = 10,500,000

Supply so far= 10,500,000

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?

210,000 * (50 / 2¹) = 5,250,000

Supply so far= 15,750,000 [which is the result of: 10,500,000 + 5,250,000]

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

2100,00 * (50 / 2²) = 2,625,000

Supply so far= 18,375,000 [15,750,000+2,625,000]

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 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 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ⁱ

CAmount nSubsidy = 50 * COIN;

What this line does is multiplying the number of the parameter COIN by 50, COIN being a binary representation of 100,000,000 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, 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

consensus.nSubsidyHalvingInterval = 210000;

This line simply ensures the halving happens every 210,000 blocks.

If you want a more detailed explanation you could check Unchained Capital's post about it.

But they can update the code to remove the limit

There's a whole book 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 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 on Substack ⚡