How do you generate provably fair random numbers?
Concise answer: Commit to a secret server seed by publishing its SHA-256 hash, accept an independently chosen client seed, and derive the random number from both seeds plus a nonce. Reveal the server seed afterward so anyone can confirm the commitment and reproduce the exact result.
To generate one now, use the live provably fair random number generator or call the random integer API. Keep the returned clientSeed, serverHash, cursor, nonce, and outcome as the verification receipt. Then use the provably fair outcome verifier to check it.
Generate and verify in four steps
- Record the server hash published before the request.
- Supply a client seed and request the required float or integer range.
- Save the result, seed coordinates, and public outcome permalink.
- Reveal the server seed, check its hash, and reproduce the same result.
The trust problem
If a server tells you "here is a random number," how do you know it wasn't picked on purpose? Provably fair randomness solves this by letting you mathematically prove, after the fact, that the result was not chosen to favour anyone.
The three ingredients
Every provably fair outcome relies on three pieces:
- Server seed — a secret random string the server generates and commits to before you ask for an outcome.
- Server hash — a cryptographic hash (SHA-256) of the server seed, published up front. Once it's out, the server seed cannot be changed without the hash also changing.
- Client seed — a value you choose. Because the server has already committed to its seed, your contribution makes the final result unpredictable to either party.
The verification flow
- The server gives you a
serverHashbefore you ever request a number. - You request an outcome, supplying your
clientSeed. The API combines server seed + client seed + a nonce and hashes the result to derive the random value. - When you're ready, the server reveals the original
serverSeed. You hash it yourself and confirm it matches theserverHashyou were given earlier. - You re-run the same hashing math locally with the revealed seeds. If you get the same outcome, the result was provably fair.
Try it now
Head to the verification page, paste a clientSeed and serverHash from any past response, and confirm the result. The page calls GET /api/verifyServerHash and tells you instantly whether the values match our records.
Further reading
FAQ
What is a server seed?
A secret random value Provable.io generates and keeps hidden until it's revealed. It's the cryptographic ingredient that makes every outcome unpredictable from the outside while still being reproducible once revealed.
What is a server hash?
A SHA-256 commitment over the server seed, published before any outcome is generated. The hash locks in the seed — once revealed, the seed must hash to the previously published value, proving it wasn't swapped after the fact.
What is a client seed?
A value you (or the player) supply on each request. It's mixed into the HMAC stream so neither side can fully control the outcome — you contribute entropy that the server cannot grind against.
How do I verify a past outcome?
Paste the clientSeed and serverHash into /verify (or call /api/verifyServerHash). The page recomputes the HMAC stream and confirms the outcome matches — anyone can re-run the math from the open-source provable-core library.