Minefield uses a commit-reveal scheme with client nonces to guarantee fairness. Neither the server nor the player can manipulate the outcome.
How It Works
- Server commits: The server generates a random 32-byte seed and commits SHA-256(seed) onchain. The seed itself remains hidden.
- **Player picks with nonce:**The player picks a tile and submits a random 32-byte client_nonce. This nonce is stored onchain.
- Server reveals: The server reveals the raw seed onchain. The program verifies:
SHA-256(revealed_seed) == stored_commitment
- Mine placement: Mine position is determined using:
keccak256(server_seed || client_nonce)
- Repeat per row: Steps 1–4 repeat for every row. Each row has its own:
- server seed
- commitment
- client nonce
Why This Is Fair
- The server commits its seed before the player picks.
- The player submits a random nonce after the commit.
- Mine placement depends on both values:
keccak256(server_seed || client_nonce)
Neither side can control the outcome alone.
Post-Game Verification
After a game ends, players can verify every row.
- All server seeds, client nonces, and picks are stored onchain in the Game account.
- Run: