Provably Fair Mines Game: Building Hash Verification into a Grid Game

Palak Bhalgami Palak Bhalgami
Published
14 mins read
Provably Fair Mines Game: Building Hash Verification into a Grid Game

A provably fair Mines game commits to a hashed server seed before the round, derives the 25-tile layout deterministically from that seed, a client seed and a nonce, then reveals the seed so the player can recompute the grid. Building one means choosing a hash, a shuffle and an unbiased mapping from bytes to tiles, then publishing all three. A passing check proves one narrow thing: that this round matches what the operator committed to.

On this page

What Does a Provably Fair Mines Game Commit to Before the First Tap?

It commits to the server seed, and it does so by publishing only the seed’s hash. The operator generates a random seed, hashes it, and shows the player the digest before any bet is placed. The seed itself stays private. Because the hash cannot be reversed and cannot be matched by a different seed in practice, the operator cannot swap in a friendlier seed once it sees how the player bets.

Cloudbet’s Mines write-up describes a per-round version of this. The server generates a random 32-byte seed for each round and immediately publishes its SHA3-256 hash as the commitment. Other operators publish a SHA-256 digest and keep one seed alive across many rounds. Both are valid commit-reveal designs, but they differ in when the seed can safely be revealed.

Three inputs define every round:

  • Server seed: Operator-generated, secret until revealed, and the only input the player cannot influence.
  • Client seed: Player-controlled, so the operator cannot fully predetermine the layout when the commitment is made.
  • Nonce: A counter that increments per bet, so the same seed pair yields a different grid on every round.

Order matters more than any of these inputs. The commitment has to be visible to the player before the bet is placed, ideally on the bet screen itself, where it can be copied or screenshotted. A hash that appears only after the round proves nothing, because the operator could have computed it from whatever seed it preferred. If your UI buries the commitment in a settings menu, players will not check it and you lose most of the benefit.

Mines has a property that makes the commitment unusually strong. The full layout is fixed at the moment the bet is placed. Tile picks and cash-outs do not change it. So the commitment covers all 25 tiles, including those the player never opened, and the verifier can show the complete grid after a cash-out. That lets a player confirm that the tile they avoided really was a mine, which is the question most players have in mind when they verify.

Reveal timing depends on the design. In a per-round design, the seed is revealed as soon as the round ends. In a long-lived seed design, revealing the active seed would expose every future layout under it, so the seed is revealed only when it is rotated out. Either way, the rule is the same: never disclose a seed that is still in use. The same commit-reveal logic applies to reels, and our guide to provably fair slots verification covers how seed and spin results are checked there.

Provably fair technology gives players a way to check outcomes. It does not guarantee wins, and your copy should not imply it does.

How Does a Server Seed Become a 5×5 Mine Layout?

The hash output drives a Fisher-Yates shuffle over the tile indices 0 to 24, and the first M tiles in the shuffled array become the mines, where M is the mine count the player chose. One developer walkthrough of an HMAC-SHA256 design describes consuming 4 bytes of hash output per swap. The shuffle is deterministic, so anyone with the seed, client seed and nonce can reproduce the same grid.

Here is the shape of it in pseudocode. It is an illustration, not any operator’s spec:

def mine_layout(server_seed, client_seed, nonce, mines):
stream = byte_stream(server_seed, client_seed, nonce)
tiles = list(range(25))
for i in range(24, 0, -1):
j = uniform_below(stream, i + 1)
tiles[i], tiles[j] = tiles[j], tiles[i]
return sorted(tiles[:mines])

def uniform_below(stream, n):
limit = (2**32 // n) * n
while True:
x = int.from_bytes(stream.read(4), "big")
if x < limit:
return x % n

Two details deserve attention. The first is byte supply. A 25-tile shuffle needs 24 draws, and at 4 bytes each that is 96 bytes before any rejections. A single HMAC-SHA256 output is 32 bytes, which covers only 8 draws. A single HMAC-SHA512 output is 64 bytes, which covers 16. So the spec has to say how more bytes are produced, usually with a counter or cursor appended to the input, or with an extendable-output function that returns as many bytes as requested.

Why Naive Modulo Mapping Is Biased

The second detail is the mapping from random integers to a range. The tempting shortcut is x % n. It is biased whenever the number of possible inputs is not a multiple of n. Take a single byte mapped onto 25 tiles. There are 256 byte values, and 256 = 25 × 10 + 6. Tile indices 0 to 5 each receive 11 values while the other 19 indices receive 10, so those six tiles come up about 10 percent more often than they should.

With 4-byte words the skew shrinks a great deal, because 232 mod 25 is 21 and each residue already has more than 171 million preimages. But it does not reach zero, and the shuffle’s range changes at every step (25, 24, 23 and so on), so each step has its own leftover. A verifier that claims uniform layouts should not carry any known skew, however small.

Rejection sampling removes it. Compute the largest multiple of n that fits in the input range, discard any draw at or above that limit, and draw again. Every accepted value then maps to each residue equally often. The cost is a few extra draws on rare occasions, which is why the byte supply must be able to extend.

Cloudbet’s approach is a clean example. Its Mines grid is built with SHAKE256 and rejection sampling to avoid modulo bias. SHAKE256 is an extendable-output function, so running out of bytes is never a problem. Whatever construction you choose, your spec should state how rejections consume the stream, because that detail changes every layout downstream.

Which Hash Functions Do Mines Verifiers Use, and Why Does the Choice Vary?

There is no shared standard. Some verifiers use SHA-256 or HMAC-SHA256, Cloudbet uses SHA3-256 with SHAKE256, and Rainbet’s Mines verifier uses HMAC-SHA512. The older assumption that every provably fair game runs on SHA-256 is simply not true across operators. Even where two games share a hash, each game’s verifier defines its own input order, counter rule and output mapping, so a player has to use the specification the game itself publishes.

The variation has practical causes. Teams pick a hash for the byte supply they need, for the libraries available in the browser verifier, or for lineage from an earlier game on the same platform. A 64-byte HMAC-SHA512 output halves the number of blocks needed for a shuffle compared with a 32-byte one. An extendable-output function removes the counter question entirely. None of these choices is inherently unfair. What matters is that the choice is documented and reproducible.

Design choice Common variations Why it changes the result
Commitment hash SHA-256, SHA3-256 The published digest must match the hash the verifier uses
Derivation HMAC-SHA256, HMAC-SHA512, SHAKE256 Different functions produce entirely different bytes
Input order Server seed, client seed and nonce in varying positions and separators Swapping two fields gives a different grid
Counter rule Cursor, round index, none Controls how extra bytes are produced
Output mapping Modulo, rejection sampling Determines uniformity of the layout
Shuffle direction Forward, backward, first M or last M Changes which tiles become mines

For the primitives themselves, rely on the standards rather than on a blog’s description. NIST FIPS 202, the SHA-3 standard, defines SHA3-256 and the SHAKE extendable-output functions. NIST FIPS 198-1, the HMAC standard, defines the keyed-hash construction that the HMAC-based designs build on. Both give you test inputs and definitions you can check your implementation against.

Standards cover only the primitive, not the game. FIPS 198-1 does not tell you whether the server seed is the HMAC key or part of the message, and neither document says how to turn bytes into 25 tiles. Those choices belong to the game’s spec, and they are where verifier mismatches come from. A player who runs a third-party calculator that assumes a different input order will see a mismatch and may wrongly conclude the round was rigged.

Two consequences follow for you as a builder. Publish your own spec rather than pointing at generic descriptions of provably fair systems. And if you ship a verifier alongside the game, make sure the verifier and the game run against the same documented spec, ideally from the same code. If you are mapping this onto a wider catalog, our provably fair casino game development guide places Mines next to other game types and shows where each needs its own spec.

Why Does a Passing Round Check Still Leave Seed Grinding Open?

Because a round check proves only that one outcome came from the committed seed under the stated rules. It says nothing about how that seed was chosen. In seed grinding, a dishonest server generates many candidate seeds, computes the outcome each would produce against a known client seed, then commits to the one that favors the house. No hash is broken, and the fairness proof still validates.

Think about what the verifier actually tests. It takes the revealed seed, hashes it, compares the digest with the commitment, reruns the derivation and compares the grid with what the player saw. Every one of those steps passes in a ground round. The dishonesty happened before the commitment existed, in a selection step the verifier cannot see.

How Grinding Works Against a Grid Game

Grinding needs the server to know, or predict, the client seed. Many players never change the default. Against a known client seed and a predictable nonce sequence, the server can search seeds until the early rounds place mines on tiles that players often open first. The scale of the search is cheap, because hashing is fast. This is not a flaw in the hash function. It is a flaw in the process around it.

The defense is procedural. A forced rotation policy limits how long any seed and client seed pair stays in play, so a server cannot tune a seed against a long-running client seed. Pair that with ordering: publish the commitment first, then let the player set or change the client seed, and require the client seed to change on rotation. Once the player picks the client seed after the commitment exists, the server can no longer search against it.

You cannot prove the absence of grinding from a single round. What you can do is make it detectable and costly. Publish each commitment in an append-only log, rotate on a schedule that you document, and let players supply their own client seeds. Statistical review over many rounds then has a better chance of surfacing a skew than any single check does.

What a Passing Check Does Not Cover

Even with grinding closed, verification has a boundary. A verifier does not automatically confirm the current RTP, the maximum win, bonus restrictions, KYC rules or withdrawal terms. Those need separate review. Provably fair verification tests how an individual round was generated, and only when the inputs and rules are available.

RTP is the clearest example. In Mines, the house edge sits in the payout multiplier curve, meaning how much a safe reveal pays for a given mine count. A perfectly verifiable layout can sit behind a stingy multiplier table. Duel, for instance, describes its Original games as both provably fair and running without a conventional house edge. Those are two separate claims, and the first does not verify the second. Players who want to judge the multiplier side can start with our breakdown of Mines strategy and the math behind it.

Treat the verifier as one control among several. Publish the multiplier table, the maximum payout and the settlement terms next to it, and be explicit about which claims the verifier supports and which it does not.

How Should You Build and Publish the Mines Verifier?

Build it so a stranger with no access to your systems can reproduce any round from public inputs. That means a fixed generation sequence, a published commitment before every round, and a verifier whose spec and test vectors are public. The order below works well in practice.

  1. Generate seeds with a CSPRNG: Use your platform’s cryptographically secure random source for server seeds, at a fixed length such as 32 bytes. Never derive seeds from timestamps, counters or user data.
  2. Publish the commitment first: Hash the seed with your chosen function and display the digest on the bet screen before the bet is accepted. Store it server-side before the round starts.
  3. Let the player set the client seed: Accept a player-supplied client seed after the commitment is visible, and keep a sensible random default for players who never change it.
  4. Derive the grid deterministically: Take server seed, client seed and nonce, produce the byte stream, and run the Fisher-Yates shuffle with rejection sampling as described above.
  5. Reveal after the round or at rotation: Per-round designs reveal when the round ends. Long-lived seeds reveal only when rotated out.
  6. Ship a verifier: It should take the seed, client seed and nonce, plus the mine count, and return the 25-tile layout. Show the commitment check and the grid result separately so a player can tell which step failed.
  7. Publish test vectors: Provide fixed inputs with the expected digest and the expected layout, including at least one case that triggers a rejection. Independent implementers can then confirm that they match you.

Three operational practices keep the system honest over time. First, set a forced rotation schedule, by round count or elapsed time, and publish it. Second, log every commitment in an append-only record with timestamps, so any later claim can be checked against what was shown at the time. Third, version your spec. If you change the hash, the input order or the mapping, give the change a version number and keep the old spec available so past rounds remain verifiable.

Documentation is where many implementations fall short. Your spec should state the hash functions, the exact input encoding and separators, the counter rule, how bytes become integers, the rejection limit, the shuffle direction and which end of the array holds the mines. Include one worked example with every intermediate value. If a player’s own script cannot reproduce your result from the page, the spec is incomplete.

The generation layer deserves the most scrutiny, because every other control depends on it. If your seeds come from a weak source, the commitment and the verifier will still pass while the underlying randomness is predictable. Teams that want an audited, reusable source across several games usually put it behind a single service, which is the case for RNG engine development as a platform component rather than a per-game feature. Whether you build it in-house or not, keep seed generation, game logic and verifier code under the same documented spec, and keep the verifier simple enough that players can read the source.

Provably Fair Mines Game FAQs Developers Ask Most

What is rng in games?

RNG stands for random number generator, the component that produces the unpredictable numbers a game uses to decide outcomes. In a Mines round, the generator decides which of the 25 tiles hold mines. Provably fair designs replace a hidden generator with a published commitment and a revealed seed, so the output can be recomputed after the round.

What is rng in video games?

In video games, RNG usually refers to the generator behind drops, critical hits, spawn positions and similar random events. Developers often seed it so a session can be repeated for testing. Grid games like Mines use the same mechanism but must also let a player confirm the result was fixed before the bet.

How can a player verify a Mines round?

The player needs the revealed server seed, their own client seed, the round’s nonce and the verifier rules the operator publishes. Hashing the revealed seed must match the commitment shown before the first tap. Running the same shuffle must then reproduce the mine positions the player saw.

Does a verified Mines round prove the game's RTP is fair?

No. A round check only shows that one outcome came from the committed seed and the stated rules. Return to player, max win and withdrawal terms are separate questions that need review against the operator’s published terms and the game’s certified math.

What is seed grinding in a provably fair game?

Seed grinding is when a dishonest server generates many candidate seeds, works out the layout each would produce for a known client seed, and commits to the one that favors the house. Every hash still verifies, so the check passes. A forced seed rotation policy, which replaces the server seed on a fixed schedule, is the standard defense.

Palak Bhalgami

Palak Bhalgami

Palak Bhalgami brings 6+ years of expertise in iOS application development and 4 years of experience in Project Management, with a strong foundation in agile delivery as a Certified Scrum Master. At Source Code Lab, he provides strategic leadership and technical oversight for the delivery of enterprise-grade iGaming platforms, ensuring operational excellence, scalability, and adherence to business objectives.

Location Map

Let's Build Success

From concept to launch, we help build winning gaming platforms. Let's discuss your project.

Blog Form