How “Provably Fair” Gaming Works, Comic Book Style

Gambling, by its very definition, is the opposite of safe. When you gamble, you’re taking on a sizeable chunk of risk in exchange for a potential reward. And that reward is all based on chance, unless you’re playing blackjack, poker or another skill-based game.
Vast swathes of the world population gamble online these days, and they do so via gambling sites that are centralised, just like 99.9% of the current institutions in society.
This shows that people are willing to embrace the risk, but at the same time, faith in the trustworthiness of online casinos and other gambling platforms remains a contentious issue. Many players complain of lack of transparency and misconduct by gambling sites which still cheat players, despite growing regulation across the globe.
Blockchain’s going to change all of that.
At the moment, you have to trust that the online casino or gambling site you’re playing at is presenting you with the real, fair outcome of your game. The catch is that you have no way to prove it.
What you can do — and this is what players normally resort to — is rely on your own judgement and the arbitrary indicators (such as licensing, RNG certification, player reviews etc.) of a trustworthy casino.
“Provably fair” gaming goes a step further. When a gambling site operates on blockchain, you can verify the outcomes of a game yourself. One by one. Without having to trust the operator at all.
You’re the judge now: the concept of “provably fair” gaming
The fundamentals
Provably fair gaming sounds pretty cool. But how does it actually work?
The principles underlying the technology are the same thing that’s brilliant about bitcoin. Let’s go over these quickly so you get a basic grasp of what we’re talking about:
- Blockchain: A public ledger of transactions visible and accessible to all users on the network. The verified transactions are added to the public ledger in batches called “blocks”. These blocks are mathematically linked to each other in the “chain” so that the entire network can detect corruption of any transaction on the blockchain.
- Bitcoin: A cryptocurrency that was the first real-world application of blockchain technology. The value transferred and verified on this blockchain is bitcoin (denoted as ฿, BTC, mBTC or satoshi), which works like a virtual currency.
- Ethereum: A public, open-source, blockchain-based software platform that allows many individuals and developer communities to build and run Dapps and smart contracts.
- Dapps: Decentralised applications built and run on the Ethereum blockchain.
- Smart contracts: An agreement between two or more parties executed on the blockchain. The conditions, obligations and other details of the contract are recorded on the blockchain for all users to access, so they cannot be corrupted.
- Hash cryptography: Digital fingerprinting system consisting of private and public keys (or cryptographic hash functions) that are used to store and verify transaction records securely on the blockchain.
- Hashes: A piece of data encrypted as a mathematical problem. It’s usually a long string of characters that’s extremely difficult to solve. If a hash is decoded, it’s easy to backward test it to see if the solution is correct or not. Hashes are hard to solve but easy to verify a solution for.
- Seeds: Extra data (a string of characters) applied to hashes which modifies what is hashed.
How it actually works
So, picture a provably fair casino game. The game interface would look something like this for a provably fair slot:

A few pointers for the terms used:
SHA256 seed = the casino’s own secret seed number
Client seed = the player’s seed number
Server seed = the server’s seed number
This is what happens when you play the game in the provably fair mode:
- The casino server generates a secret seed number before the bet occurs.
- The player is given a seed number which can be randomised (changed into another random number for additional security by pressing the “Randomise” button or doing it manually).
- The seed numbers of the casino server and player are combined with the bet number (slot spin #3 if it’s your third bet, for example) and turned into a hash.
- The slot is spun and the bet takes place. This is recorded on the blockchain.
- After the bet, the player can see the casino server seed number used in the bet. So the secret is revealed, but it was published and added to the hash before the bet happened, so it couldn’t be tampered with.
- If the casino server seed number matches the hash related to the bet, the outcome has been proved 100% fair.
- If the casino were to try manipulating the bet outcome in any way, the casino server’s secret seed number would change. This would, in turn, modify the hash function and the bet would be rendered invalid.
There are slight variations in how provably fair casinos and games execute this sequence of events, but the gist remains the same.
The comic book strip demonstration
All this programming speak might still be tough to understand for some, so this is the best real-life analogy we’ve come up with.
Imagine you’re in a casino gaming floor with a string of vending machines connected to each other and regular slot machines scattered around.

The vending machines are not controlled by the casino. They run independently of the establishment.
Before you start betting, you get a scratchcard from the casino reception desk.

This scratchcard has a secret number created by the casino behind its metallic strip.

You can’t see it yet, but it’s there. And nothing and no one can meddle with it now, because it’s in your hands. This is the casino’s signature, key, fingerprint… Call it whatever you like.
Then you go to any one of the vending machines, which gives you another scratchcard.
But this one’s a bit special. It’s a “build-your-own” scratchcard, since you’re the star of the show in this set-up.

It comes with a random number pencilled on it, but you can erase it and write another number if you want to be extra sure it’s a totally random number.
And if that’s still not enough, you can rub it off again and pencil in a harder number. Repeat for as many times as you like.

Once you’re happy with the randomness of it, the vending machine prints a metallic strip on top of your creation. That’s your scratchcard with your secret number for the bet.

Then you feed the casino’s scratchcard and your own to the same vending machine.
The machine reads what’s under the metallic strips and creates a new scratchcard combining both these values, plus an additional string of random numbers.

By the way, all this activity isn’t just recorded by the vending machine you’re dealing with.
It’s registered and stored by all the other vending machines connected to it, so anyone who’s using vending machine B can still see what vending machine A has been up to.

And because all of them are interconnected and there are others in other parts of the world which are also connected to this network, the system can never go down.
So you take the super scratchcard and proceed to a slot machine to make your bet. The slot machine is programmed to generate a number for each spin, like a bet ID. This is shown on the slot machine’s screen.

The slot machine pulls data from the casino reception desk about the secret number used for the scratchcard, which becomes part of the bet ID.

It also pulls data from the vending machine to include the number on the scratchcard you created, plus the random number added to these to form the super scratchcard number.
It’s finally time to scratch your supercard!

This is where the “provably fair” magic happens: the numbers on the super scratchcard and the bet ID on the slot machine screen have to match.

What’s crucial is that the bet takes place after the casino hands you the scratchcard with the secret number.
So if the casino decides to cheat and modify the number given to you on the scratchcard in the time it takes you to make a bet, it’ll change the bet ID shown on the slot machine.

And you’d only have to look at the super scratchcard in your hands to verify that the bet ID is false. This invalidates the bet.

Meanwhile, the vending machines have been monitoring all this stuff in the background.
With the power of all of them stacking the evidence in your favour (and the power being distributed amongst countless vending machines under no single ownership), you can get your invalid bet refunded from your vending machine straight away.

No need to walk up to the casino reception desk and demand a refund against their will.
In a nutshell: go fair or go home.
Get your hi-vis glasses on. The future looks decentralised. We want to hear your take on safe gambling and blockchain — write to us!
This article was originally published on Bojoko.com — read the full story here.
