Core Principle

All game results are generated through cryptographically verifiable random number generation (VRF):

import hmac
import hashlib

def generate_result(server_seed, client_seed, nonce, game_type):
    # 种子组合与HMAC-SHA256计算
    message = f"{client_seed}:{nonce}".encode()
    h = hmac.new(server_seed.encode(), message, hashlib.sha256)
    hex_digest = h.hexdigest()
    
    # 转换为整数(取前8字符避免溢出)
    random_int = int(hex_digest[:8], 16)  # 0~4,294,967,295
    
    if game_type == "integer":
        return integer_game_result(random_int)
    else:
        return float_game_result(random_int)

1. Integer Game (0/1) Result Generation

Generation Process

Verification Formula

f(x)=(int(hash0:7)mod2)f(x) = (int(hash 0:7 )mod2)

Technical Specifications

Element
Description

Input Sources

Triple-seed system (server seed + client seed + nonce)

Hash Algorithm

HMAC-SHA256 (collision resistance > 2¹²⁸)

Output Range

Deterministic binary output {0, 1}

Bias Control

Floating-point error eliminated via modulo operation

Verification Tools

Web calculator/SDK provided

Verification Example


2. Floating-Point Game (0.1-9.9) Result Generation

Generation Process

Verification Formula

f(x)=10(int(hash0:7)mod99)+0.1f(x) = 10(int(hash 0:7 )mod99) +0.1

Distribution Guarantee

Statistical Validation

Metric
Theoretical Value
Test Value (1M trials)

Mean

5.0

4.997

Standard Deviation

2.87

2.869

χ² Test

p>0.99

p=0.998

Min/Max

0.1/9.9

0.1/9.9


Verifiability Assurance System

Triple-Layer Verification

  1. Pre-commitment Verification

  2. On-chain Result Recording

  3. Public Verification Tool


Anti-Manipulation Features

  1. Seed Control Separation

    • Server seed: Secured by POFG smart contract (commit-reveal scheme)

    • Client seed: Submitted by player before game start

    • Nonce: Auto-incremented per game round

  2. Time-lock Mechanism

  3. Post-audit Interface

This mechanism provides triple-layer assurance through cryptographic binding + decentralized verification + mandatory transparency, ensuring no single party (including POFG system) can manipulate outcomes. Players can independently verify game fairness using open-source tools.

Last updated