Provably fair dice
On Duel nobody, not even the server, can change the dice in anyone's favour. And you don't have to take our word for it: you can check every single roll yourself.
Why should dice be provable?
In online backgammon the server rolls the dice and nobody sees it happen. Being random is not enough: it must be possible to prove the dice were fixed in advance and were not changed in the middle of a game after looking at the board. That is what the standard commit–reveal scheme, used by cryptographic systems and reputable online games, is for.
Four steps, from match creation to verification
- 1
Server commits
As soon as a match is created, the server generates a secret 32-byte seed and publishes only its fingerprint (SHA-256 hash). From then on the seed is locked.
- 2
Players contribute
Each player's browser sends its own random value when joining the game. Since the server's commitment was already published, it cannot change its seed after seeing theirs.
- 3
Play
Every roll has a sequential nonce (0, 1, 2, …) that is reserved in the database before it is used. The dice come from the server seed, the players' seeds and that nonce.
- 4
Reveal & verify
Once the match is over, the server seed is published. Anyone can compare its hash with the original commitment and recompute every single die.
From seed to dice
For each roll, HMAC-SHA256 keyed with the server seed is computed over “players' seeds:nonce:round”, giving 32 bytes. The bytes are read in order: every byte below 252 gives one die (remainder of division by 6, plus 1) and bytes 252–255 are skipped.
Why 252? It is the largest multiple of 6 below 256. Without it, faces 1–4 would come up slightly more often than 5 and 6. Skipping the last four values gives every face exactly 42 of the 252 possible bytes: all faces are equally likely.
What this guarantees
- The dice of the whole match are locked before the first roll; the server cannot change them during play.
- The server cannot pick its seed after seeing the players' seeds, because its commitment was published first.
- No roll can be dropped or repeated: nonces are sequential, gap-free and stored before use.
- Every face has exactly the same probability.
- Verification is fully independent: with this page, or any standard SHA-256 and HMAC tool.
Limits (honestly)
- The server seed stays secret until the match ends; verification is possible afterwards.
- Matches played before this feature was turned on have no proof.
- If, in a rare case, a roll cannot be reserved, the game does not stop: that roll is flagged as unproven in the report.
Verify the dice of a match
- 1Go to “Replays” and open a finished match.
- 2In the “Dice proof” panel, press “Verify the dice”.
- 3Your browser compares the seed hash with the commitment and recomputes every die. The computation runs on your own device, not on the server.
Manual verification tool
Enter the seeds and the nonce from a match's report to compute the dice independently.
Technical specification
serverSeed = 32 random bytes, hex (secret until the match is over)
serverSeedHash = SHA-256(serverSeed) (published when the match is created)
clientSeed = "<host seed or ->:<guest seed or ->"
nonce = 0, 1, 2, ... (one per roll, reserved before use)
for round = 0, 1, 2, ...:
block = HMAC-SHA256(key = serverSeed, msg = clientSeed + ":" + nonce + ":" + round)
for byte in block:
if byte < 252: die = (byte mod 6) + 1 (252..255 are skipped)
turn roll = first two dice
opening roll = (host, guest) pairs until they differ