⚖️Probability fair

VEGAS Proof-of-Fairness (PoF) System.

Proof-of-Fairness System: Ensuring Transparent Betting

To verify the fairness of our betting system, we've implemented a proof-of-fairness mechanism that ensures transparency and checks each bet for accuracy. Each bet can be verified using the command /fair followed by the bet ID.

Purpose

The proof-of-fairness system ensures that there is no manipulation from the casino, providing maximum transparency. Each number used to determine the outcome of a bet is generated by three factors: the client seed, the server seed, and the nonce. This combination guarantees security for each bet, preventing any tampering with the house edge and ensuring that the odds are as publicly stated.

How It Works

Here’s the function used to generate the numbers:

const generateNumbers = (
  clientSeed: string,
  serverSeed: string,
  nonce: number,
  rounds: number,
  min: number,
  max: number
): number[] => {
  const numbers = [];

  for (let round = 0; round < rounds; round++) {
    const combinedSeed = `${clientSeed}:${nonce}:${round}`;
    const hash = crypto
      .createHmac('sha256', serverSeed)
      .update(combinedSeed)
      .digest('hex');

    const decimal = parseInt(hash.slice(0, 8), 16) / 0xffffffff;

    numbers.push(min + decimal * (max - min));
  }

  return numbers;
};

Example: Coinflip

The bot calls generateNumbers to determine the bet outcome. If the result is between 0 and 0.485, it’s a win; if it’s between 0.485> and 1, it’s a loss.

const clientSeed = 'CLIENT';
const serverSeed = 'SERVER';

const coinflipA = generateNumbers(clientSeed, serverSeed, 123, 1, 0, 1);
const coinflipB = generateNumbers(clientSeed, serverSeed, 124, 1, 0, 1);

console.log({ coinflipA, coinflipB });

// Results
{
  coinflipA: [ 0.9944432196194407 ], // Lose (>0.485)
  coinflipB: [ 0.10990976335245878 ], // Win (<=0.485)
}

Example: Russian Roulette

For each round, the bot calls generateNumbers to place a bullet in the chamber, eliminating one player per round.

const clientSeed = 'CLIENT';
const serverSeed = 'SERVER';

const decimals = generateNumbers(clientSeed, serverSeed, 125, 5, 0, 10);
const bullets = decimals.map((bullet) => Math.floor(bullet + 1));

console.log({ bullets });

// Results 
{
  bullets: [ 4, 5, 3, 2, 7 ],
}

Revealing the Server Seed

To prevent predicting the outcome of bets, the server seed is hashed by default. Players can reveal the server seed by generating a new one using the command /new_server_seed. This action reveals the old server seed, allowing players to verify past results, while the new server seed remains encrypted.

When checking past bets using the "old server seed," it will be automatically visible during verification with the /fair command.

Key Terms of the Proof-of-Fairness System:

  • Client Seed: A string determined from the player's wallet.

  • Server Seed: A random string generated by the Telegram bot (hashed by default), which can be revealed when a new server seed is created.

  • Nonce: The bet number with the same server seed (e.g., if there are three coinflips and one extreme Russian roulette with the same server seed, the nonce will be 4 if the server seed is not revealed).

This proof-of-fairness system ensures that all bets are fair and transparent, protecting both the players and the integrity of the casino. Enjoy and gamble responsibly!

Last updated