Bitcoin Forum

Economy => Gambling discussion => Topic started by: Crashcord on April 01, 2020, 09:14:56 AM



Title: Old
Post by: Crashcord on April 01, 2020, 09:14:56 AM
Old


Title: Re: Seeding Event - Crashcord.com
Post by: JasonFC on April 01, 2020, 10:13:28 AM
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 (https://web.archive.org/web/20200401101218/https://bitcointalk.org/index.php?topic=5237043.0).

Congrats on the release, and best of luck!


Title: Re: Seeding Event - Crashcord.com
Post by: Crashcord on April 01, 2020, 10:14:08 AM
Appreciated! :)