Provable Fairness with Bitcoin Blocks

How It Works

Our football squares game uses Bitcoin blocks to ensure completely fair and transparent randomization. This method is provably fair because:

  • Bitcoin block hashes cannot be predicted in advance
  • Block data is immutable and publicly verifiable
  • The randomization process is deterministic and reproducible
  • Anyone can independently verify the results

The Process

  1. Square Purchase Completion: When all 100 squares are sold, we record the current Bitcoin block height.
  2. Wait for Next Block: We wait for the next Bitcoin block to be mined (approximately 10 minutes on average).
  3. Use Block Hash as Seed: The hash of that next block becomes our random seed. This ensures no one could have known the seed when purchasing squares.
  4. Deterministic Shuffle: We use the block hash to shuffle numbers 0-9 for both rows (away team) and columns (home team).

The Algorithm

Here's the exact code we use for randomization:

import seedrandom from 'seedrandom';

// Deterministic shuffle using Bitcoin block hash
function shuffleArray(array: number[], seed: string): number[] {
  const rng = seedrandom(seed);
  const shuffled = [...array];

  for (let i = shuffled.length - 1; i > 0; i--) {
    const j = Math.floor(rng() * (i + 1));
    [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
  }

  return shuffled;
}

// Generate row and column numbers
const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
const blockHash = 'Bitcoin block hash here';

const rowNumbers = shuffleArray(numbers, blockHash + ':rows');
const colNumbers = shuffleArray(numbers, blockHash + ':cols');

Verify It Yourself

You can independently verify any game's randomization:

  1. Get the Bitcoin block hash from the game details or from mempool.space
  2. Use the same seedrandom library with the block hash as seed
  3. Run the shuffle algorithm above
  4. Compare the results with the game's assigned numbers

Why Bitcoin Blocks?

Unpredictability

Bitcoin block hashes are the result of massive computational work by miners worldwide. The exact hash cannot be predicted until the block is actually mined.

Transparency

All Bitcoin blocks are public and permanent. Anyone can look up the block hash we used and verify our randomization.

Immutability

Once a Bitcoin block is mined and confirmed, it becomes part of the permanent blockchain. The hash cannot be changed or manipulated.

Global Consensus

The entire Bitcoin network agrees on each block's hash, making it an ideal source of public randomness that everyone can trust.

External Resources