Randomness is easy to claim and hard to prove. When one side runs the draw and the other side only sees the outcome, trust becomes the weak point. A commitment scheme fixes that by locking the result in before anyone bets, then letting anybody check the lock afterwards.
Why a random result needs a receipt
The idea is easier to picture than to define. Anyone who has opened a crypto casino and spotted a small “Verify” link next to a round has already met it. That link points back to a question cryptographers were chewing on long before Bitcoin existed: how can one party produce a random outcome that the other party has reason to believe?
Manuel Blum put it on paper in 1981, in a piece called “Coin Flipping by Telephone”. His example was a divorced couple in different cities who need to decide who keeps the car. Neither wants to take the other’s word for how the coin landed.
The fix is a sealed envelope. One side commits to an answer first, the other side guesses, and only then does the envelope open. Nobody can swap the contents, and nobody can peek early. Bitcoin gambling borrowed the trick in 2012, when SatoshiDICE launched and later published the secrets behind its hashes so players could rebuild the process themselves.
The digital envelope is a hash
A hash function plays the envelope. SHA-256 takes any input and returns a 256-bit fingerprint, written as 64 hexadecimal characters. Feed it the same input and you get the same fingerprint every time. Change a single character and the output looks unrelated. Work backwards from the fingerprint to the input and you get nowhere, since there are 2^256 possible outputs, a number with 78 digits.
So the operator picks a long random string called the server seed and publishes only its hash before play starts. That hash is the sealed envelope. Swap in a different seed later and the fingerprint no longer matches.
Why the player adds a seed too
The server commits first, so it cannot know what the player will contribute. The client seed, which the player can usually edit, arrives after the lock. A third input, the nonce, is a counter that goes up by one with every bet, so identical seeds never produce the same round twice.
The result comes from combining all three through HMAC-SHA256, a keyed version of the same hash, and turning the output into a number the game can use. The last step varies. One documented method takes the first eight hex characters and divides by 4,294,967,296 to land between 0 and 1.
Checking a round yourself
Verification takes a few minutes and needs only the values the game page shows you. Use an independent SHA-256 calculator or a few lines of your own code, because a checker hosted by the operator proves less than one you ran elsewhere. After the server seed has been rotated and revealed, work through the round like this:
- Copy the revealed server seed, your client seed and the nonce for that round.
- Hash the revealed server seed with SHA-256 and compare it with the hash shown before the round. A mismatch means the seed was changed.
- Join the client seed and the nonce in the order the game documentation gives.
- Run HMAC-SHA256 with the server seed as the key over that combined message.
- Convert the output with the documented formula and compare the number with the result on screen.
What a matching hash proves, and what it leaves open
A match proves one narrow thing, and it is a useful one. The seed behind the draw was fixed before the bet and nothing was altered afterwards. As long as the hash function stays secure, neither side can steer or predict the outcome.
It does not prove everything people sometimes read into it. A few things sit outside the proof:
- The odds and payout table. A perfectly verified draw can still belong to a game with a thin margin, and those figures are a separate question.
- The mapping from number to outcome. If the rules for turning a number into a card or a dice face are vague, the check cannot be closed.
- The verifier itself. A tool you did not build deserves a second opinion, so run the hash somewhere else.
- Games that do not use the scheme. Audited random number generators approach the same trust problem through independent testing instead of player-side math.
Blum’s divorcing couple needed a coin both of them could trust. What the sealed envelope gave them was a way to stop needing one.


