How Provably Fair Works

An interactive guide to understanding how cryptographic hashing ensures casino games can't be rigged — and how you can verify every single result.

Vocabulary Reference

Show definitions

Hover or tap any dotted-underlined term throughout this page to see its definition, or expand this panel.

1. What is a Hash?

A hash function takes any input and produces a fixed-size output (256 bits / 64 hex characters). Even a tiny change to the input completely changes the output. This is called the avalanche effect — and it's why hashes are practically impossible to reverse or predict.

Try changing a single letter below and watch how the entire hash transforms:

SHA-256 Output:
2c
f2
4d
ba
5f
b0
a3
0e
26
e8
3b
2a
c5
b9
e2
9e
1b
16
1e
5c
1f
a7
42
5e
73
04
33
62
93
8b
98
24
Each colored cell represents one byte (2 hex chars). Color = byte value mapped to hue. White border = changed.

Collision resistance

There are 2256 possible SHA-256 outputs — more than the number of atoms in the observable universe (~1080). Finding two different inputs that produce the same hash would take longer than the age of the universe, even with all the world's computers working together.

This is exactly why an operator can commit to a round by showing you the hashed server seed before you play. Since it is computationally impossible to find a different server seed that hashes to the same value, you are essentially guaranteed that the operator cannot swap out or change the server seed after the fact. The hash locks them in — if the revealed seed doesn't match the hash they showed you, you know they cheated.

2. How Seeds Combine

Before any bets are placed, the operator commits to a server seed (the key) by publishing its SHA-256 hash. You (the player) can't see the actual seed yet — only the hash. This proves the operator can't change its seed after the fact.

Server Seed (hidden)
SHA-256
Published Hash (visible to you)4c7a00441bb8c14bbc4e29c6595715c33300c9eda4b4941968a9992d1050a87f

You then provide your own client seed. The game combines the server seed (the key), your client seed, and a nonce (round number) into the message, then runs it through HMAC-SHA256 to produce the random output. The nonce acts as a salt — it ensures every round produces a completely different result from the same seed pair.

Server Seed
secret-server-seed-a...
+
Client Seed
+
Nonce (round #)
HMAC-SHA256
HMAC message: my-client-seed:0:0
6a
8b
16
4f
61
44
bf
eb
cd
f2
7a
36
4f
fe
8f
3e
8a
66
9e
2a
a1
4a
f7
9f
9c
48
56
38
8b
ac
77
b8
256-bit HMAC output — this is the “random” value for this round

Why is this fair?

The operator can't change the outcome because they already committed to the seed hash. The player can't predict the outcome because they don't know the server seed (key). After the round, the operator reveals the seed and you can verify the hash matches — proving nothing was tampered with.

3. From Random Bytes to Game Result

The 256-bit HMAC output is just raw bytes. To turn it into a game result, we take the first few bytes and convert them into a number within the game's range.

First 4 bytes of HMAC
6a106
8b139
1622
4f79
bytes[i] / 256^(i+1)
Float value [0, 1)
0.4161848014
x 37
Game result (0 to 36)

15

Game range (e.g. roulette = 37, dice = 10001):
Visual: result 15 highlighted on a 37-slot wheel
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Change any input above and watch the entire chain update in real time.
4. Mapping to a Game Outcome

In Stake Engine games, the HMAC doesn't produce a simple small number like “slot 14”. Instead, it generates a very large random number (128 bits), and this number is mapped against a weighted lookup table that defines every possible outcome and its probability.

Each event in the table owns a range of values proportional to its probability. Rare outcomes (big wins) have tiny ranges. Common outcomes (losses) have large ranges. The random number simply falls into whichever range it lands in — no decisions, no manipulation possible.

Random value (drag the slider): 3200 / 10000
0x (Loss)
0.5x
1x (Break even)
2x

Event 0: 0x (Loss)

(payout 0x)

The lookup table is published as part of the game — anyone can inspect the exact weights, verify the probability distribution, and confirm that the random number correctly maps to the outcome they were given. This is the final piece of the provably fair chain: the random number is locked by the HMAC, and the table is locked by the game definition.

How real lookup tables work

Real Stake Engine games use 128-bit random values and tables with hundreds of thousands of weighted events. The total weight (sum of all ranges) can be astronomically large, but the principle is identical to the example above: the random value mod the total weight lands in exactly one range, and that range determines the outcome. You can inspect any game's full lookup table on its detail page in the catalog.

5. Verify It Yourself

After a game round ends, the operator reveals the actual server seed (key). You can then:

  1. Confirm the revealed server seed hashes to the commitment you were shown before the round.
  2. Recompute the HMAC-SHA256 with the server seed (key), your client seed, and the nonce (the message).
  3. Confirm the game result matches what you were shown.

If any step doesn't match, the game was tampered with. This is mathematically provable — no trust required.

6. What Provably Fair Can & Can't Do

Provably fair is a powerful tool, but it's important to understand its scope.

What it does
  • Guarantees the operator cannot swap out or alter the result of a bet after it has been placed. The cryptographic commitment locks the outcome in before you play.
  • Provides a way for players to detect when game code, validation, or the fairness mechanism itself is broken or behaving dangerously.
  • Makes the risk of getting caught cheating extremely high and extraordinarily difficult to avoid. Any manipulation leaves a mathematically verifiable trail.
What it doesn't
  • Does not determine whether the probability distribution of a game is fair or favorable. A game can be provably fair and still have a steep house edge.
  • Cannot prevent all forms of cheating entirely. It is one layer of protection, not a complete guarantee against every possible exploit.
  • Still requires you to be proactive. Verifying seeds, checking results, and rotating client seeds regularly is your responsibility — provably fair only works if you actually use it.