Fair dice you can check
In an online room the dice are locked before the first roll, mixed with every player's own randomness, and checked by your browser when the game ends.
Play LudoIn an online room
- The server locks the dice. When the game starts it picks a secret random number and publishes a lock on it: a SHA-256 fingerprint of that secret together with the game, its settings and its seats. Your browser keeps the lock.
- Every player adds randomness. Each person's browser then sends 32 random bytes of its own. Bots send nothing, and a share that has not arrived after 20 seconds counts as zeros, in the open.
- The rolls follow from both. Each roll is worked out from the secret, every player's bytes and the roll's number, with HMAC-SHA256. Values are spread evenly from 1 to 6: bytes that would tilt the odds are skipped.
- The secret is shown at the end. Then anyone with the record can redo every roll and see that it matches the lock.
The dice seal
The lock is a long string of letters and numbers, so Rolovia shows it as a dice seal: a small rosette and a short code such asK7Q2-9XMA, next to the dice from the first roll. The code is the first 40 bits of the lock, written in Crockford base32 (no I, L, O or U, so nothing reads like a digit). The rosette's colours and dice are drawn from the lock too, so you can tell two seals apart at a glance.
How to check it yourself
- Before the first roll, note the seal code next to the dice. A screenshot is fine. Tap the seal to read what it is.
- When the game ends, tap Check the dice.
- Your browser rebuilds the seal from the revealed secret and shows it next to the one it saw before the game. The two codes must be the same.
If you joined after the game started, your browser never saw the seal before play. The check then says the rolls fit the revealed dice, but that it has no earlier seal to compare.
What “Check the dice” does
The Check the dice button on the result screen works in your browser, not on our server, and checks that:
- the revealed secret matches the lock this browser saw before play,
- your own 32 bytes are the ones that were used,
- every roll in the record follows from the secret and the players' bytes, and
- the rolls you watched during the game are the same rolls.
It then says how many rolls matched. If anything is off, it warns you that the dice don't match what your browser saw before the game.
Under How to check it yourself, the result screen also lists the lock, the secret, every player's bytes and every roll, with a button that copies the whole record, so you can redo the sums with your own tools.
What this proves, and what it does not
The lock means the dice could not be chosen or changed once the game began: not by the server, not by another player. Your own bytes mean the secret could not have been picked to suit them, because it was locked before they were sent.
Our server does know the secret during the game, so it could work out the coming rolls. It uses them for nothing but the game, and the bots play from the board, not from future dice. That part you have to take on trust, like the referee's watch.
Games on your device
Games against bots and pass and play roll with your device's own secure random numbers (the browser's Web Crypto), with the same even spread from 1 to 6. There is no server involved, so there is nobody to prove anything to: nothing leaves your device.
For the curious
Roll number n is the first byte below 252 of HMAC-SHA256(secret, context ‖ game id ‖ bytes ‖ n ‖ block), taken as byte mod 6 + 1. Seats in the record are random ids made for that one game, so a published record does not name anyone.
Questions
Are Rolovia's dice rigged?
No. Nobody chooses the rolls, and online the dice are locked before the game. At the end your browser can check every roll against that lock.
Do bots get better dice?
No. Bots roll from the same locked sequence as everyone else, one roll after another in turn order.
Can I check a game against bots on my own device?
There is nothing to check against: the dice come from your own device, so nobody else could have changed them.