Dude. Where's my Block

Dude. Where's my Block

Braiins just had a huge streak of bad luck with ZERO blocks found in 551 attempts! 🎲🚫 What are the odds?

The good news is that Braiins is back, after breaking their bad luck streak with block 842865 they mined another two blocks later 842867. But how unlikely is it that of 551 blocks, a pool with ~ 2% of the hash wouldn't find any?

Easy, (1-0.02)^551 which is 0.001%. Basically 0. Something must have broken?

Well, not necessarily. Unlikely things happen all the time. Bitcoin mining is a lottery, and random processes tend to clump. To understand whether this bad streak was unusual we either need to do some mathematics or write a script and let our computer simulate 1 million data points, generating some nice graphs in the process.

By simulating the blocks found by a 2% pool over a year we can generate a plot showing the cumulative (total) blocks found over time. The pools returns look reasonably smooth when zoomed out, but notice, there are some flat sections.

Plotting the duration of each bad luck run we can see that it is very volatile, ranging all the way up to 398 unsuccessful blocks in a row in this single simulation run. These spikes correspond to the flat sections we can see on the cumulative graph.

If we repeat this simulation 1,000,000 times we will get 1,000,000 maximum bad luck durations. From this we can generate a probability density function.

Let's take a look at the blocks found by braiins on mempool's pool page

The Mempool Open Source Project®
Explore the full Bitcoin ecosystem with The Mempool Open Source Project®. See the real-time status of your transactions, get network info, and more.
Braiins blocks page showing recent blocks and key stats

We can see that Braiins had a 551 block streak with no success, so we can plot this line on the chart. All the values to the left of this line sum to 98.5%, and the values to the right sum to 1.5%. This means that over a year, there is a 1.5% chance that a pool with 2% of the hashrate would have a bad luck streak as long as this or longer.

Extending the duration to a 3 year period we see the distribution shifts to the right, and the probability of a 551 block bad luck streak rises to 4.4%.

For 10 years the number jumps to 13.7%

So while it is exceedingly unlikely that braiins would not mine any of a specific 551 block series (0.001%), the chance that they would do so

Duration Chance of 551 block bad luck streak
Specific 551 blocks 0.001 %
1 Years 1.5 %
3 Years 4.4 %
10 Years 13.7 %

📬
If you have thoughts about this post and want to chat drop me a message 

Code

import numpy as np
from numba import jit
import pandas as pd 

p_success = 0.02  # Probability of success (% of hash)
blocks_per_day = 144  # Number of blocks per day
n_days = 365  # Number of days
total_blocks = blocks_per_day * n_days  
n_simulations = 1_000_000

@jit(nopython=True)
def simulate_year():
    events = np.random.binomial(1, p_success, total_blocks)
    current_run = 0
    max_run = 0
    for event in events:
        if event == 0: 
            max_run = max(max_run, current_run)
            current_run = current_run + 1
        else:
            current_run = 0
    return max_run

@jit(nopython=True)
def perform_simulations(n_simulations):
    max_runs = []
    for i in range(n_simulations):
        max_run = simulate_year()
        max_runs.append(max_run)
    return max_runs

df = pd.DataFrame(perform_simulations(n_simulations), columns=['max_run'])
df.to_csv(f"data/max_runs_1y.csv", index=False)
Script to compute 1,000,000 maximum bad luck runs