Provably fair explained

Provably fair is an algorithm based on technologies that allow online randomization to step up and reach a new level of fairness and openness. In short, the algorithm uses the benefits of the blockchain in order to make actions of randomization, such as shuffling a deck of playing cards or flipping a coin, as random as they can be. The difference between provably fair and the typical black box algorithms that are now used in the gaming industry? The process of randomization is verifiable by all players of a certain game. This infographic below explains it all.

Provably fair infographic

Provably Fair Explained - Infographic

Download this infographic as a PDF →

Provably fairness is the process which allows players from all over the world to manually and personally verify the fairness of the games that they’re playing online. In order to achieve this, casinos that work on the blockchain use a special code called the provably fair algorithm. The algorithm generates an encrypted key with the end results of the game, sends it to the player alongside another key that will allow them to verify the correctitude of the games at the end of the session.

Provably fair casino versus a regular casino

Provably fair:

  • Use the provably fair algorithm that generates the hands and keeps them in a hash that can later be verified by players;
  • Don’t need to use third party companies thanks to the provably fair algorithm and the blockchain, which is a public ledger.
  • Don’t need to use third party companies thanks to the provably fair algorithm and the blockchain, which is a public ledger.
  • Thanks to the provably fair algorithm and the blockchain, which is a public ledger, they don’t need to be acknowledged by any authority.

Regular:

  • Use random number generators for the outcomes of hands that are played;
  • Don’t allow players to personally verify the correctitude of the hands that are played;
  • Are only trustworthy if you trust the third party companies that review casinos for legitimacy.
  • How does provably fair casino works?

There are more than one ways to implement the provably fair method to online casinos. We will stick to the most common one here. The algorithm calculates a roll-result each time there’s a new hand that’s been played, by using three variables:

  1. Serverseed: this is provided by the casino itself;
  2. Clientseed: this is provided by the browser you’re playing on;
  3. Nonce: with each new hand, this variable increases by one so you can keep track of which hand is which by the end of the session.
    Before you start you will get a hash of the serverseed, which is encrypted. This hash contains the entire game you’re about to play, so the casino cannot change it no matter what. Also, because it comes to you in an encrypted code, you yourself cannot calculate any results for the hands you’re about to play.

Verify the results

When you start playing, you're not getting the unhashed serverseed beforehand. That would imply you being able to read it and play all hands as a winner given that the seed holds the information about all of the results of the hands you're about to be dealt. Instead you will get a hashed serverseed when your session is over, which you will use to reveal the old, unhashed serverseed. In order to verify if you've been cheated on or not, you have to go through 2 easy steps:

  1. Make sure that the hashed serverseed that the site is throwing at you is the actual hash of the unhashed serverseed. If this is the case, you're fine. You know that the site has given you the right serverseed and you can go ahead and verify the fairness. For all you know, the site can be throwing a fake serverseed your way.To verify the seed, use an online tool like Xorbin to generate the SHA256 hash of the unhashed serverseed. Once you do that, you can check to see if the two hashes are the same. If they are, you can calculate the results and compare them to the ones provided.
  2. You will have to generate each roll result by yourself, and then compare it to the rolls you made on the site. This will take some time if you’re doing it manually, which is why it is better to use an online tool and speed things up.

Calculating with the nonce

There can be tens, hundreds, even thousands of bets one makes during one session. Which makes manual calculations and comparing the results of the serverseed with your actual results a tad hard.

The best thing you can do is to use a provably fair verifier. Most of the popular sites that deal with provably fair games have verifiers, so you can easily make sure the rolls or hands played were dealt fairly.

All one has to do is to come with the seeds and the number of bets that have been made and then let the verifier check the serverseed hash and come back with the list of results.

The list can be compared to the results at the casino. If the results match, this proves that the provably fair algorithm is implemented correctly and that all games have been played fair.

The process behind the provably fair algorithm

Like most coding and algorithms cases, provably fair is easy to set up and implement if you’re a coding expert. For the novices such as everyday people or gamblers, it’s a bit harder to make sense of these technical terms, but we’ll do our best. There is more than one implementation method for the provably fair algorithm, but the one that is most common has three important variables that are calculated every single time a game is played, the server seed or hostseed, the client seed or public seed, and the nonce.

The server seed is the variable that is provided by the gambling site. The client seed is the variable that the client provides, the gambler in this case, through his browser or downloadable client in which he plays the game. Finally, the nonce is a random number that increases every time you place another bet.

Encryption in provably fair games

The first thing that happens is that the players get an encrypted hash of the server seed before they start playing. As the hash is sent to all players in advance, the site can’t interfere with it and therefore is unable to ever change it later. And because the hash is encrypted, you cannot reach into the data and see what the end result will be. Let’s take poker as an example. You will have a flop, turn and river. The result is already in the hash, but because of the encrypted data you will not know the outcome before the river has been dealt. The cards are played beforehand, and although the final result is already out there, it stays unreachable to everybody at the table until the end of the game.

After this happens, you will get a random client seed that’s generated from the browser you’re playing through. The client seed is customizable, meaning the players can have a saying in the outcome of the game without knowing the outcome of it by adding numeric values to the main seed. For example, the players can cut the deck virtually, resulting in a completely random new order of the virtually shuffled deck of cards. This makes the client seed unique and doesn’t even allow the casino portal to know what the outcome is beforehand. You can leave the client seed as it comes from the browser, or you can change it as you find it suitable. The nonce, the final variable, starts from zero and adds 1 to itself every time you place a new bet.

The starting bet the nonce is a 0 or a 1, this number is depending on the website. After each bet you make, the nonce number will go up by 1. From here on, the provably fair algorithm will use the seeds and the nonce to randomly select the roll of a dice, the flip of a coin or any other randomizable action it has to partake in a game. When the results are in, the code takes the nonce from 0 to 1, then from 1 to 2 and so on, keeping the results it provides unique.

How to verify if you’ve been cheated or not

Of course, you cannot verify the server seeds while playing a game. You can do this at the end of your session, when all bets are over and the players are away from the game table. This is because, if you were to get access to the server seed in advance, you’d be able to generate all rolls beforehand and win all hands. At the end of the game, generate a server seed in a hashed manner, which will ultimately reveal the last unhashed server seed, the one used during your play. In order to verify the fairness of the bets and if you’ve been cheated or not, you have to:

  • Make sure the hashed server seed you have is the actual hash of the unhashed server seed. If that’s not the case and the portal has given you a random hash, it most likely creates fake outcomes and therefore cheats the game.
  • Generate every roll result yourself, and compare these results to the ones you got while playing. You calculate the roll results using one of the many only tools for this action and see if they match based on the seeds you’ve got. If they do, you haven’t been cheated.

Example of the provably fair algorithm in action

FortuneJack is one of the casino's that are based upon the blockchain and naturally the provably fair algorithm. Their system works similarly to the general principle, by generating two seeds which, once combined, generate the winning outcome of a game. By the way the code is written, nobody playing a game on the platform can determine and predict the outcome of the game, but can verify its fairness at the end of playtime.

One seed, the main one, is generated by FortuneJack. The seed is created before the game starts and then it gets hashed. The hash is then made available to all users to see, without regard if a game is still being played or has been finished.

The secondary seed is generated by the random.org randomiser after every single round of the game. In a game of coin flip, the moment the outcome of the last flip is generated, a new secondary seed is released by the code. Every time random.org comes up with a new seed, this seed is given a serial number value, meaning Rush Chance can’t multiply or do any funny business, to put it bluntly, in order to get a favorable result, one which would be in their favor and make players lose their money by betting on their site.

The main and secondary seeds are combined with a hyphen and converted into a long number, which is then used as a seed for pseudo-random number generating. This generator comes up with the results of a coin flip or the winning numbers on a scratch card ticket. If the values of the winning outcome are correct, when you verify the rolls later, they should match exactly with your results.

Provably fair conclusion

To summarize the entire idea of provably fair algorithms, you need to remember three very important steps:

  1. When the game begins, you receive a token or a seed that is kept secret;
  2. The machine uses an algorithm to generate random outcomes based on the seed;
  3. At the end of the game, you can use the seed given to you at the beginning in order to verify the fairness of the game that you’ve just played.