Provably Fairness
Wheel is a roulette-style multiplayer game that predicts where the wheel will stop, divided into 54 sectors.
To ensure fairness and impartiality, we encrypt and store 10 million pre-generated seed values. These seeds are used in reverse order to determine game outcomes.
After each round, the seed used for that result is publicly disclosed.
The result of each game is hashed with future game results, making it impossible to predict or manipulate the outcomes of future rounds.
Game Result Generation Algorithm:
- The result values are determined using four choice arrays, ranging from 0 to 53, and four multiply arrays with four numbers each.
- The result obtained by hashing the encrypted seed value and the Bitcoin block hash value is stored.
- After converting the value into a decimal integer, it is then used in the game's result by taking the remainder when divided by 54.
- This remainder corresponds to the multiply value in the choice array and is used as the game's result.
To verify a game result, you can see in Bitcoin Forum, available here.
const choices = [
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52],
[3, 5, 7, 13, 15, 17, 23, 25, 27, 29, 31, 37, 39, 41, 47, 49, 51],
[1, 9, 11, 19, 21, 33, 35, 43, 45, 53],
[0],
];
const multiplyArr = [2, 3, 5, 50];
const saltSeed = keccak256(toUtf8Bytes(seed + bitCoinBlockHash)).slice(2);
const random = new BigNumber(saltSeed).mod(54).toNumber();
let multiply = 0;
for (let [index, c] of choices.entries()) {
if (c.includes(random)) {
multiply = this.multiplyArr[index];
break;
}
}
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
wheel_code_2
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.