Skip to main content
Dice game
Nootiih avatar
Written by Nootiih
Updated over a week ago

We offer verification which allows users to check the integrity of every roll and confirm they are not manipulated. Every randomly generated number is calculated based on the server and client seed. The server seed is created before you specify your client seed. Both seeds together prevent manipulation from our side and verify the roll integrity after the result calculation. Every roll has a unique server seed randomly generated in advance, this server seed will only be updated when you choose to update your client seed. We hash those server seeds with the SHA256 cryptographic function and then publish the hashed server seeds for you to see.

Due to this applied hashing function, you cannot see the original server seed, yet you will be able to check that it was unmodified later, when we publish the un-hashed server seed after you update your client seed. We publish all un-hashed server seeds as soon as you update, so you can apply the SHA256 function to it and see that the server seed was unmodified during your previous rolls. The client seed can be edited freely by users before each roll.

As the client seed affects every roll result, changing it to any seed of your choice at any time means you can ensure that it's impossible for us to manipulate the result. However, the SHA512 function we use to generate the roll is deterministic, if the client seed is combined with the same server seed, it will generate exactly the same roll result every time. This could be used to abuse the system, so we use something called a 'nonce' which prevents this from being abusable. Each roll done using the same server seed & client seed pair will also be paired with a different nonce, which is simply a number starting at 0 and incremented by 1 for each roll done.

The nonce is based on numbers which we can't manipulate (they naturally increment by 1 after each roll)

Lastly, for each roll we generate, we apply aniterationcount, starting at 0. The reason for this fourth variable in the seed is just in case the randomly generated value goes out of bounds and eventually exhausts all available random numbers within the available hash. In this case, we will generate a new hash using the exact same seed pair as before, while simply incrementing thisiterationvalue by 1. In this sense, it works in very much the same way as the nonce. We do not have any control over which iteration value is used to generate the final result as it is all algorithmically pre-determined.

With the provided secret seed combination, we use the SHA512 cryptographic hashing function to generate a hexadecimal hash. From this hexadecimal hash, we take the first 5 characters and convert them to an integer. If the integer happens to fall out of bounds (above 10,000), we cycle to the next 5 characters of the hexadecimal hash and repeat this step. We then apply a modulus of 10,000 to this number, giving us a number in the range of 0-9999. Finally, when displaying the final result, the frontend divides this integer by 100 to display the result as a decimal roll in the range of 0-99.99.

Each roll can be verified using this formula as soon as you have revealed your server seed for the previous rolls. The published un-hashed server seeds can be checked by simply applying the SHA256 function to it, this will produce the previously published hashed version of the server seed, which was made visible to you before any roll using it was ever made. Each user can check the integrity of every roll made using this information.

INDEPENDENT VERIFICATION

You can independently verify any previous roll by using the code displayed below. Simply input the client seed, the un-hashed server seed and the nonce of your roll. You can execute this code yourself using Node.js, but we understand that for some of you, this may be beyond your technical know-how. So, we have created an easy way for you to execute this code directly from your browser. It runs the exact same code which is shown below, without the hassle of having to set up Node.js on your home computer. You simply need to input the 3 seed values: client seed, server seed and nonce before pressing Execute.

Note:Our Random Number Generator algorithm was updated on19th Oct 2022.
For all games playedbefore ID #170,387,106 on 2022-10-19 08:18:07.738+00, please usethis codefor independent verification instead.

const crypto =require('crypto');// --- BEGIN: Fill these valuesconst clientSeed ='ba4a1d51815e598fa6106ca8bac244cc9ce5d0b130e51fdb14d55ef29225f7a5';const nonce =1;const serverSeed ='6d993ad50e7e64a38d8eb5cb4c095d316e821fa089c8dbdd239aacebf63c626d';// --- END: Fill these values// With example values ^ it will output `Roll value: 88.02 (Raw value: 8802)`// Turn this on if you want to see all the messagesconst verboseMode =false;// Get random roll value using provided informationconst game =undefined;const rollValue =getDiceRoll({ clientSeed, game, nonce, serverSeed }); console.log(`Roll value: ${rollValue /100} (Raw value: ${rollValue})`);/** * Below this line are algorithmic functions used for calculating a roll value * ============================================================================= */functionlog(message){if(verboseMode){ console.log(message);}}functiongetDiceRoll({ clientSeed, game, iteration =0, nonce, serverSeed }){// Prepare seed parametersconst seedParameters =[clientSeed, nonce];if(game){ seedParameters.unshift(game);}// Get hash from seed valuesconst hmac = crypto.createHmac('sha512', serverSeed); hmac.update(`${seedParameters.join('-')}-${iteration}`);const hash = hmac.digest('hex');// Initialize variableslet index =0;let lucky =getLucky(hash, index);// Process the hash until left with lucky resultwhile(lucky >= Math.pow(10,6)){ index++; lucky =getLucky(hash, index);// Reaching the end of the hash, run the calculations againif(Math.imul(index,5)+5>128){returngetDiceRoll({ clientSeed, game, iteration: iteration +1, nonce, serverSeed });}}// Return lucky float number lucky %= Math.pow(10,4);return lucky;}functiongetLucky(hash, index){const hashLucky = hash.slice(Math.imul(index,5), Math.imul(index,5)+5);return Number.parseInt(hashLucky,16);}
Did this answer your question?