If you are into iGaming, then you must have seen the word Provably Fair quite often. What is it and how is it changing the iGaming industry?
In online gambling provably fair describes an algorithm that can be analyzed and verified for fairness on the part of the service operator. Provably fair algorithms are often used in the operation of an online casino.
c038dc4a-66cf-4e32-bb87-f092f55d8a45-image.png
Not long ago, offline casinos or classic online-based casinos did not provide such verification functions. Then how did players have enough trust to play at those sites?
They simply did not care enough.
They trusted the name value of the brand. This was mainly how big casinos were able to keep their loyalty as they have proven to be trusted by many people previously.
This is extremely beneficial for players as they can immediately verify the fairness of the game for themselves. While a majority of players may never question that a game is fair, the small minority that does will have their concerns quickly addressed by putting in the random seed into the algorithm for themselves.
Example of Provably Fair
Let’s take an example with Rocket’s Provably Fair algorithm.
Rocket researches and realizes a fair platform that guarantees player security by using the Provably Fair concept and prevents the chance of manipulation. We have been deeply researching the concept of fairness for many years and have been operating and verifying our own service while continuously modifying it. We prolong to expand the platform to provide a fair and safe user experience in a wider variety of games.
f30e3f76-c181-400c-bb94-291ea1e42fbd-image.png
Rocket’s random number generator (RNG) facilitates SHA256 hash function and uuid4.
First of all, for provable fairness, RNG generates the list of hashes. Each element in the list is the hash of the previous hash. The first hash is generated by uuid4. Then the list is reversed so that it provides the consecutively verifiable hash list, i.e. hashing the current hash outputs of the previous game’s hash. This reversed hash list is uncheatable and easily verifiable because no one can predict the next hash in the reversed hash list in a reasonable time and anyone can verify the current hash is valid by hashing the current hash.
Each game uses a random number for its own use. For example, Rocket Run uses a random number to calculate the game result.
Implementation
const N_BITS = 52;
function verifyRocketrun(hash, salt) {
const seed = sha256.hmac.update(salt, hash).hex();
const hex = seed.slice(0, N_BITS / 4);
const parse = parseInt(hex, 16);
const hashValue = big(parse).div(big(2).pow(N_BITS));
const bust = big(99).div(big(1).minus(hashValue)).div(100).round(2, 0);
return Math.max(1, Number(bust));
}
Input ( seed ) is a hash from the reversed hash list. Input (salt) is for updating the seed hash. With the updated hash, we use 52 most significant bits out of 256 bits from the SHA256 hash function. Then its integer value becomes [0; 1) real number. This uniformly distributed random number between 0 and 1 is used to calculate the payout/bust. For the verification of the game result with your hash and salt, please refer to Verify Rocket Run.
function verifyAqua(hash, salt): gameResult {
const game = new game(hash, salt);
game.start();
let alive;
do {
alive = game.dive();
} while (alive);
return new gameResult(game);
}
Basically, Aqua’s game logic is similar to Rocket Run’s in which it calculates the game result with provided hash and salt. Aqua’s verification process proceeds throughout the multiple stages until the user loses. When the game.start() function is called(), it prepares the stages and fishes with random numbers from the hash and salt. When the game.dive() function is called(), it simulates the game with random numbers resulting in win (alive) or lose (dead), and the process continues until the player loses.
For verification of a game result with your hash and salt, please refer to Verify Aqua.
function verifyBoom(hash, salt){
const seed = sha256.hmac.update(salt, hash).hex();
const hex = seed.slice(0, N_BITS / 4);
const parse = parseInt(hex, 16);
const n = Number(big(parse).div(big(2).pow(N_BITS)));
return Math.floor(n * 4) + 1
}
Boom’s game logic is similar to that of Rocket Run. In Boom, every game has a salt and a hash. These two values generate an integer from 1 to 4 which is the number you can choose to survive from the bomb. The winning probability is 75%, so your payout is 1.32x for each game. You can add up your payouts as long as you survive. Verify Boom.
function verifyDice(hash, salt) {
const seed = sha256.hmac.update(salt, hash).hex();
const hex = seed.slice(0, N_BITS / 4);
const parse = parseInt(hex, 16);
const hashValue = big(parse).div(big(2).pow(N_BITS));
return hashValue.times(100).round(2, 0);
}
The result of Dice is determined by Salt and Hash. During the game, two values are used to draw a random number between 0.00 and 99.99. Players can choose their goal range and payout in advance. If the drawn number falls in the player’s goal range, the player will win the payout set in advance. Payout must be between 1.01 and 9900.
function verifyRoulette(hash, salt) {
const TOTAL_NUMBERS = 37;
const seed = sha256.hmac.update(salt, hash).hex();
const hex = seed.slice(0, N_BITS / 4);
const parse = parseInt(hex, 16);
const hashValue = Big(parse).div(Big(2).pow(N_BITS)).times(TOTAL_NUMBERS).round(0, 0);
return Number(hashValue).toString();
}
The result of Roulette is determined by Salt and Hash. During the game, two values are used to draw a random number between 0 and 36. If the drawn number falls in the player’s goal range, the player will win the payout set in advance.
Pseudo-random numbers are chosen with equal probability from a finite set of numbers. The chosen numbers are not completely random because a mathematical algorithm is used to select them, but they are sufficiently random for practical purposes. The current implementation of the random algorithm is based on a modified version of Donald E. Knuth’s subtractive random number generator algorithm. For more information, see D. E. Knuth. The Art of Computer Programming, Volume 2: Seminumerical Algorithms. Addison-Wesley, Reading, MA, third edition, 1997.
SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) and first published in 2001. They are built using the Merkle–Damgård structure, from a one-way compression function itself built using the Davies–Meyer structure from a (classified) specialized block cipher.
The Fisher-Yates shuffle is an algorithm for generating a random permutation of a finite sequence — in plain terms, the algorithm shuffles the sequence. The algorithm effectively puts all the elements into a hat; it continually determines the next element by randomly drawing an element from the hat until no elements remain. The algorithm produces an unbiased permutation: every permutation is equally likely. The modern version of the algorithm is efficient: it takes time proportional to the number of items being shuffled and shuffles them in place.
Write down the numbers from 1 through N.
Pick a random number k between one and the number of unstruck numbers remaining (inclusive).
Counting from the low end, strike out the kth number not yet struck out, and write it down at the end of a separate list.
Repeat from step 2 until all the numbers have been struck out.
The sequence of numbers written down in step 3 is now a random permutation of the original numbers.
Random Number Generator
iTech evaluated Random Number Generator (RNG) and found that the RNG complies with the relevant standards and passes Marsaglia’s “diehard” tests for statistical randomness. iTech also evaluated the random number’s usage in the logic of our games.
The random number generation tests were conducted on large samples enough to give the calculations sufficient statistical power. iTech has found that each game’s random number sequences are statistically unpredictable, non-repeatable, and uniformly distributed.
6bff5913-6ae8-42b2-b423-d0d86f23a359-image.png
Hash Verification
The following is an example of the Hash Verification function from Rocket Games.
11b94a37-ac23-47d5-93fa-53670fbc25c9-image.png