Provably-fair randomness moved from a crypto-native novelty to a mainstream trust primitive in 2026. If you build any consumer app where outcomes matter — draws, matchmaking, reward drops — the commit-reveal pattern is worth knowing cold.
The core idea
The server commits to a secret before the user acts, publishes the hash, then reveals the secret afterwards. Anyone can verify the outcome was fixed in advance and not tampered with.
// commit
const serverSeed = crypto.randomBytes(32).toString('hex');
const commit = sha256(serverSeed); // shown to user up-front
// reveal + combine with client seed + nonce
const roll = hmacSha256(serverSeed, `${clientSeed}:${nonce}`);
const outcome = parseInt(roll.slice(0, 8), 16) % 10000;
Why client seed + nonce matter
The client seed lets the user inject entropy the server can't predict; the nonce prevents replay. Together they make each outcome independently verifiable and unrepeatable.
Real-world reference
Online-entertainment operators are among the heaviest users of these systems. Sites like true fortune casino expose verification tools so players can re-compute any result — a useful reference for how a production-grade reveal UI is presented to non-technical users.
Pitfalls
- Leaking the seed early breaks the whole guarantee — reveal only after the action is committed.
-
Weak RNG on the server side (
Math.random) is disqualifying; use the platform CSPRNG. - Silent seed rotation — always let users see and rotate their client seed.
Takeaway
Commit-reveal is a small amount of code that buys a large amount of trust. Ship the verifier UI alongside it, and the guarantee becomes something users can actually check rather than merely be told about.
Top comments (0)