As part of our fairness we generated a chain of 10,000,000 SHA256 hashes where each hash is the hash of the hexadecimal representation of the previous hash. Being the last hash in the chain: c8c505ebcbb51fdd090f7269d6fe3c41c27455ef3e975751587f47606f4560dd
const { createHmac } = require('crypto');
const divisible = (hash, mod) => {
// So ABCDEFGHIJ should be chunked like AB CDEF GHIJ
let val = 0;
let o = hash.length % 4;
for (let i = o > 0 ? o - 4 : 0; i < hash.length; i += 4) {
val = ((val << 16) + parseInt(hash.substring(i, i+4), 16)) % mod;
}
return val === 0;
};
const calculateCrashPointFromHash = function(hash) {
// In 1 of 15 games the game crashes instantly.
if (divisible(hash, 15))
return 0;
// Use the most significant 52-bit from the hash to calculate the crash point
let h = parseInt(hash.slice(0,52/4),16);
let e = Math.pow(2,52);
return (Math.floor((100 * e - h) / (e - h)) / 100).toFixed(2);
}
// these will be the 10M pre generated rolls to be used
const hashChain = [];
const gameHash = hashChain.pop();
// It's the hash we're gonna be using of the result of a yet to be mined block on the blockchain #840,535
const blockHash = '';
const hash = createHmac('sha256', gameHash).update(blockHash).digest('hex');
const crashPoint = calculateCrashPointFromHash(hash);
console.log({ crashPoint });
We’re gonna be using a BlockHash that hasn’t been mined at the time of this post, we’re expecting to use Bitcoin block 840,535 this to prove we have no influence over the outcome of the game.
Archived post: https://archive.ph/KvGHJ
Client seed has been mined!
Code:
000000000000000000014a6b3e88c09344189ea9b5f36a81e3d63130e9a450cf
https://www.blockchain.com/explorer/blocks/btc/840535