๐ŸŽฒ Zero-Knowledge Proof Playground

Provably Fair Minesweeper - Verify Game Fairness Using Cryptographic Commitments

Play Game
Verification
How It Works

Game Configuration

๐Ÿ”’ Cryptographic Commitment (SHA-256)

The server has committed to the mine positions BEFORE you play. This hash proves the game is fair!

Loading...

Play a game first, then click "Verify Game Outcome" to see the cryptographic proof!

๐Ÿค” What is a Commitment Scheme?

A commitment scheme is like putting a secret message in a sealed envelope. Once sealed, you can't change the message inside, but you can prove later what was in the envelope all along.

In this game, the server "seals" the mine positions in a cryptographic envelope (SHA-256 hash) BEFORE you start playing. This proves the server can't cheat by moving mines after seeing your clicks!

๐ŸŽฎ How This Game Uses Commitments

Step-by-step flow:

  • Server generates: Random seed (32 bytes) + mine positions
  • Server commits: commitment = SHA-256(seed + positions)
  • You receive: Commitment hash BEFORE playing
  • You play: Click tiles to reveal safe spots or mines
  • Game ends: Win (all safe tiles) or loss (hit mine)
  • Server reveals: Original seed + mine positions
  • You verify: Recalculate SHA-256(seed + positions)
  • Check match: Does it equal the original commitment? โœ“ Verified!

๐Ÿ” Why SHA-256?

SHA-256 is a cryptographic hash function with special properties:

  • One-way: Cannot reverse the hash to find the original data
  • Deterministic: Same input always produces same output
  • Collision-resistant: Nearly impossible to find two different inputs with same hash
  • Avalanche effect: Tiny input change completely changes the hash

These properties make SHA-256 perfect for commitments - the server can't predict what hash will be produced without knowing the exact data, and can't find different mine positions that produce the same hash.

๐Ÿ›ก๏ธ Why Can't the Server Cheat?

The commitment scheme has a binding property:

  • Once the server shares the commitment hash, it's locked in
  • The server cannot find different mine positions that produce the same hash
  • If the server tries to cheat, the verification step will fail
  • You have the original hash saved - the server can't change it retroactively

This is mathematically guaranteed by SHA-256's collision resistance. Even with massive computing power, finding a "fake" set of mine positions with the same hash is impossible.

๐ŸŒ Real-World Applications

Commitment schemes are used in many critical systems:

  • Online Gambling: Provably fair casinos use commitments to prove dice rolls, card shuffles, and slot machines aren't rigged
  • Voting Systems: Voters can verify their vote was counted without revealing who they voted for
  • Blockchain: Bitcoin and Ethereum use hash commitments to link blocks and prevent tampering
  • Auctions: Sealed-bid auctions where bids are committed before revealing
  • Timestamping: Proving a document existed at a specific time

๐Ÿงช Try It Yourself!

Play a game, then verify the outcome! The verification tab will show you:

  • The original commitment hash you saw before playing
  • The server's revealed seed and mine positions
  • Step-by-step hash calculation
  • Visual confirmation that the hashes match โœ“

You can even copy the seed and positions, then use an external SHA-256 calculator to independently verify the math. That's the beauty of cryptographic proofs - you don't have to trust anyone!