LuckyGo is to go alive In a few days. Game algorithm in converting hashes has is as follow, name it Seeding Event.
Starting with a secret “Seed”, a chain of 1,000,000 SHA256 hashes thus generates. Each element is the hash of the lowercase, hexadecimal string representation of the previous hash. The hash of the chain's last element is 035cf2ff24d28229aa75636268c5cb9a7a278c2afef27577de00291ef6ae8c47.
Every game maps to a hash in the chain: The 1,000,000th element of the chain is the hash of game #1 and the first element in the chain is the hash of game #1,000,000. To verify that a hash belongs to a game #n, SHA256 hash it n times and compare the result with the terminating hash.
This is specifically how to calculate a result from its “Seed” hash:
function gameResult (seed, salt) {
const sha = CryptoJS.algo.SHA256.create();
sha.update(seed);
sha.update(salt);
seed = String(sha.finalize());
const nBits = 52; // number of most significant bits to use
// 1. r = 52 most significant bits
seed = seed.slice(0, nBits / 4);
const r = parseInt(seed, 16);
// 2. X = r / 2^52
let X = r / Math.pow(2, nBits); // uniformly distributed in [0; 1)
// 3. X = 99 / (1-X)
X = 99 / (1 - X);
// 4. return max(trunc(X), 100)
const result = Math.floor(X);
return Math.max(1, result / 100);
};
Before being used to calculate the corresponding result, the “salt” hash begins from the bitcoin block in height of 553500. This block has not been mined yet, proving that we have not deliberately picked a chain that is unfavorable f
or players.