Provably Fair Explained: How to Verify One Casino Bet

By the DefiPlay team · · 10 min read

A provably fair casino result examined through cryptographic evidence and a public blockchain

A green verification badge doesn't tell you what was verified. Say you lose a roulette bet, open the fairness panel, and find a long hash beside the word “verified.” Has it checked the random input, the winning pocket, or the money you received?

A useful provably fair system gives you evidence you can check outside the game screen. The details matter: seed-based checks and on-chain proofs answer different questions. Here's how to follow one result from its inputs to its payout, without treating a cryptographic proof as a promise that gambling will pay.

What provably fair actually proves

The problem starts with a missing record. If you only see a seed after losing, an operator could have chosen it after the bet. Reproducing that result wouldn't establish that the inputs were fixed beforehand.

DefiPlay is a blockchain casino whose stated design records each roulette bet and slot spin on Polygon. Its games use Chainlink VRF for random numbers and open-source smart contracts to turn those numbers into results. That makes its blockchain casino model relevant here: the evidence trail includes public transactions, rather than just a server's fairness panel.

The older cryptographic idea is a commitment. In Manuel Blum's 1981 coin-flipping paper, one participant sends a one-way-function output before the other makes a guess, then reveals the original input for checking. Today's hash-based casino pattern uses a related principle, though it isn't Blum's exact protocol.

You need both hiding and binding. Hiding keeps the committed seed unknown before disclosure; binding makes changing it without detection computationally infeasible. A strong hash with an unpredictable seed can support those properties. A hash of a guessable word can't provide the same hiding protection.

The practical question is: “Which claim can I independently test?” A matching commitment tests consistency with an earlier input. It doesn't establish a licence, fair payouts, or reliable settlement.

Server seeds, client seeds and nonces have separate jobs

A fairness panel can look complete while leaving out the order of events. For example, a site might supply both seeds itself and show you their hash only after it knows your bet. The labels alone don't solve that problem.

A common seed-based pattern works like this; there isn't one universal casino algorithm:

  1. The server commits. It creates a secret server seed and publishes a cryptographic hash before you finalize your player-controlled input and bet.
  2. You supply the client seed. This is your contribution to the calculation. Choosing a fresh, unpredictable value after the commitment reduces the server's ability to search beforehand for a seed that favors it against that known input.
  3. The game identifies the bet. A nonce, meaning a value used once, often acts as a bet counter. It distinguishes rounds that share the same seed pair.
  4. The server reveals later. After a seed is retired, you obtain it and reproduce the recorded bets. Revealing an active seed could make subsequent outcomes predictable.

NIST's Secure Hash Standard, published in 2015, specifies that SHA-256 produces a 256-bit digest. That digest can serve as the commitment. The game's outcome calculation may instead use HMAC-SHA256: NIST's 2008 HMAC standard describes combining a cryptographic hash with a secret key.

These are different operations. Hashing the server seed checks the commitment; running the keyed calculation checks the outcome. You need the published recipe for both, including text encoding, input order and separators.

A client seed isn't your wallet recovery phrase. No fairness check needs that phrase or a private key. Wallet control is a separate issue, covered in the self-custody wallet guide.

A sealed seed commitment and a separate player input brought together beside a visible bet record
The commitment must come before the player input is finalized.

How to verify one seed-based bet yourself

The usual snag is missing evidence. Say you want to check a roulette round from yesterday, but you've saved only the pocket shown on screen. You can't reconstruct the bet without its seeds, nonce and algorithm version.

For an actual seed-based game, the useful sequence is:

  1. Save the server's commitment before betting, along with the published algorithm and payout rules.
  2. Record your client seed, the round's nonce, the bet identifier and the displayed result. Some games need further inputs, such as a cursor identifying another hash block.
  3. Obtain the retired server seed through the game's documented reveal process. If it isn't disclosed yet, verification is pending.
  4. Hash that seed using the specified encoding and compare it with your saved commitment. Then reproduce the outcome calculation and its mapping to a game result.
  5. Check the payout separately against the rules saved for that bet.

A local calculation avoids relying on the same interface that displayed the result. But you shouldn't paste unreviewed scripts into a browser while your wallet is connected.

Here's a runnable educational test vector, not DefiPlay's algorithm or a real casino bet. The demonstration uses server seed demo-server-seed, client seed reader-check, and nonce 0. All strings use UTF-8. The server seed is the HMAC key; its message is client:nonce:cursor, beginning with cursor 0.

The saved SHA-256 commitment is:

66eee71c64df159e2676b96e4fb069ba27a2915c095218d041c38950fd2882ce

The mapping reads the first four digest bytes as an unsigned, big-endian integer. It rejects values at or above the largest multiple of 37 below 2**32, then takes the remainder on division by 37. If rejected, it increments the cursor and hashes again. The resulting integer is the pocket label, not its position around the wheel.

You can run this with Python's standard library:

import hashlib
import hmac

server = b"demo-server-seed"
client, nonce = "reader-check", 0
saved = "66eee71c64df159e2676b96e4fb069ba27a2915c095218d041c38950fd2882ce"
assert hashlib.sha256(server).hexdigest() == saved

limit = 2**32 - (2**32 % 37)
cursor = 0
while True:
    message = f"{client}:{nonce}:{cursor}".encode("utf-8")
    digest = hmac.new(server, message, hashlib.sha256).digest()
    value = int.from_bytes(digest[:4], "big")
    if value < limit:
        break
    cursor += 1

print("HMAC:", digest.hex())
print("Pocket:", value % 37)

The HMAC should be:

a369d50da6a7a0b4d216917a21007ef2cc31321c144f08f80e26bd6496e7fbf5

Its first four bytes, a369d50d, represent 2,741,622,029. That is below the rejection limit, 4,294,967,289. The working is:

2,741,622,029 = 37 × 74,097,892 + 25

So the result is pocket 25. If a hypothetical record using these exact rules showed 26, it would fail this check. For another game's record, changing the inputs isn't enough: its algorithm may use different encodings, digest slices or mapping rules.

A correct hash can still feed a biased mapping

A reproducible result can have the wrong probability distribution. Imagine an algorithm takes a uniformly random byte and uses its remainder after division by 37 as a roulette pocket. Every result can be recalculated, yet the pockets aren't equally likely.

The UK Gambling Commission's RTS 7 guidance, updated in 2024, says scaling must preserve the random generator's required qualities and outcomes must match theoretical probabilities. It also prohibits adaptive behavior that changes probabilities during play. These are useful benchmarks, not evidence that DefiPlay holds any particular regulatory approval.

Here's an exact, deliberately small illustration. A byte has 256 possible values, from 0 through 255:

256 = 37 × 6 + 34

Taking each value modulo 37 gives pockets 0–33 seven input values apiece. Pockets 34–36 get only six. This is modulo bias: the source range doesn't divide evenly into the outcome range.

Exact input counts for each roulette pocket under naive byte mapping, compared with equal counts after rejection sampling
An eight-bit teaching example: reject values 222–255 to give every pocket six accepted inputs.

Rejection sampling removes the unequal tail. Accept only values below 222, then take the remainder. Since 222 = 37 × 6, every pocket has six accepted inputs. A new sample is needed for a rejected value.

The chart enumerates possible inputs; it isn't sampled casino data. The runnable example uses a much larger range and the same principle. Your practical check is the mapping rule itself. “The hash matches” isn't enough if the algorithm assigns outcomes incorrectly.

On-chain VRF verification follows the transaction trail

A wallet transaction doesn't automatically prove how a result was generated. Say a receipt contains a winning pocket but no identifiable randomness request. That receipt records a result; by itself, it doesn't establish the random input's origin.

A verifiable random function, or VRF, adds a proof checked with a public key. RFC 9381, published in 2023, explains that the secret-key holder computes the output, while anyone with the corresponding public key can verify it. Its security properties include uniqueness and pseudorandomness, subject to the construction's stated assumptions.

For a fixed key and input, uniqueness prevents proving a different output under those assumptions. It doesn't prevent an application from choosing another input or requesting another draw. Nor does it force an oracle to respond promptly.

On-chain verification doesn't mean every computation happens on-chain. An oracle can calculate the output and proof off-chain, then submit them for verification by a smart contract. The distinction is where the evidence is checked and how the game uses it. The Chainlink VRF explainer covers that service in more detail; RFC 9381 is a general VRF reference, not certification of its implementation.

For an on-chain game, you can follow a different checking sequence:

  • Find the bet transaction and confirm its network, contract address, stake and recorded choices.
  • Identify the linked randomness request and fulfillment. They may appear in separate transactions.
  • Check that the receiving contract accepts the response through the intended proof-verification path and binds it to that bet.
  • Follow the verified output through the game rules to the recorded result and any payout transfer.

Exact event names and explorer fields depend on the implementation. A contract source listing helps only if it corresponds to the deployed code (and any active implementation behind a proxy). If that link is missing, the evidence remains incomplete.

DefiPlay's European roulette page describes the game context. For a specific bet, the transaction and contract path are what matter—not the animation.

An oracle proof examined at a public blockchain checkpoint before a game result reaches a wallet
Follow the proof through the game contract to settlement.

Verification doesn't erase losses or contract risk

A passing check can create false confidence. Say your losing bet reproduces perfectly, so you assume the next session is safer financially. Nothing in that proof changes the payout schedule or your chance of losing.

David Abuhanna's 2015 University of Nevada, Las Vegas thesis describes 37 pockets in European roulette and the standard 35:1 straight-up profit payout. Assuming equal pocket probabilities, a hypothetical one-unit straight-up bet has this expected net result:

(1/37 × 35) + (36/37 × −1) = −1/37 ≈ −0.027027 units

That's a 2.70% house edge, even with an unbiased result generator. It's a long-run expectation, not a prediction for your next spin. The house edge guide explains the economics without confusing them with cryptographic verification.

Contract risk is separate too. A valid random output doesn't establish that payout logic is correct, funds are available, or privileged functions can't alter game behavior. The smart contract audit guide explains what code review can and can't establish.

You don't need to increase your stakes to test any of this. Existing disclosed records or educational examples are enough. Adults who choose to gamble can set loss and time limits before play; the responsible gambling page offers further guidance. Proof isn't a reason to chase a loss.

A verifiable bet needs an unbroken evidence trail

The remaining problem is a gap disguised as a green tick. A seed-based checker may confirm the hash but omit the payout. An on-chain explorer may show settlement without making the randomness link clear.

For seed-based verification, you need a commitment saved before play, the revealed seed and a complete recipe that reproduces the recorded outcome. For VRF-based verification, you need the request, proof-verification path, outcome mapping and settlement tied to the same bet.

That is the useful meaning of provably fair: a specific claim supported by evidence you can inspect. Neither model deserves an automatic pass. A well-documented seed scheme can provide meaningful checks; a poorly connected on-chain record can leave unanswered questions.

If you can't reproduce or trace the result, the honest status is “not yet verified.” The missing field or transaction link is the next question for the operator. A badge cannot fill it in.

Frequently asked questions

What does provably fair mean in a crypto casino?

It means a game provides cryptographic evidence that lets you check a stated part of its outcome-generation process. In a seed-based system, you usually reproduce the result after the server seed is revealed. The proof does not remove the house edge or establish that every other part of the casino is safe.

Can I predict a result from the server seed hash?

A properly constructed commitment to an unpredictable server seed should not let you recover the seed or predict the result. A short or guessable seed can defeat that protection. The hash becomes useful for checking the seed after it is revealed.

What is the difference between a client seed and a nonce?

The client seed is a player-controlled input to the outcome calculation. In the model explained here, the nonce is a counter that distinguishes bets using the same seed pair. Neither is your wallet recovery phrase, and neither should require a private key.

Does a VRF mean all randomness is generated on-chain?

No. A VRF oracle can compute an output and proof off-chain, then submit them for on-chain verification. You still need to check that the game binds the verified output to the correct bet and applies its published rules.

Sources

  1. Manuel Blum, Coin Flipping by Telephone, 1981
  2. NIST, Secure Hash Standard FIPS 180-4, 2015
  3. NIST, The Keyed-Hash Message Authentication Code FIPS 198-1, 2008
  4. RFC 9381, Verifiable Random Functions, 2023
  5. UK Gambling Commission, RTS 7: Generation of Random Outcomes, 2024
  6. David Abuhanna, University of Nevada Las Vegas roulette thesis, 2015