Bitcoin Forum
November 06, 2024, 03:26:59 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Testing my little math skills on Bitcoin halving formula  (Read 281 times)
Felicity_Tide (OP)
Full Member
***
Offline Offline

Activity: 210
Merit: 159


cout << "Bitcoin";


View Profile
May 28, 2024, 05:26:18 AM
Merited by vapourminer (4), ABCbits (1)
 #1

I came across hugeblack's reply https://bitcointalk.org/index.php?topic=5497911.msg64132796#msg64132796 on a thread yesterday, where he used a photo of Bitcoin halving formula as an illustration based on the question that was asked. I instantly got attracted to the formula, and was eager to perform the mathematical calculation of Bitcoin halving approximately every four years. It also turns out that this formula can also give the total supply value.

The image you see below is not different from what hugeblack shared in his reply yesterday. I will explain the key points in the formula below before moving further.

  • The value 2 represent the decreasing factor for every halving.
  • The value 10^8 represents the smallest unit of Bitcoin also known as Satoshi. E.g 0.0000012.
  • 210K is simply the number of blocks that needs to be mined before halving is triggered
  • 50 is the first amount of reward
  • the letter i below the sigma sign represents each halving. It must start with a value of 0 to 32, making the total halving to occur 33 times.

My aim was to get the total number of Bitcoin supply, but Inorder to achieve that, I will have to perform the calculation 33 times before arriving at my answer. For example, first trial will require me to replace i with 1, which will result to a value of 10500000 Bitcoin been mined for first halving year. Second trial, replacing i with 2, will result to 5249999.998 Bitcoin been mined for second halving year. I can continue to do this till my last trial which is by replacing i with 32, which will give 2.444721758×10^-3.

Trying to calculate all 33 values one after the other was so stressful and unhealthy, though I tried it. I had a thought to use other methods in carrying out the calculation, and my calculator came to mind. The images below are two different calculators that i used, which gave me an estimated value. I was able to compute the sigma sign, and also use x in place of i because my calculator does not have i.

https://www.talkimg.com/images/2024/05/27/LIwpP.jpeg


https://www.talkimg.com/images/2024/05/27/LIS3j.jpeg


I then challenged myself to perform the calculation on a paper, rather than inputting all values into the calculator to get a straight answer. The image below show my three steps.
  • Step 1 was just to evaluate by multiplying the number of blocks by the number of first reward, and then dividing both units of Bitcoin (10^8).
  • Step 2, I had to get rid of the sigma sign Since I already know that it is use to sum multiple terms. Sum of a geometric progression was used to replace the sigma sign, with a formula containing it's first term, common ratio and nth term.
  • Step 3, I finalized by getting my answer.


The image below is not that different from the one above. I had to draft this when I noticed that another solution can come from the one above. If you observe the image below, you noticed that I break down the Sum of a GP formula into two, which one part happens to be the formula for Sum to Infinity. If you compute your first term and common ratio, you will still get same 21M value as the one above, but I think this can only happen when 32 at the top of the sigma sign is changed to infinity . Unluckily for me, my calculator does not have an infinity sign, which makes it difficult to confirm.




I need to also share this. The 21M total supply is actually a calculator estimated value, and don't really follow the principles that governs the real formula itself. But that does not mean that the calculator is totally wrong. I discovered this when I decided to stress myself out, by calculating the entire halving values 33 times just by increasing my count by a factor of 1.


The image above was my rough work for each values of every halving. After taking my time to perform this calculation, I discovered that the total value does not amount to 21M, but rather 20999999.92. Each values represents the total amounts that can be mined for a particular mining period before another halving occurs.

Please note that after you've used the halving formula to get the first number of Bitcoins to be mined (10500000), any attempt to start dividing by a factor of 2 without using the proper formula, will give you a wrong value. You can try this by dividing 10500000/2, and also try it for others.

My Question:
1. What do you think about the part where I applied sum to infinity ?.

My calculations on this post are for fun purposes, but might be educational to someone. I am not certain 100% accurate, but I think racking my brain all day for Bitcoin math is quite interesting to me.

un_rank
Hero Member
*****
Offline Offline

Activity: 896
Merit: 855


- Jay -


View Profile WWW
May 28, 2024, 08:01:15 AM
 #2

The image you see below is not different from what hugeblack shared in his reply yesterday
...
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 -

██
██
██
██
██
██
██
██
██
██
██
██
██
... LIVECASINO.io    Play Live Games with up to 20% cashback!...██
██
██
██
██
██
██
██
██
██
██
██
██
hosseinimr93
Legendary
*
Offline Offline

Activity: 2576
Merit: 5668



View Profile
May 28, 2024, 09:40:11 AM
Merited by vapourminer (2), pooya87 (2), ABCbits (2), Charles-Tim (1)
 #3

After taking my time to perform this calculation, I discovered that the total value does not amount to 21M, but rather 20999999.92.
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

My Question:
1. What do you think about the part where I applied sum to infinity ?.
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.

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
Felicity_Tide (OP)
Full Member
***
Offline Offline

Activity: 210
Merit: 159


cout << "Bitcoin";


View Profile
May 28, 2024, 10:59:12 AM
 #4

After taking my time to perform this calculation, I discovered that the total value does not amount to 21M, but rather 20999999.92.
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



My Question:
1. What do you think about the part where I applied sum to infinity ?.
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.

21,000,000 is an integer and does not contain any decimal place. Like I said earlier, 21K is an estimated value.

hosseinimr93
Legendary
*
Offline Offline

Activity: 2576
Merit: 5668



View Profile
May 28, 2024, 11:27:20 AM
Last edit: May 28, 2024, 11:41:20 AM by hosseinimr93
Merited by vapourminer (2), ABCbits (1)
 #5


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.

21,000,000 is an integer and does not contain any decimal place. Like I said earlier, 21K is an estimated value.
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

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
Felicity_Tide (OP)
Full Member
***
Offline Offline

Activity: 210
Merit: 159


cout << "Bitcoin";


View Profile
May 28, 2024, 11:46:58 AM
 #6


I don't understand what's the use of calculating the sum from x=2 to x=32.

I was a little bit crazy about it Grin. I actually stated it that "it's unhealthy to take such a long step", but i actually enjoyed it  Grin.

tromp
Legendary
*
Offline Offline

Activity: 990
Merit: 1110


View Profile
May 28, 2024, 02:32:23 PM
Last edit: May 28, 2024, 03:48:52 PM by tromp
Merited by vapourminer (1), ABCbits (1), vjudeu (1)
 #7

Quote from: hosseinimr93 link=topic=5497988.msg64137227#msg64137227
Visit this for accurate numbers:
https://en.bitcoin.it/wiki/Controlled_supply
That wikipage claims

Quote
This decreasing-supply algorithm was chosen because it approximates the rate at which commodities like gold are mined.
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.

vjudeu
Copper Member
Legendary
*
Offline Offline

Activity: 898
Merit: 2236



View Profile
May 28, 2024, 07:04:26 PM
Merited by vapourminer (2)
 #8

Quote
Over bitcoin's lifetime, Gold's emission much more resembles a fixed rate than an exponentially decreasing one.
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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
odolvlobo
Legendary
*
Offline Offline

Activity: 4494
Merit: 3402



View Profile
May 30, 2024, 06:23:23 PM
Last edit: May 30, 2024, 06:35:54 PM by odolvlobo
Merited by pooya87 (2), vapourminer (1), ABCbits (1)
 #9

My Question:
1. What do you think about the part where I applied sum to infinity ?.

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.

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.

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.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
Felicity_Tide (OP)
Full Member
***
Offline Offline

Activity: 210
Merit: 159


cout << "Bitcoin";


View Profile
May 30, 2024, 09:29:51 PM
 #10

My Question:
1. What do you think about the part where I applied sum to infinity ?.

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.

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.

odolvlobo
Legendary
*
Offline Offline

Activity: 4494
Merit: 3402



View Profile
May 30, 2024, 10:59:00 PM
 #11

My Question:
1. What do you think about the part where I applied sum to infinity ?.

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

It is likely that the values were not exact because your calculator does not have sufficient precision to represent the values exactly.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7362


Top Crypto Casino


View Profile WWW
May 31, 2024, 11:04:45 AM
Merited by vapourminer (1)
 #12

After taking my time to perform this calculation, I discovered that the total value does not amount to 21M, but rather 20999999.92.
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

It could simply be a rounding error introduced by imprecise floating point arithmetic on the hardware.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
hosseinimr93
Legendary
*
Offline Offline

Activity: 2576
Merit: 5668



View Profile
May 31, 2024, 11:36:38 AM
Merited by vapourminer (1)
 #13

It could simply be a rounding error introduced by imprecise floating point arithmetic on the hardware.
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.

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!