blockchain within six blocks[ Note 2015-12-19: This article is the original “Waiting For Blocks” but had a problem with some of the probability statistics. A revised, authoritative, version can be found as “Waiting For Blocks (Revised)”. Please read that one; this one is retained purely for historical information!]
Bitcoin blocks take ten minutes to find don’t they? Well, actually no they don’t. Sometimes they can be found truly quickly, but other times they can take a very long time. Just to make things confusing, the gaps inbetween blocks can switch depending on whether the hashing network is stable, expanding or contracting. What if we need six blocks (to get six confirmations)?
So what we might expect to happen? What was happening during last year’s growth phase, and what would happen if the network were to lose large amounts of hashing capacity?
Running Like Clockwork?
In a somewhat flawless world we might hope that our nominal ten minute gap inbetween blocks would be exactly ten minutes, but anyone who has ever observed block arrival times will know that that’s not what happens:
The blue probability line shows that the most likely time to find a block is indeed ten minutes. What might seem a little surprising is what we see from the crimson, cumulative probability, line. By the time we reach ten minutes there’s a better than 63% probability that we’ve found a fresh block, not 50%. The problem is that the remaining 37% of the blocks can take a very long time to find! At an hour we’ve still not found a block a little less than 0.25% of the time; that means that typically one block in four hundred one will take more than an hour to find! There are a few subtleties to this particular number but we’ll come back to those in a little while.
If, like me, this one in four hundred one number was something of a surprise (that’s about once every Two.8 days on average) then it’s perhaps worth looking at some of the latest gaps inbetween blocks. In the twelve day period up to 2015-02-05 I quickly found five blocks that took more than an hour to find! (the number might be higher as I was doing this by hand by checking a blockchain explorer). For the record these were three hundred forty thousand four hundred fifty (77 mins), three hundred forty thousand five hundred twenty one (63 mins), three hundred forty thousand five hundred forty four (67 mins), three hundred forty one thousand seven hundred twenty seven (60 mins) and three hundred forty two thousand two (72 mins). Three of these occurred in a single twenty four hour period over the 25th and 26th of January.
If a single block can take so long to find, what about the six blocks that we need for many elementary Bitcoin clients (SPV wallets)?
The good news is that our guess that six blocks would most likely take three thousand six hundred seconds (an hour) is correct. A surprise, however, is that in 10% of cases it takes more than five thousand five hundred sixty seconds (more than one hour, thirty two minutes) to find six blocks; in 1% of cases it takes more than seven thousand eight hundred seventy seconds (Two hours, eleven minutes)! On the roll side of this however, in 10% of cases we get all six blocks within one thousand eight hundred ninety seconds (a little under thirty two minutes) and in 1% of cases we have all six within one thousand seventy seconds (just under eighteen minutes).
The Network Isn’t Static!
So far none of the results we’ve seen should come as anything of a shock to anyone who understands the statistics assoicated with a Poisson process. The real Bitcoin network is somewhat more subtle tho’ because it is truly a non-homegeneous Poisson process; underlying hashing capacities switch across each difficulty period of two thousand sixteen blocks. If we embark out at, say, three hundred PH/s but add 0.2% fresh capacity every day, then after fourteen days (a little more than the two thousand sixteen blocks take) we’d have 308.Five PH/s. That means that towards the end of the two thousand sixteen blocks we’re actually going to see blocks found more quickly than at the commence. In addition, as we spotted in “Lies, Damned Lies And Bitcoin Difficulties”, the nominal hash rate calculated at the end of each difficulty period lags about a week behind the current hash rate.
The 0.2% increase per day isn’t a totally random number; it’s a good approximation to the underlying trend for the last duo of months. Comparing this and the “ideal” numbers where there’s no switch in the network’s hash rate we can see the following:
The difference isn’t all that fine. Our mean block finding time is closer to nine minutes forty five seconds, while our mean time to see a block take an hour or longer increases to once every four hundred eighty blocks.
What About More Extreme Switches In Hash Rate?
A hash rate increase of 0.2% per day doesn’t have much effect, but what about 2% per day? 2% seems like a hefty number based on latest months, but was fairly common in the earlier part of 2014. At the same time as considering postive increases it seems worth considering negative switches too; if the BTC:USD price were to proceed ripping off then in theory some reasonably large number of miners might disconnect their hardware!
A +2% per day switch corresponds to a nominal 24.8% increase in hash rate over two thousand sixteen blocks and takes about 11.Two days. The rapid increase causes us to find blocks very quicky and thus readjust the difficulty quickly. A -2% per day switch has a much larger influence, however, because our two thousand sixteen blocks end up taking nearer to twenty one days. This would correspond to a hash rate reduction of 34.6%.
The following kinks assume a stable state switch, i.e. what would happen if we’d been witnessing a stable +2%, 0% or -2% switch in the previous difficulty period too. As such these are more extreme that we would see in the very first difficulty period for which the switch was occuring; they do match a 2nd or subsequent period:
During our +2% expansion we see a mean block time closer to eight minutes, but with a -2% spasm the mean moves closer to fifteen minutes!
Now let’s look at the same behaviour for our six confirmations:
As we might expect, the pattern for a single block is mirrored for six blocks.
The Bitcoin design is suprisingly well adjusted for a network in which hash rates are expanding. Given that technologies continually improve then that’s most likely the right bias as a normal schedule of substituting older, less power efficient, hardware with newer, more power efficient models will tend to see global hash rates increase.
On the surface it looks like it works much less well when we see sustained spasm of the global hash rate, but such contractions are much less likely. In general miners will eliminate their least power effiicient hardware from the network rather than their most efficient, so if the BTC price reduces the influence on the hash rate is significantly dampened.
There is another interesting aspect to the diminished block finding rate. One of the theories about the latest decline in the BTC price is that a lot of the downward pressure comes from miners selling newly-mined coins. If miners begin to unplug hardware and the block finding rate falls then some of this pressure will also reduce because fewer coins will be being mined each day. Whether this actually happens or not may be an interesting indicator of what might happen when the block prize halves in 2016.