Play & Draw Rules

Provably Fair Randomness

Trust in a decentralized jackpot protocol relies entirely on the integrity of its random number generation. QanVault implements a cryptographically auditable Commit-Reveal scheme that guarantees results cannot be manipulated, predicted, or backdated by anyone, including the protocol operators.


What Does Provably Fair Mean?#

A game or draw is provably fair when any independent player or auditor can verify with mathematical certainty that:

  1. The winning numbers were generated from unalterable randomness.
  2. The operator did not know the winning ticket ID before ticket purchases closed.
  3. The winner selection algorithm followed deterministic mathematical rules.
  4. No tickets were retroactively added or removed after the draw cutoff.

The Commit-Reveal Architecture#

To prevent frontrunning and seed manipulation, QanVault executes winner selection across two cryptographic phases:

Phase 1Commitment

Draw Closes & Hash Submitted

Keeper generates secret entropy S and computes commitment H = keccak256(S, drawId, blockHash). Purchases for drawId freeze.

Phase 2On-Chain Reveal

Cryptographic Seed Verification

Keeper publishes S on-chain. Contract verifies keccak256(S, drawId, blockHash) == H. Cannot be manipulated post-commitment.

Phase 3Deterministic Winner

Modulo Winner Derivation

Winning Ticket = StartTicket + (Entropy % TotalTickets). Owner identified via O(log B) binary search across ticket batches.

Mathematical Definitions

  1. Commitment Phase:
$$H = \text{keccak256}\Big(\text{SecretSeed} \parallel \text{DrawId} \parallel \text{CommitBlockNumber}\Big)

The commitment H is stored immutably in the contract state before any random reveal can occur.

  1. Reveal Phase:

When the secret seed is published, the smart contract validates:

$$\text{require}\Big(\text{keccak256}(\text{SecretSeed} \parallel \text{DrawId} \parallel \text{CommitBlockNumber}) == H, \text{"Invalid Seed"}\Big)
  1. Combined Entropy Derivation:
$$\text{Entropy} = \text{uint256}\Big(\text{keccak256}(\text{SecretSeed} \parallel \text{blockhash}(\text{CommitBlockNumber}))\Big)

By incorporating the block hash of the commitment block, the final entropy is tied to decentralized blockchain consensus, ensuring neither the keeper nor miners can single-handedly force a specific outcome.


Sampling Without Replacement#

When a draw awards multiple prize tiers (e.g., 1st, 2nd, and 3rd place), winners must be distinct:

  1. The first winning ticket W_1 is derived:
$$W_1 = \text{Entropy}_0 \pmod{\text{Total Tickets}}
  1. If W_2 = \text{Entropy}_1 \pmod{\text{Total Tickets}} belongs to the same wallet or ticket ID as W_1, the contract derives the next pseudo-random candidate using continuous hashing:
$$\text{Entropy}_{k+1} = \text{keccak256}(\text{Entropy}_k)
  1. Sampling continues until all prize slots are occupied by distinct winning entries.

Cryptographic Roadmap: Post-Quantum VRF#

QanVault's randomness architecture is fully modular via the IRandomnessProvider interface:

solidity
interface IRandomnessProvider {
    function requestRandomness(uint256 drawId) external returns (bytes32 requestId);
    function fulfillRandomness(uint256 drawId, bytes32 seed) external;
    function getEntropy(uint256 drawId) external view returns (uint256 entropy, bool fulfilled);
}
  • Current Mainnet Implementation: Chainlink VRF v2.5 / Commit-Reveal oracle integration.
  • QAN Platform Consensus VRF: Future-proofed to transition to QAN Platform's native post-quantum lattice-based verifiable random function (CRYSTALS-Dilithium) as QAN mainnet activates.

How to Verify Any Draw Independently#

You do not need to rely on the QanVault user interface to verify that a draw was fair. You can verify it directly in your terminal:

bash
# 1. Fetch the commitment hash and revealed seed from BscScan or RPC
DRAW_ID=104
COMMIT_BLOCK=38492015
REVEALED_SEED="0xa8f2..."
BLOCK_HASH="0x4b7e..."

# 2. Compute local keccak256 hash using foundry cast or python
cast keccak $(cast concat-hex $REVEALED_SEED $(cast to-hex $DRAW_ID) $(cast to-hex $COMMIT_BLOCK))

If the generated hash matches the on-chain commitment hash recorded at draw closure, the draw is cryptographically proven to be valid and unmanipulated.


Next Steps#