Provably Fair ใน Keno ทำงานอย่างไร

นี่คือวิธีเล่น Keno บน Cloudbet และวิธีตรวจสอบว่าการออกเลขแต่ละครั้งเป็น provably fair

วิธีเล่น Keno

Keno เป็นเกมออกเลข: คุณเลือกตัวเลขบนกระดาน จากนั้นเกมจะออกตัวเลขของตัวเอง ยิ่งตัวเลขที่คุณเลือกตรงกับตัวเลขที่ออกมามากเท่าไร เงินรางวัลของคุณก็จะยิ่งมากขึ้นเท่านั้น — จะมากแค่ไหนขึ้นอยู่กับจำนวนตัวเลขที่คุณเลือกไว้ตั้งแต่แรก เมื่อคุณเลือกตัวเลขและวางเดิมพันแล้ว การออกเลขจะเกิดขึ้นทันที และตัวเลขที่ถูกจะปรากฏให้เห็นทันที

Cloudbet Originals Keno

Keno ของ Cloudbet Originals ใช้กระดาน 40 ตัวเลข คุณเลือกได้ 1 ถึง 10 ตัวเลข และเกมจะออกเลข 10 ตัว มี RTP 99% และรับเดิมพันตั้งแต่ $0.01 ยิ่งเลือกตัวเลขน้อย ความผันผวนก็ยิ่งสูงและเงินรางวัลต่อเลขที่ถูกก็ยิ่งมาก ส่วนยิ่งเลือกตัวเลขมาก ก็ยิ่งชนะบ่อยขึ้นแต่ผลตอบแทนต่อเลขที่ถูกจะต่ำลง คุณสามารถใช้ Auto Bet เพื่อเดิมพันหลายรอบโดยอัตโนมัติ

การออกเลขของ Keno สร้างขึ้นด้วยวิธีที่ตรวจสอบได้แบบเดียวกับ Cloudbet Original เกมอื่น ๆ ทุกเกม — ดูภาพรวม provably fair ของเรา เพื่อทำความเข้าใจว่า Server Seed, Client Seed และ Nonce รวมกันเป็น Round Signature ได้อย่างไร แล้วกลายเป็นลำดับตัวเลขสุ่มผ่าน SHAKE256 ได้อย่างไร หน้านี้จะอธิบายสิ่งที่เฉพาะเจาะจงกับ Keno คือ ลำดับตัวเลขสุ่มนั้นกลายเป็นชุดตัวเลขที่ออกจริงได้อย่างไร

การแปลงตัวเลขสุ่มให้เป็นการออกเลข Keno

กระดาน Keno มีหมายเลข 1 ถึง 40 ต้องออกเลข 10 ตัวจาก 40 ตัวนี้ ทีละตัว โดยไม่ซ้ำกัน

แผนภาพแสดงกระดาน Keno ที่ยุติธรรมพิสูจน์ได้ของ Cloudbet — 40 ช่องที่มีหมายเลข แต่ละช่องมีดัชนีของตัวเองเพื่อการสุ่มเลขที่เป็นธรรม

เราเรียกจำนวนตัวเลขที่ยังไม่ถูกออกว่า P โดย P เริ่มต้นที่ 40 และลดลงทีละ 1 ทุกครั้งที่มีการออกเลข

ตัวอย่างการทำงานของอัลกอริทึมการออกเลข Keno ที่ยุติธรรมพิสูจน์ได้: เลขแรกถูกสุ่มเลือกจากทั้งหมด 40 ตำแหน่งบนกระดาน

ระบบจะสุ่มตัวเลขขนาด 4 ไบต์ (32 บิต) จากผลลัพธ์ของ SHAKE256 สำหรับการออกเลขแต่ละครั้งจากทั้งหมด 10 ครั้ง โดยมีค่าตั้งแต่ 0 ถึง 4,294,967,295 เพื่อเลือกอย่างเป็นธรรมจากตัวเลขที่เหลืออยู่ P ตัว เราใช้วิธี rejection sampling (ดูคู่มือ rejection sampling ของเรา) จากนั้นนำผลลัพธ์มา mod ด้วย P เพื่อหาตำแหน่งของตัวเลขที่จะออกถัดไป หากยังมีตัวเลขที่ต้องออกอีก ตัวเลขที่เลือกไว้จะถูกนำออกจากกลุ่ม P จะลดลง 1 แล้วกระบวนการนี้จะเกิดซ้ำ

3. ตัวอย่างการทำงานที่แสดงอัลกอริทึม Keno ที่ยุติธรรมพิสูจน์ได้กำลังออกเลขถัดไปจาก 39 ตำแหน่งที่เหลือ หลังจากตำแหน่งที่ออกแล้วถูกนำออก

กระบวนการนี้จะดำเนินต่อไปจนกว่าจะออกเลขครบทั้ง 10 ตัว

4. กระดาน Keno ที่ยุติธรรมพิสูจน์ได้ขั้นสุดท้าย พร้อมไฮไลต์เลขทั้ง 10 ตัวที่ออกแบบสุ่มและตรวจสอบได้

5. แผนผังการคำนวณ Keno ที่ยุติธรรมพิสูจน์ได้ของ Cloudbet: ไบต์สุ่มและ rejection sampling เป็นตัวกำหนดตำแหน่งของเลขที่ออกแต่ละตัวบนกระดาน

กลไกการเล่น

ตัวเลขทั้ง 10 ตัวที่ออกจะถูกสร้างขึ้นและซ่อนไว้บนเซิร์ฟเวอร์ก่อนที่คุณจะเลือกตัวเลข — จึงไม่สามารถเปลี่ยนแปลงหรือแก้ไขได้โดยไม่ถูกตรวจพบในภายหลัง เนื่องจาก Commitment ได้ถูกแชร์ให้คุณไว้ล่วงหน้าแล้ว ตัวเลขที่คุณเลือกจะถูกนำไปเทียบกับตัวเลขที่ออกไว้ล่วงหน้านี้เมื่อรอบจบลง และเงินรางวัลของคุณจะคำนวณจากจำนวนเลขที่ถูก

โค้ดสำหรับตรวจสอบผลเกม Keno ของ Cloudbet ด้วยตัวเอง

กรอก Server Seed, Client Seed และ Nonce ของคุณเพื่อตรวจสอบผลลัพธ์ของคุณเอง ติดตั้ง dependency เดียวที่จำเป็น แล้วรันโค้ดด้วยตัวเองเพื่อสร้างผลลัพธ์ของเกมของคุณขึ้นมาใหม่

หมายเหตุ: การจะเปิดเผย Server Seed ของเกมที่จบไปแล้วบน Cloudbet คุณต้องเริ่มรอบใหม่ไปแล้ว (ซึ่งจะเปลี่ยนไปใช้ seed คู่ใหม่)

Dependencies:

npm install js-sha3

โค้ด:

// If you are running this yourself, then you can input your own data here
// You can then compare:
// 1) Cloudbet's provided Commitment to the Commitment outputted here. This proves that the Server Seed was not altered during gameplay.
// 2) Cloudbet's provided mine positions to the mine positions outputted here. This proves that your game's outcome was determined solely by the pre-game seeds and was not altered afterwards.
let myServerSeed      = 'your_server_seed'; // ✍️YOUR_INPUT✍️: Enter your (unhashed) Server Seed here
let myClientSeed      = 'your_client_seed'; // ✍️YOUR_INPUT✍️: Enter your Client Seed here
let myNonce           = 1;                  // ✍️YOUR_INPUT✍️: Enter your Nonce here
const usingCustomData = false;              // Change this to true if you are using your own data

// Load libraries
const crypto = require('crypto');
const { sha3_256, shake256 } = require('js-sha3');

// Step 1: Generate a Server Seed and Commitment
// And generate a Client Seed - either by player input or by the player's browser
function generateServerSeed() {
  let seed = crypto.randomBytes(32).toString('hex');
  if (usingCustomData) { seed = myServerSeed; }
  const commitment = sha3_256(seed);
  return { 'serverSeed': seed, 'commitment': commitment };
}
function getClientSeed() {
  let seed = crypto.randomBytes(32).toString('hex');
  if (usingCustomData) { seed = myClientSeed; }
  return seed;
}

// Step 2: Create a Round Signature with SHA3 using a Server Seed, Client Seed and Nonce 
function createRoundSignature(serverSeed, clientSeed, nonce) {
  return sha3_256(`${serverSeed}:${clientSeed}:${nonce}`);
}

// Step 3: Create a SHAKE256 stream generator from a Round Signature. 
// To simplify this example program, this function doesn't create a stream, but instead a sequence of custom length.
function* createRandomNumberSequence(numbersToGenerate, roundSignature) {
  const numOfBytes = 4 * numbersToGenerate;           // 4 bytes (32 bits) per random number we generate
  const byteStream = shake256.create(8 * numOfBytes); // shake takes bits as input
  byteStream.update(roundSignature);                  // Use the Round Signature to seed the generator
  const buf = Buffer.from(byteStream.digest());       // The Buffer class lets us package every 4 bytes into one 32-bit integer
  for (let i = 0; i < numbersToGenerate; i++) {
    yield buf.readUInt32BE(i * 4);                    // Read buf in 4-byte steps
  }
}

// Step 4: Pick a number of unique positions
function pickUniquePositions(numOfPicks, totalPositions, rng) {
  const available = Array.from({ length: totalPositions }, (_, i) => i);
  const picks = [];

  for (let i = 0; i < numOfPicks; ++i) {
    const index = sample(available.length, rng);

    picks.push(available[index]);
    available.splice(index, 1); // Remove chosen pump from list of non-faulty pumps
  }
  return picks;
}
// Rejection sampling for fair results
function sample(P, rng) {
  const maxAcceptable = Math.floor(0x100000000 / P) * P;

  // Rejection sampling
  let rand;
  do {
    rand = rng.next().value;
  } while (rand >= maxAcceptable);
  // Modulo operation
  const sampled_number = rand % P;

  return sampled_number;
}

// Example usage
(function main() {
  let nonce = 1;
  if (usingCustomData) { nonce = myNonce; }
  const numOfHits = 10;
  const totalPositions = 40;

  const { serverSeed, commitment } = generateServerSeed();
  const clientSeed = getClientSeed();

  const roundSignature = createRoundSignature(serverSeed, clientSeed, nonce);
  const numbersToGenerate = totalPositions * 2; // We need at least one random number per position, but there is an improbable possibility  we'll need two
  const rng = createRandomNumberSequence(numbersToGenerate, roundSignature);

  let hits = pickUniquePositions(numOfHits, totalPositions, rng);
  hits = hits.map((value)=> value + 1 );
  hits.sort((a, b)=>a-b);

  console.log('📝 Commitment (shown before the game):', commitment);
  console.log('🔒 Server Seed (revealed after the game):', serverSeed);
  console.log('🎲 Client Seed:', clientSeed);
  console.log('🔢 Nonce:', nonce);
  console.log('🔁 Round Signature (can be verified after the game):', roundSignature);
  console.log(`🎯 Hits:`, hits);
})();