Categories
Economics Technology

Bitcoin Halving & Block Subsidy

Bitcoin Halving is a phenomenon or a certain point in time in Bitcoin protocol where the block subsidy is cut in exact half of what it was before that phenomenon. This rule was written in the Bitcoin code as a way to gradually and consistently issue the amount of BTC over time. The issuance of new BTC begins at a fixed rate and gradually reduces until the total distribution of the coin reaches 21,000,000. The code defines when this halving phenomenon occurs and how the Block Subsidy is calculated and distributed to the miner.

Once the block is created, the miner sends the newly created block to the node network. And nodes verify that block follows the rules of the network, such as maximum amount of data on the block and maximum number of coins, which is the Block Subsidy that the miner gets rewarded when creating the block. If a node determines that a block is valid, it stores it and propagates it to other nodes, and within a short period of time, every nodes will verify and store this new block to continue the blockchain.

The code contains some rules that decide the timing of the halving and the amount of block subsidy. The block subsidy is cut in half after every 210,000 blocks. When Bitcoin protocol was first set live in 2009, the initial block subsidy was 50 BTC. From the first block of the Bitcoin protocol, there have been 3 halvings each after 210,000 blocks. Block subsidies are paid every 10 minutes on average. So, the halving occurs around approximately every 4 years after 210,000 blocks are mined on the blockchain.

The next or 4th halving is scheduled to occur around April 2024. From that point, the block subsidy is reduced to 3.125 per block. This Bitcoin Halving and block subsidy will stop when it reaches zero and all the 21,000,000 BTC has been mined. This will occur roughly around the year 2140. There will be total of 32 halvings and each halving will cut the block subsidy to half of previous block subsidy. Below is the code snippet for receiving the block subsidy.

This code is what defines the amount of block subsidy and schedule for its reduction to exactly in half of previous amount over that time. The total supply of the Bitcoin will be stopped after 32 halvings once this subsidy reach to Zero.

This line of code calculates the number of halvings.

int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;

The “halvings” integer will have the rounded down value of the nearest whole number. “nHeight” is the current number of blocks on the blockchain. When the new block is created and added to the blockchain, it grows longer/taller. As of this writing, bitcoin’s “block height” is 807892 blocks. “nSubsidyHalvingInterval” is the number of block which must pass before another halving occurs which has the static value set to 210,000 blocks as defined in the bitcoin codebase below:

The Block Subsidy

This code below has the constant COIN. Let’s look at what that means.

CAmount nSubsidy = 50 * COIN;

COIN is a value specified in the code as below. It is the total smallest divisible units of a bitcoin, which is satoshi. There are 100,000,000 satoshis in 1 BTC.

/** The amount of satoshis in one BTC. */ static constexpr CAmount COIN = 100000000;

So the subsidy is multiplied by the number of coins which is satoshis. If the block subsidy is 50 BTC, the subsidy or reward will be 5,000,000,000 satoshis.

The comment below describes that the block subsidy is cut in half every 210,000 blocks or approximately 4 years.

// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
nSubsidy >>= halvings;

Let’s look at the code above. The most important part here is the ”>>” operator or its also known as “bitwise right shift”. It’s a standard operator in C++ programming language and is very important here. It is same as dividing by 2. Let’s look at the example of current halving period which is 3rd halving. The nSubsidy is fixed number which is 50 * 100,000,000(50 BTC) and the operator is >> 3. The binary value of the 50 * 100000000 is “100101010000001011111001000000000”. A single bitwise right shift removes the last digit on the far right from the binary number. Converting this binary number to the decimal value, it gives the subsidy at the first halving.

100101010000001011111001000000000 = 5,000,000,000 satoshis = 50 BTC

After the first halving,

10010101000000101111100100000000 = 2,500,000,000 satoshis = 25 BTC

After the second halving,

1001010100000010111110010000000 = 1,250,000,000 satoshis = 12.5 BTC

As its the 3rd halving period now,

100101010000001011111001000000 = 625,000,000 satoshis = 6.25 BTC

The next halving is scheduled to occur around April 2024. The block subsidy will be,

10010101000000101111100100000 = 312,500,000 = 3.125 BTC

This way the block subsidy get cut in half every 210,000 blocks.

I’ve created a table below to calculate the number of BTCs to be mined after each halving and it’s amazing and fun to see how it works.

If you look at the number of BTC scheduled to get mined in the year 2100, it’s less than 3 BTC in 4 years. The highlighted data in the period from the year 2104 to 2140 is mind blowing. It will take approximately 36 years for all the energy of miners and the computing power of the world to mine single BTC. We can not even imagine how valuable this asset will be 100 years from now. The meaning of value exchange will be completely different from how our mind can comprehend today. Future looks so bright for coming generation. Bitcoin is a war without violence and its incentives are so high, noone and no country can ignore or escape.

“…The greatest victory is that which requires no battle….”

Sun Tzu, The Art of War

I’ve written about the Value Exchange and Money prior to this article. You might want to check those out. I’ll write about the bitcoin code in future articles too.

Thank you for reading. See you next time.

2 replies on “Bitcoin Halving & Block Subsidy”

[…] The difficulty is actually altered by adding or reducing the zeros at the front of the target hash. This target hash is the specific hash that all the miners are trying to beat. The miner who generates a random code that has an equal or higher number of zeros at the front compared to the target hash, is selected as the winner and the block is created and added to the blockchain. This algorithm was set to prevent the creation of blocks at faster rate as miners could increase their machine and its specs to do so. One of the most important characteristics of Bitcoin protocol is its steady and predictable rate of inflation compared to other fiat currencies. The mining difficulty adjustment algorithm and its maximum amount of 21 million is what makes this protocol interesting and somewhat predictable which I’ve written in my previous article, Bitcoin Halving and Block subsidy. […]

Leave a Reply

Your email address will not be published. Required fields are marked *