We commit
Before any bet, we create a secret server seed and show its SHA-256 hash. The hash locks the seed in without giving it away.
Demos / Under the hood
TechnologyWhen a game uses our commit-reveal system, the result is locked before the player bets. After the round we reveal the secret seed, and anyone can hash it and recompute the result to check that nothing changed.
...Hidden until you reveal it| Nonce | Type | Result | |
|---|---|---|---|
| No results yet | |||
Everything here runs in your browser with the Web Crypto API, so you can inspect every step. In production the server seed stays on the server until it is revealed.
Before any bet, we create a secret server seed and show its SHA-256 hash. The hash locks the seed in without giving it away.
The player can set their own client seed. Because it is mixed into every result, we cannot work out the outcome in advance either.
Each result is HMAC-SHA256 with the server seed as the key and client seed, nonce and cursor as the message. Same inputs, same output, every time.
After the session we reveal the server seed. If its hash matches the commitment and the results recompute the same, the game was fair.
The first 13 hex characters of the HMAC become a float between 0 and 1. Every game maps that float to its own outcome: a dice roll, a crash point, a card position, a keno ball.
async function generateFloat(serverSeed, clientSeed, nonce, cursor = 0) {
// Combine both seeds with the bet counter
const input = `${clientSeed}:${nonce}:${cursor}`;
const hash = await hmacSha256(serverSeed, input);
// 13 hex characters give 52 bits of precision
const value = parseInt(hash.slice(0, 13), 16);
return value / parseInt('fffffffffffff', 16);
}
This is the RNG we put on games with a random outcome. Contests that settle on real game scores don't need it for the score, and our slots on Stake use Stake Engine's own certified system.