Provably Fair

Satoshi Circle offers Provably Fair Gaming in that all spins are random, and immediately and independently verifiable.

Process

  1. We create a server ‘seed’ to generate our random numbers.
  2. The initial array of 17 outcomes of the circle is randomized.
  3. The server then randomizes the initial array with a server generated seed. This is the server array.
  4. The initial array order is made public before the spin as an encrypted SHA256 hash of the server seed and the initial array.
  5. We use the Javascript in your browser to generate a random seed once the spin button is pressed. This seed directly effects the outcome of the spin.
  6. The server array is randomized with the client seed. The first item of the array is the outcome.

When the spin is completed, the array order can be verified to ensure it wasn’t altered:

  1. Use the following .PHP script to verify the outcome was indeed random
  2. Compare the spin result to the final array of the script.

$initialArray = "7,3,9,14,1,15,10,16,5,4,11,2,8,12,0,13,6";
$serverSeed = "90799282283903085";
$clientSeed = "40403386577963830";

$secretArr = array(
    "initialArray"    => $initialArray,
    "serverSeed"    => $serverSeed
);

$secret = json_encode( $secretArr );

$secretHash = hash("sha256", $secret );

$initialArray = explode(",", $initialArray);
$serverArray = seedShuffle( $initialArray, $serverSeed );
$finalArray = seedShuffle( $serverArray, $clientSeed);

$results = array(
    3,
    0,
    1.5,
    .25,
    2,
    .25,
    1.5,
    .25,
    1.5,
    0,
    1.2,
    .25,
    1.25,
    2,
    .25,
    1.5,
    0
  );

$spin = $finalArray[0];

$finalResult = $results[$spin]; //Final Spin Odds

echo "Final Result: " . $finalResult . "\n";

echo "Initial Hash: " . $secretHash . "\n";

function seedShuffle( $items, $seed ) {
   
    if (is_numeric($seed)) {
        $seedval = $seed;
    } else {
      $seedval = crc32($seed);
    }

   srand($seedval);

   for ($i = count($items) - 1; $i > 0; $i--) {
      $j = @rand(0, $i);
      $tmp = $items[$i];
      $items[$i] = $items[$j];
      $items[$j] = $tmp;
   }

   return $items;
}