Playing around with Bitcoin halving math

12 replies 132 views
eric2021Member
Posts: 10 · Reputation: 82
#1Nov 26, 2021, 09:45 AM
So I stumbled upon a response from hugeblack yesterday where he included a pic of the Bitcoin halving formula as part of a discussion. The formula caught my eye, and I got curious about how the calculations work for Bitcoin halving that happens roughly every four years. Interestingly, this formula also helps to determine the total supply of Bitcoin. The image I’m sharing below is pretty similar to what hugeblack posted. Let me break down the essential parts of the formula before I dive deeper. The number 2 is the factor by which the rewards decrease with each halving. The 10^8 represents the smallest Bitcoin unit, which is called a Satoshi, like 0.0000012. The 210K refers to the blocks that need to be mined before the halving kicks in, and 50 is the initial reward amount. The variable i under the sigma symbol stands for each halving instance, starting from 0 and going up to 32, for a total of 33 halvings. My goal is to find the total Bitcoin supply, but to do that, I’ll need to calculate it 33 times. For instance, for my first calculation, I’ll set i to 1, which means about 10,500,000 Bitcoins will be mined in the first halving year. For my next trial, with i as 2, I’ll get around 5,249,999.998 Bitcoins mined in the second halving year. I’ll keep going like this until my final calculation, where i is 32, which will give me 2.444721758×10^-3. Time to work through all 33 calculations!
8 Reply Quote Share
proto2013Member
Posts: 1 · Reputation: 92
#2Nov 26, 2021, 02:11 PM
Yes, it is slightly different from the one hugeblack shared: In the end you arrive at the same result cause the 108 variable which appears twice cancels itself out. But using the first formula you can easily solve for the total supply. You also do not have to replace i with 1,2,3 and on, solving for each halving period, that invalidates the formula. Using it exactly as it is will give results for the entire 32 halvings we would have. - Jay -
3 Reply Quote Share
SwiftNodeMember
Posts: 38 · Reputation: 224
#3Nov 26, 2021, 07:20 PM
You did the calculations wrongly. For example, 5,250,000 BTC were generated in the second period. I don't know how you got the 5249999.998 BTC. The total number of bitcoins will be finally 20999999.9769 With doing do, the result would be 21,000,000 and that's not accurate. That's because we can't have more than 8 decimal places for each bitcoin.
1 Reply Quote Share
eric2021Member
Posts: 10 · Reputation: 82
#4Nov 27, 2021, 09:58 AM
21,000,000 is an integer and does not contain any decimal place. Like I said earlier, 21K is an estimated value.
4 Reply Quote Share
SwiftNodeMember
Posts: 38 · Reputation: 224
#5Nov 27, 2021, 12:28 PM
I was referring to your paper where x=2 and I thought you meant the second period by x=2. I don't understand what's the use of calculating the sum from x=2 to x=32. Yes, 21,000,000 doesn't have any decimal point and I know that. I was referring to the block rewards. For example, after the 10th halving, 0.048828125 BTC should be generated in each block and that will be rounded down to 0.04882812 BTC. Visit this for accurate numbers: https://en.bitcoin.it/wiki/Controlled_supply
3 Reply Quote Share
eric2021Member
Posts: 10 · Reputation: 82
#6Nov 27, 2021, 12:54 PM
I was a little bit crazy about it . I actually stated it that "it's unhealthy to take such a long step", but i actually enjoyed it  .
4 Reply Quote Share
ryanprotoMember
Posts: 24 · Reputation: 217
#7Nov 29, 2021, 08:44 AM
That wikipage claims But this is what global gold production actually looks like: Over bitcoin's lifetime, Gold's emission much more resembles a fixed rate than an exponentially decreasing one.
1 Reply Quote Share
l3dg3r365Member
Posts: 2 · Reputation: 99
#8Nov 29, 2021, 02:56 PM
You missed one important factor: altcoins. Each serious altcoin in the crypto world is just another abuse of 21 million coins limit. If you take the whole crypto market, and you find a point in time, where Bitcoin have for example 50% domination, then you can assume, that in practice, we have 42 million coins, but just half of them are handled off-chain. And no, it is not like comparing gold with silver or cuprum, because you can copy-paste a lot of coins from one chain into another, and really "turn gold into lead" and vice versa. And it is more than just Escrow transactions, described by Satoshi. If you have opcodes like OP_CHECKSIGFROMSTACK, then you can handle signatures from other chains in a trustless way, and only one chain needs that feature, to successfully handle it on both sides.
1 Reply Quote Share
Posts: 20 · Reputation: 216
#9Nov 29, 2021, 06:53 PM
The sum to infinity is correct (though the Bitcoin Core code actually limits it to 64 epochs for practical reasons). However, the amount of each subsidy is truncated because it is an integer, and the amount goes to 0 after the 33rd epoch. That is why the actual maximum supply is slightly less than 21 million BTC. 50 * 108 is important because of the truncation. The final division by 108 converts from satoshis to BTC. BTW, in practical terms there are 33 halvings. The last sets the subsidy to 0.
1 Reply Quote Share
eric2021Member
Posts: 10 · Reputation: 82
#10Nov 29, 2021, 07:24 PM
Really glad I got the sum to infinity right. I think my calculator performed the truncation directly when I solved for the entire 33 halving directly, but the decimals were revealed when I took my time to calculate for each value for every halving year.
1 Reply Quote Share
Posts: 20 · Reputation: 216
#11Nov 29, 2021, 08:48 PM
It is likely that the values were not exact because your calculator does not have sufficient precision to represent the values exactly.
3 Reply Quote Share
alex.gw31Member
Posts: 33 · Reputation: 218
#12Dec 1, 2021, 09:02 AM
It could simply be a rounding error introduced by imprecise floating point arithmetic on the hardware.
5 Reply Quote Share
SwiftNodeMember
Posts: 38 · Reputation: 224
#13Dec 1, 2021, 09:42 AM
OP calculated the sum of series 210,000*50/(2^x) from x=2 to x=32 and got 5249999.998 for that. That's correct with three decimal places precision. I just calculated that with python and got 5249999.997555278. First I thought that by x=2 OP meant the second halving period.
1 Reply Quote Share

Related topics