May 10, 2020

Bitcoin Having

CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams){  int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;  // Force block reward to zero when right shift is undefined.  if (halvings >= 64)    return 0;  CAmount nSubsidy = 50 * COIN;  // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.  nSubsidy >>= halvings;  return nSubsidy;}

CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)

{

int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;

// Force block reward to zero when right shift is undefined.

if (halvings >= 64)

return 0;

CAmount nSubsidy = 50 * COIN;

// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.

nSubsidy >>= halvings;

return nSubsidy;

}

What is a block halving?
A block halving is a process of reducing the rate at which new cryptocurrency units are generated. Specifically, it refers to the periodical halving events that decrease the block rewards provided to miners.

Why are halvings significant?
Halvings are at the core of the cryptocurrency economic models because they ensure coins will be issued at a steady pace, following a predictable decaying rate. Such a controlled rate of monetary inflation is one of the main differences between cryptocurrencies and traditional fiat currencies, which essentially have an infinite supply.

How many Bitcoin halvings have there been previously?
As of July 2019, there have only been two previous Bitcoin halving events. These occurred on the 28th of November, 2012 and the 9th of July, 2016. At the time of the first halving event, the price of Bitcoin was $12.31 and at the time of the second halving event, the price of Bitcoin was $650.63.

There will only ever be 32 bitcoin halving events. Once all of these have occurred, there will be no more halvings and there will also be no more Bitcoin created as the maximum supply will have been reached.

How does the Bitcoin block halving work?

The Bitcoin Halving is an essential function of the Bitcoin protocol. The code can be found on the Bitcoin Core Github and below is a snippet of the code that makes the bitcoin halving possible. As documented in the code, the block subsidy will be halved every 210,000 blocks.

How is our timer calculated?

You may notice our countdown has a different estimation than other bitcoin halving countdowns and ask "Why?"

We believe this makes our countdown more accurate because instead of using the commonly quoted average block time (10 minutes), we are using live blockchain statistics and obtaining an estimation of the current average block time, then conducting our calculation based on that. Our timer may fluctuate, however, we believe it is the most accurate block halvening clock.

The Bitcoin Halvening timer on Binance Academy is calculated using the following formula:

(Halving block - Next block height) * Average time between blocks - estimated time until the next block.