By 8BTC Staff
4 min read
With six days left until the Bitcoin halving, the event has become one of the most talked-about topics in the crypto industry. Experts have been racing to weigh in on the effects the halving will have on the market, with many arguing over whether or not the halving has already been “priced in.”
The total supply of Bitcoin is capped at 21 million coins, which means that once the final coin is mined no new Bitcoin will enter its supply. Each new Bitcoin is created by mining, a process in which powerful hardware competes to solve complex math problems. Once a block is created, the miner that created it receives a certain amount of Bitcoin (BTC) as a reward.
When Bitcoin was created, the block reward was initially set to 50 BTC per block, meaning that each miner that discovers a valid block would earn 50 BTC. But the 10-minute block time would mean that the entire supply would be mined in less than eight years.
To solve this problem, the Bitcoin network contains a rather interesting piece of code that decreases the block rewards given to miners over time. That way, the nodes supporting the networks would be incentivized to continue mining and secure the network.
Instead of instituting a complex mechanism, the creator of Bitcoin equipped it with a single line of code that instructed the network to halve the rewards going to miners every 210,000 blocks.
Here are the main factors involved:
And here is the Bitcoin code:
The code that makes the Bitcoin block reward cut in half every four years. Image: 8BTC.
The function we see in the code above is called “GetBlockSubsidy.” The purpose of the function is to calculate the subsidy, or reward, for mining a Bitcoin block. This is what determines how much miners get paid.
The variable “halvings” calculates the number of halving events by dividing the current block height by a constant value of 210,000. On the day of the halving, the variable “nHeight,” which represents the current block height, will be greater than 6,30,000. Therefore, the value of the halvings will be three (6,30,000/2,10,000). And this will tell the system that it's time for the third halving.
The number of the halving will be then checked to determine if it is greater than 64, as Bitcoin is programmed to undergo a maximum of 64 halvings. Since next week’s halving will be its third one, the code will be able to proceed.
In line 1,245, we see the original subsidy that is calculated for mining a block. The unit of “nSubsidy” is COIN, which is a constant representing 100,000,000 units—equivalent to the number of satoshis (the smallest amount of Bitcoin) in a single Bitcoin.
After line 1,245 executes, the value of “nSubsidy” is 50 Bitcoin. Then this is divided in half for every halving that has already happened. For the third halving, it will be divided in half three times, down to 6.25 Bitcoin. And this is how much each Bitcoin miner will get for mining a new block.
And there you have it folks, the magic of Bitcoin.
[This story was originally published on 8BTC.com, and is shared by arrangement with that site. It has been edited to conform with Decrypt's style.]
Decrypt-a-cookie
This website or its third-party tools use cookies. Cookie policy By clicking the accept button, you agree to the use of cookies.