OPDUEL

Fairness

OPDuel Originals

Limbo

Plinko

Keno

Roulette

Mines

Blackjack

Roll

Dice

Provably Fair Dice

Dice is a classic over/under game. You pick a target number and bet on whether the roll will land higher or lower. The multiplier scales with probability - harder targets pay more.

Verify Game Fairness

The game generates a number between 0.00 and 100.00 using the algorithm below, then compares it to your target to determine whether you won.

The Algorithm

// Step 1: Generate HMAC-SHA256 hash
const message = `${clientSeed}:${nonce}:0`;
const hash = HMAC_SHA256(serverSeed, message);

// Step 2: Take first 4 bytes and convert to float
const bytes = hash.slice(0, 4);
let float = 0;
for (let i = 0; i < 4; i++) {
    float += bytes[i] / Math.pow(256, i + 1);
}

// Step 3: Scale to dice range (0.00 to 100.00)
const result = Math.floor(float * 10001) / 100;

How It Works

  1. Combine seeds - Your client seed, the nonce, and round number (always 0 for dice) are combined into a message string formatted as clientSeed:nonce:0
  2. Generate hash - The server seed is used as the key in an HMAC-SHA256 operation with the message, producing 32 random bytes
  3. Extract float - The first 4 bytes are converted to a decimal number between 0 and 1 using the formula: byte[0]/256 + byte[1]/256² + byte[2]/256³ + byte[3]/256⁴
  4. Calculate result - The float is multiplied by 10001, floored to an integer, then divided by 100 to produce the final result from 0.00 to 100.00

Example

Given these inputs:

  • Server Seed: c5e7146c5863d7d647c93ffe7d4ec13fffbb7311108fab0c067d97bcc2b32d55
  • Client Seed: LuckyClientSeed777
  • Nonce: 0

The hash produces bytes: [66, 1, 62, 182, ...] (hex: 42 01 3e b6)

float = 66/256 + 1/256² + 62/256³ + 182/256⁴
      = 0.2578125 + 0.0000153 + 0.0000037 + 0.0000000004
      = 0.2578314967

result = floor(0.2578314967 × 10001) / 100
       = floor(2578.57) / 100
       = 2578 / 100
       = 25.78

The dice result would be 25.78.

Verify your bets by selecting the "My Bets" tab at the bottom of the page while playing, then click on the bet you want to verify. For older bets, find them in your Bet History.

    CashierHomeGamesChat





    OPDUEL