Introduction to Provably Fair Gaming Algorithms 🤖
Provably fair gaming algorithms are pieces of code based on the blockchain that are already making online gambling a more secure, more fair and more exciting experience. The new element regarding these algorithms is the transparency they come with, but at the same time the simplicity of their internal workings. What is a provably fair gaming algorithm? How is it different from the algorithms that are used in the business today? How are these algorithms going to make your gaming experience better? Keep on reading this introductory guide to provably fair algorithms to find out.
Black box algorithms, the norm in today’s industry
Before diving into the definition and internal structure of a provably fair algorithm, let’s first take a look at what the industry of online gambling is using for a fair gaming experience in today’s world. The piece of code used to determine the correct outcome for your typical roulette wheel spins and Texas Hold’em hands in today’s casinos all over the internet is called a black box algorithm.
A black box algorithm, while trusted by millions upon millions of gamblers all over the world, is an unknown to basically every single poker, roulette or slots player out there. Not only to them, but to everyone around them as well. As the name suggests, the black box algorithm is forcing players to trust a third-party service that’s generating unbiased random data used for the outcome of the games that they’re playing.
Whenever you spin the reels during a Book of Ra game, whenever you play some Hold’Em with your friends or whenever you place your bets for the final card at blackjack, the results that come out for you are made up by using the black box algorithm. The black box is a machine learning program capable of putting out unbiased, unrelated and completely random results for these games that are based on luck in the real world.
As we move online, the fact that these algorithms are unexplained, that nobody knows how they work from the inside out, stand at the base of why the industry starts to question its very core of existence and functionality. Are black box algorithms trustworthy? Are players going to get more and more discouraged from playing because they simply don’t know how their games are running? Are the results people get in games as fair as they can be?
Introducing the provably fair algorithm
Lately, a new generation of coders have worked hard to come up with a better, more open and direct way of automating random results in a virtual poker room. It’s called provably fair, an algorithm that’s based on openness. While black box algorithms focus on keeping the black veil all around its internal mechanics, provably fair algorithms are designed to have their fair parts verifiable by everybody, including the people who are playing online stake games.
Concepts of provably fair algorithms
In order to make an algorithm that decides the fate of a virtual poker hand as fair as humanly possible, without having a human involved, we first need to understand just how random things can get when you use a machine instead of a dealer. This very important part of any video poker game is done by a pseudorandom number generator, which provides a sequence of random outputs initialized by a seed. Because the parameter of initialization is present, it ultimately acts as a verification key for the same results that it comes up with.
This seed has two main parts, the hostSeed and the publicSeed.
hostSeed: Similar to a private key from cryptography, the hostSeed is kept secret until the very end of a particular game.
publicSeed: This is the seed that’s available to any player, but only if he or she contributes to it directly and after a commitment has been made, as in, a bet has been placed and the outcome of the hand played has been exposed to every participant of the game.
The algorithm uses a mixture of the hostSeed and a multitude of publicSeeds in order to initialize the parameters for randomization, on which every player has a fair share of influence on the outcome of the very hand that they’re playing. On the blockchain, on which the provably fair algorithms are based, the peer-to-peer network characteristics are built in such a way that every player is also a host of the game, similar to real life. Although they’re not all around a real table and able to see the dealer shuffling the cards, their online presence is having an almost identical effect while they’re playing the game on their devices.
The initialization cycle
When you’re playing a game of poker, whenever the hand is dealt to you and your opponents, an initialization cycle starts. It doesn’t matter if you play against other people or a computer. A hostSeed gets initiated at the start of the hand, which therefore allows for each player to generate a publicSeed by using a trustless randomization service. On the blockchain, this can be the hash of a specific incoming block in the blockchain of a cryptocoin, for example. This makes it impossible for players to have a direct influence on the in-game randomization.
As soon as the hostSeed is revealed, which in a game of poker is the final outcome of the hand, the outputs that the algorithm generates are reproducible, if and when the random results are proven to be unmanipulated in favour of any player at the table. When this happens, the initialization cycle can start all over again, and so can a new hand of poker.
How is an algorithm provably fair
There are a few rules an algorithm must respect in order for it to be named a provably fair algorithm. One of the main aspects is, the algorithm behind a game of chance is a provably fair one if every player at the virtual table has an equal amount of influence on the in-game randomization processes, in a verifiable manner at hand for all other players.
Besides the general rule, the provably fair algorithm has to pass what the industry calls necessary criteria in order to be fairly usable in a game of chance:
- No pages left unturned: the algorithm must be completely public, for every participant of the game;
- Verifiable before every hand: the algorithms’ hostSeed, as well as its integrity, must be verifiable by players before every single playable hand;
- The usage of both Seeds is mandatory: the hostSeed and the publicSeed must be used as a pair, never as individual systems;
- Determinism: No matter the input, the algorithm has to produce the same output over and over again, for as long as the game is played.
Types of provably fair algorithms
All online video games you’ll find on virtual casino portals are influenced by random choice. Provably fair algorithms work to randomize things like rolling a dice, flipping a coin or shuffling a deck of playing cards. While all these things are fairly straightforward in the real world, in the virtual world it’s much harder to determine a fair way of doing this that is not only unhidden, but verifiable by the people playing a certain game. Because of this, provably fair algorithms fall into two main categories:
1. Algorithms that generate a single random output
These algorithms are based on the idea that the output generation function, as in, the function that generates the outcome of a spin of a roulette wheel, is hard to invert. This makes it impossible for the outputs to be predictable and therefore end up in the possession of a player, at least not before the hostSeed that holds the revelation of the outcome is made public.
2. Algorithms that generate a sequence of random outputs
Things are a little more complicated when multiple players are around a table and playing a sequence of randomly generated results. After every round, a new publicSeed has to be generated, which is influenced by every player or, according to surroundings, by a trustless service, and then used before the placement of bets for the following round. This is done with the help of a nonce, which is unique and predictable.
This nonce can only be used once for each set of seeds, and added to the publicSeed, which will enable it to produce unique outputs for consecutive bets made under the same seed. To better understand the idea of a nonce, think about the action of shuffling a deck of cards. When this happens in the virtual reality of a game of poker, multiple parameters are used in order to construct a nonce that mimes the real-world action. Here, the nonce is both the round identifier and the shuffling of the playing cards at once.