Post
Topic
Board Gambling
Re: bustabit.com -- The Social Gambling Game (formerly moneypot.com)
by
blockage
on 05/12/2015, 00:03:39 UTC
The thing I fail to understand is how the bust odd is derived from the hash that is played at the moment.

I know i`m missing a component/level to understand it and I hope you or anyone else can explain it to me in ELI5 form.

The exact algorithm was describe in the 'provably fair seeding event'. Here it is without additional noise:

The method to convert a game hash, mix it with the picked client seed to a money pot multiplier:

Code:
function crashPointFromHash(serverSeed, clientSeed) {
  function divisible(hash, mod) {
    // We will read in 4 hex at a time, but the first chunk might be a bit smaller
    // So ABCDEFGHIJ should be chunked like  AB CDEF GHIJ
    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;
  }

  var hash = crypto.createHmac('sha256', serverSeed).update(clientSeed).digest('hex');

  /* In 1 of 101 games the game crashes instantly. */
  if (divisible(hash, 101))
     return 0;

  /* Use the most significant 52-bit from the hash
     to calculate the crash point */
  var h = parseInt(hash.slice(0,52/4),16);
  var e = Math.pow(2,52);

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

Unfortunately, this isn't exactly ELI5. Here is also the original code that gives more details to the last line. You can also take a look at how the winning probability and the house edge are derived from the above function. The details are in the code of the onsite calculator. If you're really don't feel comfortable reading code, I can try again..