MegaDice Bet Fairness Verification

MegaDice is Provably Fair and there are different Provably Fair systems in place for off chain bets and on chain bets.

The MegaDice Off Chain Provably Fair System

First we will describe how it works for off chain bets. It’s possible to cryptografically prove that the wagering process is not be tinkered with by providing a hash that includes the Server Roll that is used to determine the outcome. The Server Hash proves that the round’s Server Roll is correct and since you can choose your own Client Roll, there’s no way for us to alter the outcome without the verification failing. You can also use the MegaDice API to get all the data you need to verify your rolls.

Off Chain Game Provably Fair Flow Chart

Provably Fair Process

  1. The Game Client starts a new game round vith the startround API call and retreives the Server Hash from the Game Server.
  2. The Game Server generates a random Server Roll and Server Salt.
  3. The Game Server assigns a round id and replies with a SHA256 Hash of the combined Server Roll and Server Salt.1
  4. You can choose to leave the pre-generated Client Roll that the Game Client provides for you. Or you can type down your own Client Roll in the Game Client. When you click Roll Dice, the number that is in the Client Roll text box is sent to the Game Server, along with other bet details such as bet amount and the Roll Under To Win number.
  5. The server now combines the Server Roll and Client Roll into a Resulting Roll.2
  6. The Server SaltServer Roll and Resulting Roll are sent to the client. The player can now confirm that the Server Salt and Server Roll creates the same hash that was announced in step 3. The player can also verify that the Resulting Roll gives the correct outcome of the bet.

You can verify that all rolls on the MegaDice have been handled in a fair way by clicking a bet amount in the top list tabs under main game area. You will be taken to a separate page where you can verify thath the numbers add upp. The Provably Fair verification is even being done in your prowser automatically, and you can tinker with the variables to see that only the values supplied by the server will give the correct result.

Dice Metaphors

Maximum Roll

The Maximum Roll is like a big dice with 65536 sides with the number 0-65535. It defines the possible outcomes of the roll.

Client Roll

The Client Roll can be likened to choosing the position of the dice before it’s being thrown. If a player enters a number greater that the Maxumum Roll, a controlled integer overflow will be computed and a valid Client Roll will be produced.

Server Roll

The Server Roll represents how the dice is thrown. By recalculating the Server Hash from the Server Salt and Server Roll, you can verify that the Server Roll didn’t change after the Client Roll is was supplied.

Resulting Roll

Metphorically, the server holds the dice in the position it was given it and throws the dice. The actual roll of the metaphorical dice is represented by the Server Roll. Both the initial position and the way the dice is rolled affects the final position of the dice.

  1. Server Hash = SHA256(Server Salt + "_" + Server Roll)
  2. Resulting Roll = (Server Roll + Client Roll) % (Maximum Roll + 1)
  3. Server Hash = SHA256(Server Salt + "_" + Server Random Number)
  4. Resulting Random Number = (Server Random Number + Client Random Number) % (Random Number Max + 1)
  5. Reel 1 Position = Combined Random / (Length(Reel 2) * Length(Reel 3) * Length(Reel 4) * Length(Reel 5));
    Reel 2 Position = Reel 1 Remainder / (Length(Reel 3) * Length(Reel 4) * Length(Reel 5));
    Reel 3 Position = Reel 2 Remainder / (Length(Reel 4) * Length(Reel 5));
    Reel 4 Position = Reel 3 Remainder / Length(Reel 5);
    Reel 5 Position = Reel 4 Remainder;