coin.hardiksjain.in

provably fair, cryptography-backed coin flip using blum integers & commit–reveal.

Jul 2025 - Aug 2025Redis, WebSockets, Cryptography
Blum IntegersProvably FairZero-TrustVerifiable
Live
Case Study

From trust to math

Goal: create a zero‑trust primitive users can verify themselves without reading code or trusting logs.

Problem

Online coin flips & micro-wagers rely on opaque RNG or centralized trust—making disputes inevitable.

Objectives

What success looked like

  • Human-verifiable fairness (anyone with a calculator)
  • <150ms median reveal verification
  • Horizontal scaling without coordination bottlenecks
Protocol

Commit–reveal flow

  1. 1A publishes n
  2. 2B commits a = x² mod n
  3. 3A acknowledges
  4. 4B reveals x
  5. 5System derives bit
  6. 6Persist + broadcast result
Performance

Early runtime metrics

Median Verify132ms
target 150ms
P95 Verify181ms
target 220ms
Redis Fanout4.2ms
target 10ms
Decisions

Why these choices

Blum Integer vs Standard RNG

Human-verifiable quadratic residue property

Redis Pub/Sub

Low-latency fanout w/out premature Kafka adoption

Outcomes

What shipped

  • Fairness from Blum integer commit–reveal scheme
  • Client verifies root² ≡ s mod n in <150ms
  • Realtime reveal broadcast over WebSockets with Redis fanout