🎲 Building a Provably Fair Gaming Platform
This project started as part of my NEA segment for A-Level Computer Science. I originally built a provably fair gaming platform using only vanilla HTML, JavaScript, and CSS. While the interface was extremely simple, the underlying logic was solid—and I really enjoyed building it.
The following summer, I decided to expand the concept using the React JS framework. This version was still a bit rough around the edges, but it marked a real milestone in my technical growth. I began to understand the fundamentals of React and frontend architecture.
For handling deposits and withdrawals, I used the Solana blockchain to build a basic escrow system I wrote from scratch.
🤔 What Is “Provably Fair”?
In a physical casino, you can assume the games operate as advertised. But once you step into the digital world, it’s fair to question whether the odds are truly fair—or if the outcomes are rigged in favour of the house.
Provable fairness is a cryptographic approach to proving that game outcomes weren’t tampered with. It shows you a representation of the uncertainty in the game—before your bet is even placed—so you know the outcome isn’t influenced by your wager.
For example, in a provably fair roulette game, the platform might pre-commit to the winning number (in a hidden form) before any bets are placed. Once the game ends, it reveals the committed value, allowing you to verify that it matches the pre-generated result.
🔍 How It Actually Works
The core concept involves three values:
- Server Seed – A long secret value unknown to the player, committed by the server.
- Client Seed – A value visible to the user (and optionally set by them).
- Nonce – A number that increases with each game played, ensuring each round is unique.
These three values are used together in a formula to generate the game's outcome. The result is determined before the bet is placed, but only revealed after the game ends.
Once the game is over, the platform reveals the secret server seed. The player can then re-run the same formula using the known client seed and nonce to reproduce the outcome.
Additionally, the server seed is typically hashed before the game starts using a public algorithm (e.g. SHA256). This allows players to verify the revealed seed matches the original hash—proving it wasn't tampered with after the bet.
Curious about the actual math behind it? Click here to read my full blog post on the formula.
🛠️ Tools Used
- Flask – Backend API and logic
- React – Frontend interface
- Framer Motion – Animations and transitions
- Tailwind CSS – Styling
- Solana Blockchain – Deposit & withdrawal system via escrow
This project gave me a deep appreciation for fair systems and trustless verification. It was a turning point in my interest in both cryptography and frontend development—and a great reminder that even simple-looking projects can carry powerful ideas underneath.