Provably Fairness
Crash is a multiplayer game where players predict the point at which the rocket will explode.
To ensure fairness and impartiality, we pre-generate and encrypt 10 million seed values. These seeds are used in reverse order to determine game results.
After each round concludes, the seed used for the result is disclosed. Additionally, each game result is hashed with future game results, making it impossible to predict or manipulate the outcomes of future rounds.
Game result generation algorithm:
- Hash the encrypted random number and bitcoin block hash to obtain a seed value, which is then divided by 10^13 and converted to a hexadecimal.
- Divide the result by 2^52 to obtain a random number between 0 and 1.
- Adjust the random number by applying a 1% house edge and generate the original data with multipliers.
- Divide the original data by 100 to create the actual multiplier used in the game result. (If the original data is less than 100, the multiplier is fixed at 1.)
To verify a game result, you can see n Bitcoin Forum, available here.
const seed = '...';
const bitCoinBlockHash = '...';
let saltSeed = keccak256(toUtf8Bytes(seed + bitCoinBlockHash)).slice(2);
const nBits = 52;
saltSeed = saltSeed.slice(0, nBits / 4);
const r = parseInt(saltSeed, 16);
let X = r / Math.pow(2, nBits);
X = parseFloat(X.toPrecision(9));
X = Math.floor(99 / (1 - X)); // house edge 1%
const successMultiply = Math.max(1, X / 100);
Algorithm Characteristics
- Ensuring the Randomness of the Initial Seed: We guarantee randomness by generating the initial seed (Genesis) using Linux's /dev/urandom source, which is based on a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG).
- Using a Widely Recognized Public Domain PRNG: We convert the initial seed into a seed using the SHA-3 standard keccak256 hash algorithm.
- Secure Storage of Seed Values: We pre-generate 10 million seeds and encrypt them using the AES algorithm, storing them in an independent database.
- Ensuring Fairness with Salt Values: We designate a salt value in advance, which is a hash value of a Bitcoin block that has not yet occurred, to ensure fair RNG random number generation.
- Providing a Game with Verifiable Fairness: To facilitate fairness verification, we disclose the 10 millionth seed in advance.
Seed Creation Stage
A random number for seed creation is generated using CSPRNG. Here, the CSPRNG technique utilizes the built-in library of nodeJS, crypto.randomBytes.
crypto.randomBytes is a function based on OpenSSL's RAND_bytes, and RAND_bytes utilizes the CSPRNG of Linux, /dev/urandom.
The random number is converted to hexadecimal.
This random number is hashed using the keccak256 algorithm to produce the first seed.
The first Seed from ‘step 3’ is hashed again using the keccak256 algorithm to produce the second seed.
Steps 3-4 are repeated a total of 10 million times, generating 10 million Seeds.
All of these seeds are securely stored using AES encryption.
Generate a random number with a value in the range of 2^52
Disclosure Stage
The 10 millionth generated Seed is disclosed to the game platform and community first. Check the Article
After Seed's disclosure, the hash value of the nth Bitcoin block that has not yet been made in Bitcoin block chain will be pre-designated as a Salt value and announced on the game platform and community. Check the Article
After the disclosure of the nth Bitcoin Block's hash value, it is designated publicly as the salt and disclosed to the game platform and community. Check the Article
The 10 millionth(+1) seed: 96cf82c49c9e4c43bb9b7692c0d222cb98a9e880144061f2a74a2ae1ded0f46e
Game Utilization Stage
The 9,999,999th seed is combined with the salt and hashed using the keccak256 algorithm. This serves as the RNG random number for the game.
As the game progresses, seeds are replaced in reverse order, from the 9,999,998th seed, 9,999,997th seed, and so on. The RNG random number is applied to the game or application.
Verification Stage
After a round of a game, the seed used in the game will be revealed.
For verification, the seed for that round can be hashed to keccak256.
Every user can verify that the hashed value matches the seed value from the seed value of the previous round.
The first game is verified using the previously disclosed 10 millionth seed.