It's close, but not exactly! Let's discover why.
Bitcoin has a block time of 600 seconds (10 minutes).
The internals of Bitcoin uses the concept of blocks, not calendar years or timestamps. The halving interval of Bitcoin is actually defined as every 210,000 blocks. 210,000 blocks of 600 seconds gives us exactly 126,000,000 seconds per halving.
This is called nSubsidyHalvingInterval
on line 66 of src/chainparams.cpp
consensus.nSubsidyHalvingInterval = 210000;
The number of seconds in a year is 60*60*24*365=31,536,000
. Multiplying by four gives 126,144,000
seconds
in four years, ignoring leap years and leap seconds.
Dividing 126,144,000
by 31,536,000
seconds gives us the exact value of the Bitcoin halving
interval, which is 3.9954 years! That is about 1.6 days shorter than 4 years, so you don't have
to wait as long for the next one 😃
Leap years add an extra 86400 seconds, making the deviation larger, not smaller.