หลักการทำงานของความยุติธรรมที่พิสูจน์ได้ใน Dice
นี่คือวิธีเล่น Dice บน Cloudbet และวิธีตรวจสอบว่าการทอยแต่ละครั้งเป็นไปตามหลักความยุติธรรมที่พิสูจน์ได้
วิธีเล่น Dice
Dice เป็นเกมจังหวะเร็วที่คุณเดิมพันว่าตัวเลขที่สุ่มขึ้นมาจะสูงหรือต่ำกว่าเป้าหมายที่คุณเลือก เลือกตัวเลขเป้าหมายและตัดสินใจว่าคุณกำลังเดิมพันว่าผลลัพธ์จะ Roll Over (สูงกว่า) หรือ Roll Under (ต่ำกว่า) เป้าหมายของคุณยิ่งใกล้ขอบของช่วงตัวเลขมากเท่าไร โอกาสชนะก็ยิ่งน้อยลง แต่หากชนะ เงินรางวัลก็จะยิ่งมากขึ้น เมื่อคุณวางเดิมพันแล้ว ผลลัพธ์จะปรากฏขึ้นทันที
Cloudbet Originals Dice
เกม Dice ของ Cloudbet Originals ใช้ช่วงเป้าหมายตั้งแต่ 0.00 ถึง 100.00 มี RTP 99% ตัวคูณสูงสุด x9,800 และรับเดิมพันตั้งแต่ $0.01 ถึง $10,000 มีโหมด Auto Bet ให้ใช้เพื่อเล่นแบบอัตโนมัติหลายรอบ
หน้านี้จะอธิบายว่า Dice แปลงตัวเลขสุ่มที่ตรวจสอบได้ให้กลายเป็นผลการทอยของคุณอย่างไร ส่วนที่มาของความสุ่มนั้นถูกสร้างและรักษาความปลอดภัยอย่างไร ทั้ง Server Seed, Client Seed, Nonce และการแฮช ดูได้ที่หน้าความยุติธรรมที่พิสูจน์ได้ของเรา กำลังเล่น Dice: Golden Ticket อยู่ใช่ไหม? เกมนี้สุ่มค่าลูกเต๋าด้วยวิธีเดียวกับที่อธิบายไว้ที่นี่ แล้วเพิ่มค่าและตัวคูณ Golden Ticket เข้าไปอีกชั้นหนึ่ง
แปลงตัวเลขสุ่มให้กลายเป็นผลลัพธ์ Dice
ผลลัพธ์ของ Dice จะต้องเชื่อมโยงอย่างพิสูจน์ได้กับความสุ่มที่ตรวจสอบได้แบบเดียวกับ Cloudbet Original อื่นๆ ทุกเกม เมื่อลำดับตัวเลขสุ่มของรอบนั้นถูกสร้างขึ้น (ผ่าน SHAKE256 ดูขั้นตอนนี้ได้ที่กระบวนการความยุติธรรมที่พิสูจน์ได้) Dice จะใช้ตัวเลขนั้นดังนี้:
ตัวเลขเต็มระหว่าง 0 ถึง 10,000 (รวมทั้งสองค่า) จะถูกสุ่มจากลำดับตัวเลข แล้วนำมาหารด้วย 100 เพื่อให้ได้ค่าระหว่าง 0 ถึง 100 พร้อมทศนิยมสองตำแหน่ง นั่นคือผลลัพธ์ Dice ของคุณ
วิธีการสุ่มทำงานอย่างไร
Dice มีผลลัพธ์ที่เป็นไปได้ 10,001 แบบ (0.00 ถึง 100.00 เพิ่มทีละ 0.01) ดังนั้นสำหรับเกมนี้ P = 10,001
เพื่อเลือกอย่างยุติธรรมในบรรดา 10,001 ผลลัพธ์นี้ Dice ใช้วิธี Rejection Sampling แบบเดียวกับที่อธิบายไว้ในคู่มือความยุติธรรมที่พิสูจน์ได้ของเรา โดยตัวเลข 32 บิตแบบสุ่มจะถูกสร้างขึ้น แล้วถูกปฏิเสธและสุ่มใหม่หากทำให้ผลลัพธ์เอนเอียง จนกว่าจะได้ตัวเลขที่ยุติธรรม จากนั้นตัวเลขนั้นจะถูกนำมา Modulo กับ 10,001 เพื่อให้ได้ค่าระหว่าง 0 ถึง 10,000 แล้วหารด้วย 100 เพื่อให้ได้ผลลัพธ์สุดท้าย

การเล่นเกม
ผลลัพธ์จะถูกสร้างและล็อกไว้บนเซิร์ฟเวอร์ก่อนที่คุณจะวางเดิมพัน และไม่สามารถเปลี่ยนแปลงหรือถูกแก้ไขโดยไม่ถูกตรวจจับได้เมื่อรอบเริ่มขึ้นแล้ว หลังจากคุณเดิมพัน เป้าหมายที่คุณเลือกจะถูกนำไปเปรียบเทียบกับตัวเลขที่สร้างไว้ล่วงหน้านี้เพื่อดูว่าคุณทายถูกหรือไม่
โค้ดสำหรับตรวจสอบความยุติธรรมที่พิสูจน์ได้ของ Dice ด้วยตัวเอง
โปรแกรมนี้ตรงกับการทำงานของ Dice บน Cloudbet ใส่ Server Seed, Client Seed และ Nonce ของคุณเพื่อตรวจสอบผลลัพธ์ของคุณเอง หมายเหตุ: หากต้องการเปิดเผย Server Seed ของเกมบน Cloudbet คุณต้อง Rotate ไปเป็น Server Seed ใหม่ก่อน
ไลบรารีที่จำเป็น:
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 game outcome to the game outcome 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
}
throw new Error("No more numbers in the random number sequence! Fix: make 'numbersToGenerate' larger.");
}
// Step 4: Draw from the random number sequence to calculate the game result
function getDiceResult(rng) {
const diceMinValue = 0;
const diceMaxValue = 10000;
let number = sampleFromRange(diceMinValue, diceMaxValue, rng);
number = number / 100; // So that the dice's value ranges from 0 to 100
return number;
}
// Sample a number between 'min' to 'max' (inclusive) using Rejection Sampling
function sampleFromRange(min, max, rng) {
const P = max - min + 1
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 + min;
}
// Example usage
(function main() {
let nonce = 1;
if (usingCustomData) { nonce = myNonce; }
const { serverSeed, commitment } = generateServerSeed();
const clientSeed = getClientSeed();
const roundSignature = createRoundSignature(serverSeed, clientSeed, nonce);
const numbersToGenerate = 1 * 2; // We need 1 random number, however due to rejection sampling we may need more
const rng = createRandomNumberSequence(numbersToGenerate, roundSignature);
const diceValue = getDiceResult(rng);
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('🎯 Dice landed on:', diceValue);
})();


