Lucky Spin — Provably Fair Wheel Game on QTUM

A complete, open-source spin wheel dApp running on QTUM testnet. 1 QTUM per spin, 8 prize segments, on-chain settlement via commit-reveal.

QTUM Testnet MetaMask Snap Provably Fair 3.75% House Edge

What Is Lucky Spin?

Lucky Spin is a provably fair wheel-of-fortune game running on the QTUM blockchain testnet. Players connect their wallet through MetaMask with the qtum-wallet extension, pay 1 QTUM to spin a wheel with 8 prize segments, and receive automatic on-chain payouts.

The game uses a commit-reveal scheme to ensure that neither the house nor the player can predict or manipulate the outcome. The result is computed on-chain from keccak256(houseSeed + playerSeed + spinId) % 8, making every spin independently verifiable.

Try It Live

Play Lucky Spin right now at dice.ziesto.ca/spin. You'll need MetaMask and some testnet QTUM.

How It Works

Every spin follows this provably fair flow:

1

House Commits

The backend generates a secret house seed, stores it, and sends only the keccak256 hash to the frontend.

2

Player Commits

The frontend generates a random player seed, hashes it, and calls placeSpin() on the smart contract with both hashes plus 1 QTUM.

3

Both Reveal

After on-chain confirmation, the player sends their seed to the backend, which then calls revealAndResolve() with both seeds.

4

On-Chain Settlement

The contract computes keccak256(houseSeed + playerSeed + spinId) % 8 to determine the winning segment and automatically sends the prize.

Prize Structure

The wheel has 8 equal segments. Each spin costs exactly 1 QTUM:

Segment Color Payout Net Result Count Chance
0, 4 Red 0.4 QTUM -0.6 QTUM 2 25%
1, 5 Orange 0.7 QTUM -0.3 QTUM 2 25%
2, 6 Green 1.1 QTUM +0.1 QTUM 2 25%
3 Blue 1.3 QTUM +0.3 QTUM 1 12.5%
7 Gold 2.0 QTUM +1.0 QTUM 1 12.5%

House Edge

The expected value per spin is 0.9625 QTUM, calculated as:

EV = (2/8 × 0.4) + (2/8 × 0.7) + (2/8 × 1.1) + (1/8 × 1.3) + (1/8 × 2.0)
   = 0.1 + 0.175 + 0.275 + 0.1625 + 0.25
   = 0.9625 QTUM

// House edge = (1 - 0.9625) / 1 = 3.75%

Technology Stack

SpinGame.sol

Solidity smart contract handling spin placement, seed verification, segment calculation, and automatic payouts.

React + Three.js Frontend

3D spin wheel built with Three.js, bloom post-processing, particle effects, and MetaMask Snap integration.

Node.js Backend

Express server handling house seed generation, blockchain event monitoring, and reveal coordination.

MetaMask + qtum-wallet

Wallet connection and transaction signing via MetaMask's Snap framework for QTUM support.

Explore the Guides

Contract Address (Testnet)

Contract Address
SpinGame 33531da3d5d75c0dc1cd7e852c07c364d6072c8e