Author

Topic: Old (Read 127 times)

newbie
Activity: 3
Merit: 0
Old
April 01, 2020, 06:14:08 AM
#3
Appreciated! Smiley
member
Activity: 85
Merit: 28
April 01, 2020, 06:13:28 AM
#2
Seeding event:
We will be releasing our crash game soon and to proof our provably fair system we will be holding this event as we consider this the best way to do it.

Unfair seed:
Each game is salted with the hash of Bitcoin block #623936 which is not mined yet but it will be in a few hours.
By posting it before it was mined, there is no way thay we picked unfair seed.
Because this information is only released once the block has been mined. And there is no way for us to see the future.

Code to generate the results:

var serverSecret = 'change this';
var clientSeed = 'future bitcoin block hash #623936'

var gamesToGenerate = 10e8;
var serverSeed = serverSecret;

for (var game = gamesToGenerate; game > 0; --game) {
  serverSeed = crypto.createHash('sha256').update(serverSeed).digest('hex');
  console.log('#' +  game + ' crashes at ' + crashPointFromHash(serverSeed) +'x', '\t\tHash: ' + serverSeed);
}

function crashPointFromHash(serverSeed) {
  var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, serverSeed);
  var hash = hmacHasher.finalize(clientSeed).toString();

  function divisible(hash, mod) {
    var val = 0;
 
    var o = hash.length % 4;
    for (var 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;
  }

  if (divisible(hash, 25))
      return (1.00).toFixed(2);

  var h = parseInt(hash.slice(0,52/4),16);
  var e = Math.pow(2,52);

  return (Math.floor(((e-h/50)/(e-h))*100)/100).toFixed(2);
};

var terminatingHash = crypto.createHash('sha256').update(serverSeed).digest('hex');
console.log('Terminating hash is: ', terminatingHash);

Quoted and archived.

Congrats on the release, and best of luck!
newbie
Activity: 3
Merit: 0
April 01, 2020, 05:14:56 AM
#1
Old
Jump to: