
Castle Roulette
Independent verification, backed by open-source code.
- Live Bets Verified
- 1,350
- Parity Rate
- 100%
- Simulated RoundsSimulated RTP 100.007%
- 5M
- Simulated RTP 100.007%
- Proven RTP · base tier
- 100.0%
- Base stake tier · settlement edge 0
Verification pipeline
Real bets. Independently reproduced.
Placed anonymously at Duel.com. We rebuilt the game logic from scratch and matched all 1,350 recorded outcomes.
The casino result, reproduced.
- Casino outcome
- Green · Position 0
- Our reproduction
- Green · Position 0
- Recorded payout
- $0.0000
- Seed Hash IntegrityPass
- Bet Before drand BeaconPass
- drand Round MonotonicityPass
- Server Seed UniquenessPass
- Position RecomputationPass
- Bet-Size InvariancePass
- Payout MathPass
- Color-Position MappingPass
- Settlement EdgePass
- Phase CoveragePass
- Dataset HashPass
- drand Chain FormulaPass
- Anti-CircularityPass
- Pass 1 (Fisher’s)Pass
- Pass 2 (Casino Seeds)Pass
- drand API VerificationPass
- Configuration CoveragePass
- Artifact IntegrityPass
- Live-Sample FitPass
The repo is the credential. Every scored step ships as code. Check out v1.2.1, run npm ci, then npm test: 24 unit tests, 19 scored steps, all 1,350 live rounds re-verified offline and compared field by field with the committed results.
Duel.com Castle Roulette is provably fair: Full Pass under Framework 1.1. We captured 1,350 real rounds in April 2026 and reproduced every wheel position from the revealed server seed and the public drand beacon, with our own position code rebuilt from a written specification. All 19 scored steps pass, with no flags. The wheel and paytable return 100% by construction, and every captured win was credited the full multiplier.
Audit Verdict
| Check | Result | Evidence |
|---|---|---|
| Overall Status | Pass | PROVABLY FAIR — Full Pass · 19 of 19 scored steps pass · 0 flags · 0 hard fails · Framework 1.1, release v1.2.1 |
| RTP Verified | Pass | Proven RTP 100.0%: the wheel and paytable return 100% on every color tier (count × multiplier = 48), and all 473 captured wins were credited the full multiplier, a settlement edge of 0 · RTP claim rule: NOTED, Duel’s Zero Edge line is recorded, not tested · 100.007% simulated over 5M rounds |
| Live ↔︎ Verifier Parity | Pass | 100% — 1,350 / 1,350 wheel positions reproduced, 0 mismatches |
| Commit-Reveal System | Pass | 1,350 / 1,350 revealed seeds hash to their commitments; one fresh seed per round. Consistency checks: when each hash was first shown is not in the capture |
| drand Beacon | Pass | 1,350 / 1,350 beacon values equal drand.cloudflare.com’s for their rounds; every bet timestamped before its beacon on Duel’s clock (min 14.763 s); round IDs strictly increase |
| Client Seed | N/A | No client seed: the unpredictable input is the public drand beacon, published after betting closes |
| RNG Analysis | Pass | Our position code, rebuilt from a written specification, reproduces every round; Duel’s own Verify-tab code, run unmodified as a second check, agrees on 1,350 / 1,350; plain uint32 % 48, bias 1.55 × 10⁻¹⁰ per position |
| Payout Logic | Pass | 0 payout errors on all 1,350 rounds; the served multiplier equals the table at the recomputed position on every round |
| Settlement Edge | Info | 0 at the captured stakes ($0.01 and $1.00). Above Duel’s Zero Edge allowance, Duel’s settings and client code give a 0.1%–5% edge; no captured stake reached it, and server settlement there was not observed |
| Anti-Circularity | Pass | Tier probabilities counted from the uint32 % 48 mapping, with no casino-supplied probability: P × multiplier = 1 within 1.12 × 10⁻⁸ on all 6 tiers; a corrupted table is rejected on every tier |
| Fairness Integrity | Pass | 15 standard fairness integrity tests — 14 pass, 1 N/A (player-action invariance — global outcome model) — results recorded in S5 matrix |
| Determinism | Pass | Same server seed and beacon, same position: 1,350 / 1,350, at $0.01 and $1.00 alike |
Overall StatusPass
RTP VerifiedPass
Live ↔︎ Verifier ParityPass
Commit-Reveal SystemPass
drand BeaconPass
Client SeedN/A
RNG AnalysisPass
Payout LogicPass
Settlement EdgeInfo
Anti-CircularityPass
Fairness IntegrityPass
DeterminismPass
What Was Audited
✓ Audited
- Wheel positions reproduce from the revealed server seed and the drand beacon: 1,350 / 1,350 live rounds
- Every revealed server seed hashes to its commitment, with one fresh seed per round (a consistency check)
- Every beacon value equals the public quicknet chain’s value for its round, and every publication time follows the chain formula
- Every bet was timestamped before its beacon was published, on Duel’s own transactions-API clock
- Our position code, rebuilt from a written specification, matches every live position; Duel’s own Verify-tab code agrees as a second check
- Payouts, win flags and served multipliers are exact on every captured round, at both stakes
- Baseline RTP from first principles on all 6 color tiers: count × multiplier = 48, 100.0% before any settlement edge
- Every captured win was credited stake × table multiplier exactly: a settlement edge of 0 at $0.01 and $1.00
- Bet size does not move the wheel: $1.00 rounds recompute exactly like $0.01 rounds
- 5M simulated rounds and the casino-seed screen find no sign of positional bias or of seeds selected by outcome
What Audit Excludes
- Settlement edge above Duel’s Zero Edge allowance (0.1%–5%) — explained from the config in S4.7
- Stakes above $1.00 and more than one bet per round — not captured
- Max win
- Zero Edge ceilings and promotions — the $1,000 and $50,000 limits are Duel’s statement; no rakeback applies to this game
- Cross-account sampling
- Duel’s server code and seed generation — outcomes are verified from the captured rounds, their commitments and the public drand beacon
- Infrastructure or server security
- Wallet, payments, or operational systems outside game logic
What Audit Covers
| Area | Description |
|---|---|
| Commit-Reveal System | SHA-256 commitments of the hex-decoded server seed, one per round, revealed after the roll (consistency); commitment timing as a premise |
| drand Beacon | Quicknet values matched against drand.cloudflare.com, publication times from the chain formula, bet-before-beacon margins on Duel’s clock, round ordering |
| RNG Analysis | Spec-built HMAC-SHA256 position code, draw-bias bound of the plain % 48, Duel’s Verify-tab code as a second check |
| Live Parity | All 1,350 rounds recomputed; the ProvablyFair.org verifier and Duel’s Verify-tab code run on the same rounds |
| Payout Logic | Win condition from the recomputed tier, served multipliers against the table, credits at 18 dp, $1.00 vs $0.01 |
| RTP Validation | Baseline RTP from position counts, the RTP claim rule (Duel’s Zero Edge line, noted), the settlement edge from the config, 5M-round simulation, casino-seed screen |
| Fairness Integrity | Standard integrity matrix — 15 tests across seed integrity, bet timing, determinism, isolation, payout and wheel-position distribution |
What Audit Guarantees
- Outcomes reproduce from the recorded inputs: 1,350 / 1,350 captured rounds, at $0.01 and $1.00
- Every revealed server seed hashes to the commitment stored with its round
- Every beacon value is the public quicknet chain’s value for its round
- Every bet was timestamped before its beacon was published, by Duel’s clock
- Our spec-built position code and Duel’s own Verify-tab code return the served position on every captured round
- Payouts equal stake × the table multiplier on every captured round
- Baseline RTP is 100% on every color tier, from the wheel and paytable alone, without casino-supplied probabilities; the draw bias moves it by at most 7.45 × 10⁻⁹
- Every captured win was credited the full multiplier: a settlement edge of 0 at $0.01 and $1.00
- All 15 standard fairness integrity tests addressed at audit time — 14 pass, 1 N/A (player actions cannot influence the wheel position — global outcome model) — no hard failures
References
Castle Roulette — Game Rules7 sections▶
Castle Roulette is a multiplayer wheel game with 48 positions and 6 color tiers. Each round, Duel broadcasts the hash of a fresh server seed, players bet on a color, and after betting closes a drand beacon and the server seed fix one wheel position (0–47) for everyone. If the position belongs to your color tier, you win stake × the tier’s multiplier. The tiers are sized so that count × multiplier = 48 in every case, so every color returns 100% in expectation before any settlement edge.
How to Play
1. Place your bet — Enter a stake and choose one of the 6 color tiers: Green (48×), Red (24×), Purple (16×), Blue (8×), Grey (4×) or Dark Blue (2×). Other players can bet on the same round.
2. Round opens — Duel broadcasts the round ID and the SHA-256 hash of the round’s server seed. Save the hash if you want to check the round later.
3. Betting closes — No more bets are accepted for this round.
4. drand beacon publishes — The server waits for a drand quicknet beacon published after betting closes. The server seed and the beacon value together fix the wheel position.
5. Wheel resolves — The position is computed and shown on the wheel. It belongs to exactly one color tier.
6. Outcome — If the position’s tier matches your bet, you win stake × multiplier. If not, you lose the stake.
7. Verify — After the round, take the revealed server seed and the beacon value (any drand relay serves it by round number) and recompute the position yourself.
Win Conditions
A Castle Roulette bet wins if the resolved wheel position (0-47) belongs to the player's chosen color tier. The payout is stake × multiplier, where the multiplier is fixed per tier. There are no partial wins — the outcome is binary per bet.
| Outcome | Condition | Example (stake $1, Dark Blue 2× bet) |
|---|---|---|
| Win | Position belongs to chosen color tier | Position = 27 (Dark Blue range 24-47) → payout = $1 × 2 = $2.00 |
| Loss | Position belongs to a different color tier | Position = 5 (Purple, not Dark Blue) → payout = $0 (stake lost) |
Risk vs Reward
Risk is set by the color you choose. Rarer colors win less often and pay larger multipliers, and the six tiers are sized to the same expected value.
- Dark Blue (2×) wins half the time — 24 of 48 positions are Dark Blue, so P(win) = 50.00%: frequent small wins, the lowest variance.
- Green (48×) wins about once in 48 spins — only position 0 is Green, so P(win) = 2.08%: rare large wins, the highest variance.
- Expected value is the same on every tier — every color returns 1.000 per unit staked in expectation, a baseline RTP of 100% before any settlement edge.
- Variance grows as the win chance falls — short runs on rare tiers can return far more or far less than 100% (see S4).
Parameters
| Parameter | Value | Notes |
|---|---|---|
| Wheel Positions | 48 (0–47) | Fixed wheel, fixed position-to-color mapping |
| Color Tiers | 6 | Green, Red, Purple, Blue, Grey, Dark Blue |
| Multiplier Range | 2× to 48× | Fixed per tier |
| Settlement Edge | 0 at the base tier | Inside Duel’s Zero Edge allowance; beyond it 0.1% to 5%, from Duel’s settings and client code (not tested) |
| Baseline RTP | 100.0000% | From count × multiplier = 48 on every tier |
| RNG Algorithm | HMAC-SHA256 | Key: the hex-decoded server seed. Message: the beacon bytes read as UTF-8, plus ":0" |
| External Entropy Source | drand quicknet | 3-second period; chain 52db9ba7…4e971 |
| Round Structure | Multiplayer shared outcome | All players in a round share one server seed and one beacon |
Seed Formats
Every Castle Roulette round uses two inputs: a server seed committed by Duel and a beacon from the public drand chain. There is no player-contributed client seed; the beacon is the input Duel cannot set.
| Seed Type | Format | Example (round 538493) | Purpose |
|---|---|---|---|
| Server Seed | 64-char hex (32 bytes) | adace83dfe4957273…2420eb26 | Duel’s secret input, revealed after the round |
| Server Seed Hash | 64-char hex SHA-256 | ae7a5f98e2f47850…d18baaaa | Broadcast when the round opens: Duel’s commitment to the seed |
| drand Round ID | Integer | 28007049 | The quicknet beacon the round used, named after betting closes |
| drand Randomness | 96-char hex (BLS signature) | 8d59f6f2c17c6c3a…cd6621d | Public beacon value, served by any drand relay |
Multiplier Formula & Payout
Every wheel position maps to one of 6 color tiers, each with a fixed multiplier. The position comes from a single HMAC-SHA256, and the payout is stake × multiplier when the position’s color matches the bet.
u = first 4 bytes of HMAC-SHA256(key = serverSeed bytes,
message = UTF-8(drand bytes) + ":0"), big-endian
position = u % 48 (0 to 47, no rejection)
color, multiplier = PAYOUT_TABLE[position] (6 tiers)
If color matches the player’s bet: amount_won = stake × multiplier
Otherwise: amount_won = 0| Color | Positions | Count | Multiplier | P(win) | Payout / $1 | RTP |
|---|---|---|---|---|---|---|
| Green | 0 | 1 | 48× | 2.08% | $48.00 | 100.0% |
| Red | 1-2 | 2 | 24× | 4.17% | $24.00 | 100.0% |
| Purple | 3-5 | 3 | 16× | 6.25% | $16.00 | 100.0% |
| Blue | 6-11 | 6 | 8× | 12.50% | $8.00 | 100.0% |
| Grey | 12-23 | 12 | 4× | 25.00% | $4.00 | 100.0% |
| Dark Blue | 24-47 | 24 | 2× | 50.00% | $2.00 | 100.0% |
count × multiplier = 48 on all six: P(color) × multiplier = 1.000 before any settlement edge. The plain % 48 reduction gives positions 0–15 one extra value each out of 2³², a bias of 1.55 × 10⁻¹⁰ per position and at most 7.45 × 10⁻⁹ on a tier’s expected return.Multiplayer Model
Castle Roulette’s randomness is global to the round, not per player.
- One server seed per round — a fresh seed, its hash broadcast when the round opens
- One drand beacon per round — published after betting closes, on the chain’s fixed 3-second schedule
- One wheel position per round — computed once and shared by every player in the round
- Per-player outcomes — each player’s win or loss depends only on the color they backed
Why Provably Fair Matters▶
Traditional online casinos require players to trust that games are fair. Provably fair systems eliminate this trust requirement by allowing players to mathematically verify that outcomes were not manipulated. In a Provably Fair system:
- The casino commits to its server seed before you bet: save the hash, and a seed revealed later either matches it or it does not.
- A source of randomness the casino cannot set: the drand beacon, published by an independent network after betting closes.
- Anyone can verify the outcome after the fact, from the revealed seed and the public beacon.
High-Level Overview7 sections▶
Checklist Reference
Based on the ProvablyFair.org Audit Execution Checklist, here are the tests covered under this audit document.
Commit-Reveal & Seeds
| Check | What it shows |
|---|---|
| SHA-256 of the revealed seed matches its commitment | The revealed seed is the one behind that hash |
| One fresh seed per round | No seed is reused: 1,350 distinct seeds and hashes |
| Commitment recorded before the beacon | A premise: the capture kept no timed record of when each hash was shown |
drand Beacon
| Check | What it shows |
|---|---|
| Beacon value equals the public chain’s | The external input is the published quicknet value |
| Publication time from the chain formula | genesis + (round − 1) × 3 s, recomputed for every round |
| Bet timestamped before the beacon | On Duel’s own clock, for every captured bet |
| Round IDs strictly increase | No beacon reused or taken out of order |
RNG & Parity
| Check | What it shows |
|---|---|
| Positions recompute from seed + beacon | The outcome is deterministic and verifiable |
| Our spec-built code and Duel’s code agree on every round | No hidden inputs to the RNG |
| Draw bias bounded | Plain % 48: 1.55 × 10⁻¹⁰ per position, at or under 2⁻³² |
Payout & RTP
| Check | What it shows |
|---|---|
| Served multiplier equals the table | Payouts follow the published paytable |
| Credit = stake × multiplier at 18 dp | A settlement edge of 0 at the captured stakes |
| P × multiplier = 1 on all 6 tiers | Baseline RTP is 100% by construction, not observation |
Integrity
| Check | What it shows |
|---|---|
| Bet size does not influence the outcome | $1.00 and $0.01 bets follow the same formula |
| Casino-seed screen on 1,350 revealed seeds | No sign of seed selection by outcome |
| Live probes on the bet channel | Invalid bets dropped, injected outcome fields ignored |
High-Level Flow
To get an overview of how a single Castle Roulette round works, here is a high-level breakdown:
1. Round Opens — Duel broadcasts the round ID and the SHA-256 hash of a fresh server seed
2. Players Bet — Each player chooses a color and a stake while betting is open
3. Betting Closes — No more bets for this round
4. drand Publishes — The server waits for a quicknet beacon published after betting closes (a new beacon every 3 seconds)
5. Wheel Position Computed — HMAC-SHA256(serverSeed bytes, UTF-8(beacon bytes) + ":0") → first 4 bytes as uint32 → u % 48 → position 0–47
6. Roll & Reveal — The wheel shows the position, and the server seed is revealed with the drand round ID and the beacon value
7. Payout — Each player whose color matches the tier is paid stake × multiplier; other stakes are lost
8. Verify — Anyone can recompute the position from the revealed seed and the beacon
Provably Fair Model
Castle Roulette combines three things: a server seed committed by its SHA-256 hash, a public randomness beacon (drand quicknet) whose value and publication time anyone can check, and HMAC-SHA256 as the deterministic function that combines them into a wheel position. Duel broadcasts the hash when the round opens, and the beacon is published after betting closes, so a seed fixed before its beacon cannot be fitted to it. Two trusts remain: that the seed was fixed before the beacon, which a hash saved before betting lets you check, and which later beacon a round uses, a rule Duel does not publish.
Commit-Reveal Model
The commit-reveal model for Castle Roulette has four phases, with the public beacon between the commitment and the reveal:
Commit phase:
When the round opens, Duel broadcasts the round ID and SHA-256(hex_decode(serverSeed)) of a fresh server seed. The seed stays secret. Bets are accepted.
drand phase:
Betting closes and the server waits for a drand quicknet beacon. The chain publishes a new beacon every 3 seconds, signed by an independent threshold network; neither Duel nor the player sets its value.
Compute phase:
The server combines the server seed and the beacon value with HMAC-SHA256 and reduces the first 4 bytes modulo 48 to the wheel position.
Reveal phase:
The server seed is revealed with the drand round ID and the beacon value. Anyone can check SHA-256(hex_decode(serverSeed)) against the hash they saved and recompute the position. The next round uses a fresh seed: there is no seed chain or epoch.
Why Castle Roulette Uses a Public Randomness Beacon
Castle Roulette has no per-player client seed. Its second input is a public randomness beacon, drand quicknet, which publishes a new value every 3 seconds, signed by a threshold of independent operators. Everyone, Duel included, sees the same value at the same time. For the player this works like a client seed:
- Duel broadcasts the server seed’s hash when the round opens and the beacon arrives after betting closes; the capture kept no timed record of the broadcast, so that ordering is a premise (S1.2)
- The beacon is a BLS threshold signature: no single party can produce or predict it
- Any player can fetch the beacon for the round’s drand round ID from any relay and compare it with the value the round used
- Every player in the round shares the same server seed and beacon: one outcome for the round, not one per player
Why There's No Nonce or Epoch Chain
Castle Roulette gives every round a brand-new server seed, so there is no nonce counter and no seed rotation. The reveal happens after each round.
- Each round has exactly one server seed: no reuse, no chain, no cursor
- The nonce is fixed at
0: every HMAC message ends in:0, because every seed is already unique - There is no epoch to rotate: the seed is revealed after its own round
- The 1,350-round dataset holds 1,350 distinct server seeds and 1,350 distinct hashes (Step 4)
Round N: serverSeed_N (fresh), drand beacon_N → wheelPosition_N [seed revealed after the round] Round N+1: serverSeed_(N+1) (new, unrelated), drand beacon_(N+1) → wheelPosition_(N+1) [seed revealed after the round] ... Every round is a fresh commitment. There is no nonce counter: every HMACmessage ends with the fixed suffix ":0".Determinism Guarantee
Given identical inputs, the output is always identical:
HMAC-SHA256(hex_decode(serverSeed), UTF-8(drand bytes) + ":0") → Always same digestFirst 4 digest bytes as a big-endian uint32 → Always same valuevalue % 48 → Always same positionPAYOUT_TABLE[position] → Always same color/multipliercolor matches the player’s bet → Always same win/lossstake × multiplier → Always same payoutTechnical Glossary7 categories▶
Core Concepts
| Term | Definition |
|---|---|
| Provably Fair | A gambling model in which the inputs to every outcome are cryptographically committed before the outcome is known, and any player can independently verify the outcome after the fact without trusting the operator. |
| Commit-Reveal Protocol | A two-phase protocol: a party publishes a hash of a secret before play (commit), then reveals the secret afterward (reveal). A match shows the revealed secret is the one behind the hash; a copy of the hash saved in advance shows it was fixed before play. In Castle Roulette, Duel broadcasts each round’s hash when the round opens and reveals the seed after the roll. |
| External Entropy Source | A source of randomness outside the operator’s control that goes into every outcome. Castle Roulette uses the drand quicknet public randomness beacon. |
| Determinism | Identical inputs always produce identical outputs. In Castle Roulette, a server seed and a beacon value produce exactly one wheel position (0–47). |
| Framework 1.1 | The ProvablyFair.org audit framework this report is certified under: scored steps with Pass, capture flag, operator flag or hard fail; the RTP claim rule; game-profile coverage; the S5 fairness-integrity matrix. |
| Capture flag | A flag caused by our own capture, not by the operator, which Framework 1.1 discloses apart from operator findings. This audit has none. |
Seed System
| Term | Definition |
|---|---|
| Server Seed | A 64-character hex string (32 bytes) generated by the operator. Hex-decoded to raw bytes before use as the HMAC key. Each Castle Roulette round uses a unique server seed. |
| Server Seed Hash | The SHA-256 hash of the hex-decoded server seed bytes. Broadcast by Duel when the round opens: the commitment to the seed. |
| drand Round ID | An integer identifying one beacon of the drand quicknet chain. The server names the beacon a round uses after betting closes; the beacon publishes on the chain’s fixed schedule. |
| drand Randomness | The 96-character hex BLS signature the quicknet chain publishes for a round. Hex-decoded, read as UTF-8 and followed by :0, it forms the HMAC message. |
| Single-Use Seed Model | Castle Roulette’s seed model: every round gets a fresh server seed, with no reuse, no chain and no nonce counter. The nonce is fixed at 0, the :0 suffix of every HMAC message. |
Cryptographic Functions
| Term | Definition |
|---|---|
| HMAC-SHA256 | Keyed hash function: the server seed bytes are the key, the beacon text plus :0 the message. The first 4 bytes of the 32-byte digest, read as a big-endian uint32, give the wheel position. |
| SHA-256 | Cryptographic hash function used for the commit-reveal proof. SHA-256(hex_decode(serverSeed)) = serverSeedHash is checked on every round. |
| BLS Threshold Signature | The signature scheme of the drand quicknet chain. A beacon needs a threshold of independent signers, so no single party can produce or predict it. |
| Hex Decoding | Converting a hex string to raw bytes. The server seed is hex-decoded for the HMAC key; the drand randomness is hex-decoded, read as UTF-8 and re-encoded for the HMAC message. |
| uint32 Modulo Mapping | How the HMAC output becomes a wheel position: the first 4 digest bytes are read as an unsigned 32-bit integer u, and the position is u % 48, with no rejection. Positions 0–15 carry 89,478,486 of the 2³² values and positions 16–47 carry 89,478,485: a bias of 1.55 × 10⁻¹⁰ per position. |
| Rejection Sampling | Discarding values outside an evenly divisible range so every outcome is exactly equally likely. The published algorithm takes a plain % 48 instead, and no captured round reaches the values where the two differ, so the bias is bounded (S2). |
Verification Terms
| Term | Definition |
|---|---|
| Verifier | An implementation of the RNG and payout rules that recomputes live outcomes from the captured inputs. It must give the live result on every round. |
| Parity | The property that the verifier's computed wheel position equals the live game's reported position for every round. 1,350 / 1,350 parity means zero mismatches across the entire dataset. |
| Anti-Circularity | Deriving RTP without casino-supplied probabilities: the tier probabilities are counted from the uint32 % 48 mapping, and P × multiplier = 1 on all six tiers, with a negative control that rejects each multiplier + 1. |
| Direct Algebraic Proof | Castle Roulette’s anti-circularity technique: every tier satisfies count × multiplier = 48, which gives a baseline RTP of 100.0000% by elementary arithmetic, before any settlement edge. |
| RTP Claim Rule | RTP-CLAIM 1.2.0: every setting is held to the RTP the casino publishes for it, within ±0.1 pp. A zero-edge line such as Duel’s Zero Edge allowance is noted, not tested. A house-side miss is the verdict RTP FIGURE OVERSTATED (exit 5), never a fairness fail. |
| Base Stake Tier | Bets inside Duel’s Zero Edge allowance, where Duel’s client code computes a settlement edge of 0: up to $1,000 of a bet within $50,000 of wagering per 24 hours, by Duel’s statement. The page’s RTP and payout guarantees cover this tier; the captured stakes, $0.01 and $1.00, sit inside it. |
| Casino-Seed Screen (Pass 2) | A chi-squared test of the position distribution of every revealed casino seed paired with 1,000 synthetic beacon values. Many failures would point to seeds chosen by outcome. |
Game Mechanics
| Term | Definition |
|---|---|
| Wheel Position | The integer 0-47 produced by value % 48, where value is the first 4 bytes of the HMAC output as a uint32. Each position belongs to exactly one of the 6 color tiers. |
| Color Tier | A group of wheel positions that share a payout multiplier. The 6 tiers are: Green (position 0, 48×), Red (1-2, 24×), Purple (3-5, 16×), Blue (6-11, 8×), Grey (12-23, 4×), Dark Blue (24-47, 2×). |
| Baseline RTP | The wheel and paytable’s expected return before any settlement edge: 100% on every color tier, because count × multiplier = 48 for all six. |
| Shared Round | One round’s server seed and beacon are shared by every player who bets into it, so every player sees the same position. The seed’s hash is broadcast when the round opens; the beacon is published after betting closes. |
| Multi-Stream Chi-Squared | The S4 Pass 1 method: 10 independent 500K-round streams, each tested with chi-squared on the 48 positions, their p-values combined by Fisher’s method. A biased RNG drives the combined p-value down. |
| Settlement Edge | The reduction of a win’s multiplier at settlement, by Duel’s disclosure: 0 inside the Zero Edge allowance; above it, the edge on the stake beyond the allowance, scaled by Duel’s bankroll, between a 0.1% floor and a 5% ceiling. Read from Duel’s settings and client code; not tested. |
| Zero Edge | Duel’s allowance that removes the settlement edge: up to $1,000 of a bet within $50,000 of wagering per 24 hours, as Duel states it. Noted, not tested. |
Audit Terms
| Term | Definition |
|---|---|
| Fairness-Integrity Matrix | The 15 standard fairness integrity tests in S5, in six categories: seed integrity, bet timing, determinism, isolation, payout integrity and wheel-position distribution. Two are live probes on the bet channel; one is N/A for a shared-outcome game. |
| Game Profile | The framework’s per-game check list (Castle Roulette profile 1.0.2, checks CASTLE-01 to CASTLE-30). Each check is covered by a scored step, a package check, or marked n/a with a reason. |
| Bet-Before-Beacon Margin | The beacon’s publication time minus Duel’s bet timestamp, in milliseconds. Positive on all 1,350 rounds; it times the bet, not the commitment. |
| Mutation Battery | Deliberate faults injected into a disposable copy of the package, each of which a named step must catch: 30 / 30 caught. |
Data Formats
| File | Contents |
|---|---|
| data/castle-roulette-master-1350rounds.json | The capture dataset: 1,350 rounds across Phases A–E, each with its bet, served result, revealed seed, beacon and timing. SHA-256 pinned in S1 and S7. |
| outputs/verification-results.json | Output of the 19-step verification suite: per-step status, detail, profile checks and informational items. |
| outputs/simulation-results.json | Pass 1 (10 streams × 500,000 rounds, per-position counts) and Pass 2 (1,350 casino seeds × 1,000 beacon values). |
| outputs/drand-api-verification.json | Every round’s beacon value compared with the one drand.cloudflare.com returned for its round. |
| outputs/rtp-claim-table.json | The six color tiers’ exact RTP against the claim, under the RTP claim rule. |
Commit-Reveal & Beacon Timing
Can the casino change your outcome after you bet?
Every Castle Roulette round is generated from two inputs: a server seed and the public drand beacon. Duel broadcasts a SHA-256 hash of each round’s server seed when the round opens and reveals the seed after the roll. Every revealed seed in the capture hashes to its commitment, and every bet was timestamped before its beacon was published. Those are consistency checks: when each hash was first shown is not in the capture, and the bet times are Duel’s own. Save the hash yourself and the timing is yours to check.
What we verified
- Every revealed server seed hashes to the commitment stored with its round: 1,350 / 1,350
- One fresh server seed per round: 1,350 distinct seeds and 1,350 distinct hashes
- Every bet was timestamped before its beacon was published, on Duel’s own clock (min 14.763 s)
- Every beacon’s publication time follows the public quicknet chain formula
- drand round IDs strictly increase across all 1,350 rounds
- Same inputs, same wheel position: 1,350 / 1,350, at $0.01 and $1.00 alike
What this means for you
- If you save the hash before you bet, a swapped seed cannot match it
- The beacon comes from a public chain on a fixed schedule, outside Duel’s control
- Every round has its own seed: nothing carries over from one round to the next
- Any round can be rechecked from public inputs, months later
- Every revealed server seed hashes to the commitment stored with its round: 1,350 / 1,350
- One fresh server seed per round: 1,350 distinct seeds and 1,350 distinct hashes
- Every bet was timestamped before its beacon was published, on Duel’s own clock (min 14.763 s)
- Every beacon’s publication time follows the public quicknet chain formula
- drand round IDs strictly increase across all 1,350 rounds
- Same inputs, same wheel position: 1,350 / 1,350, at $0.01 and $1.00 alike
- If you save the hash before you bet, a swapped seed cannot match it
- The beacon comes from a public chain on a fixed schedule, outside Duel’s control
- Every round has its own seed: nothing carries over from one round to the next
- Any round can be rechecked from public inputs, months later
Seed hash integrityPass
Server seed uniquenessPass
Commitment timingInfo
Bet before beaconPass
Beacon publication timesPass
drand round orderingPass
Deterministic outputPass
All 1,350 revealed seeds hash to their commitments, one fresh seed per round. Every bet was timestamped before its beacon was published, and every publication time follows the public chain formula. Identical inputs always give the same position.
| Check | Result | Evidence |
|---|---|---|
| Seed hash integrity | Pass | 1,350 / 1,350 revealed seeds hash to their commitments (SHA-256 of the hex-decoded bytes); 0 mismatches |
| Server seed uniqueness | Pass | 1,350 distinct seeds and 1,350 distinct hashes: one fresh commitment per round |
| Commitment timing | Info | Reported, not scored: the capture kept each hash in the round’s result record with no receipt time, so a match shows consistency, not when the hash was shown |
| Bet before beacon | Pass | 1,350 / 1,350 bets timestamped before their beacon on Duel’s transactions-API clock: min 14.763 s, mean 20.067 s, max 20.405 s |
| Beacon publication times | Pass | 1,350 / 1,350 equal genesis + (round − 1) × 3 s on the quicknet chain |
| drand round ordering | Pass | 1,349 / 1,349 transitions strictly increasing: no beacon round reused or out of order |
| Deterministic output | Pass | Same (server seed, beacon) → same position: 1,350 / 1,350; $1.00 rounds recompute like $0.01 rounds |
Seed hash integrityPass
Server seed uniquenessPass
Commitment timingInfo
Bet before beaconPass
Beacon publication timesPass
drand round orderingPass
Deterministic outputPass
All 1,350 revealed seeds hash to their commitments, one fresh seed per round. Every bet was timestamped before its beacon was published, and every publication time follows the public chain formula. Identical inputs always give the same position.
How It Works — Commit-Reveal & Beacon Timing7 sections
1.1Server Seed Commitment
When a round opens, Duel broadcasts the round ID and the SHA-256 hash of a fresh server seed. The seed is a 64-character hex string, and the hash is taken over the 32 bytes it encodes: SHA-256(hex_decode(serverSeed)). After the roll the seed is revealed with the beacon, and anyone can check that it hashes to the commitment.
export function verifyHash(serverSeed: string, serverSeedHash: string): boolean { const computed = createHash('sha256').update(decodeHex(serverSeed)).digest('hex'); return computed === serverSeedHash.toLowerCase();}Real Example from Live Data:
{ "roundId": 538493, "result": { "position": 27, "serverSeed": "adace83dfe4957273152c5c52aea5e4fc112dabef87ff4baa350ca652420eb26", "serverSeedHash": "ae7a5f98e2f4785022a58890db980cb71bb9f0c1bd02a44a1d69699ad18baaaa", "drandRoundId": 28007049, "drandRandomness": "8d59f6f2c17c6c3a77f65dfc4b5530bb607c8891d21a90cdff2628d69a461ca692b6ad3c041e1c7a8a9d87005cd6621d" }}Verification:
const crypto = require('crypto'); const serverSeed = "adace83dfe4957273152c5c52aea5e4fc112dabef87ff4baa350ca652420eb26"; const serverSeedHash = crypto .createHash("sha256") .update(Buffer.from(serverSeed, 'hex')) .digest("hex"); console.log(serverSeedHash);// Output: ae7a5f98e2f4785022a58890db980cb71bb9f0c1bd02a44a1d69699ad18baaaa ✅1.2Commitment Timing
A hash match shows that a revealed seed is the one behind its hash. On its own it does not show when the hash was shown: a seed and hash made after the round would match each other too. The capture kept each round’s hash in its result record, taken from the round’s broadcast messages or from Duel’s transactions API, with no receipt time. So “each seed was fixed before its beacon” is a premise of this audit, not a finding. A player who saves the hash before betting can check it for their own rounds: the saved copy is what times the commitment.
1.3Bet Before Beacon (Step 2)
For every round, Step 2 checks that the bet was accepted before the round’s beacon was published. The bet time is timestamp_raw from Duel’s transactions API, the operator’s own database timestamp for the bet. The publication time comes from the public chain formula, so anyone can recompute it. Step 2 recomputes every margin from the raw fields and requires the capture’s stored margin to equal it exactly. It times the bet, not the commitment.
for (const r of rounds) { if (r.timing.source === EXPECTED_TIMING_SOURCE) serverTimestamped++; else failures.push(`round ${r.roundId}: timing.source '${r.timing.source}' is not '${EXPECTED_TIMING_SOURCE}'`); const cbd = r.timing.drandPublishedAt * 1000 - r.timing.betPlacedAt; // … if (r.timing.commitmentBeforeDrand !== cbd) { precomputedDisagreements++; // … } if (cbd > 0) { positive++; if (cbd < minMarginMs) minMarginMs = cbd; if (cbd > maxMarginMs) maxMarginMs = cbd; sumMs += cbd; } else { nonPositive++; if (failures.length < 8) failures.push(`round ${r.roundId}: bet placed at or after drand publication`); }}Real Example — round 538493 timing:
{ "drandPublishedAt": 1776824511, "drandPublishedAtISO": "2026-04-22T02:21:51.000Z", "commitmentBeforeDrand": 20379, "betPlacedAt": 1776824490621, "betPlacedAtISO": "2026-04-22 02:21:30", "source": "transactions-api"}Verification:
// betPlacedAt — Duel’s transactions-API timestamp for the bet (operator clock)// drandPublishedAt — from the public quicknet chain formula:// genesis + (drandRoundId - 1) × 3// genesis = 1692803367 (2023-08-23T15:09:27Z)// period = 3 seconds const QUICKNET_GENESIS = 1692803367;const QUICKNET_PERIOD = 3; const drandPublishedAt = QUICKNET_GENESIS + (28007049 - 1) * QUICKNET_PERIOD;// → 1776824511 (2026-04-22T02:21:51.000Z) ✅ const margin_ms = drandPublishedAt * 1000 - 1776824490621;// → 20379 ms: the bet was timestamped 20.379 s before the beacon ✅1.4Beacon Publication Times (Step 12)
The quicknet chain publishes round n at 1692803367 + (n − 1) × 3 seconds (genesis 23 August 2023, 15:09:27 UTC; one beacon every 3 seconds). Step 12 recomputes the publication time of every round’s beacon from its drand round ID and compares it with the captured drandPublishedAt.
for (const r of rounds) { const expected = QUICKNET_GENESIS + (r.result.drandRoundId - 1) * QUICKNET_PERIOD; if (r.timing.drandPublishedAt === expected) match++; else mismatches.push(`round ${r.roundId}: drandPublishedAt ${r.timing.drandPublishedAt} != ${expected}`);}1.5drand Round Ordering (Step 3)
Step 3 checks that drand round IDs strictly increase from one captured round to the next: no beacon round is reused or taken out of order. This is ordering only. It does not show which later beacon the server pairs with a round; that rule is not published.
for (let i = 1; i < rounds.length; i++) { compared++; if (rounds[i].result.drandRoundId <= rounds[i - 1].result.drandRoundId) { violations.push(`round ${rounds[i].roundId}: drand ${rounds[i].result.drandRoundId} does not exceed the previous ${rounds[i - 1].result.drandRoundId}`); }}1.6Server Seed Uniqueness & Single-Use Model (Step 4)
Castle Roulette has no seed epochs and no nonce counter. Every round gets a brand-new server seed, committed when the round opens and revealed after the roll, so no seed carries over to influence a later round. Step 4 counts distinct seeds and hashes against the population declared in the package.
const seeds = new Set(rounds.map(r => r.result.serverSeed));const hashes = new Set(rounds.map(r => r.result.serverSeedHash));const issues: string[] = [];if (seeds.size !== rounds.length) issues.push(`${rounds.length - seeds.size} rounds reuse a server seed`);if (hashes.size !== rounds.length) issues.push(`${rounds.length - hashes.size} rounds reuse a commitment hash`);if (seeds.size !== EXPECTED_DISTINCT_SEEDS) issues.push(`distinct seeds ${seeds.size} != ${EXPECTED_DISTINCT_SEEDS}`);if (hashes.size !== EXPECTED_DISTINCT_SEEDS) issues.push(`distinct hashes ${hashes.size} != ${EXPECTED_DISTINCT_SEEDS}`);1.7Deterministic Mapping
The position is fully deterministic: the same server seed and beacon always give the same wheel position. The server seed is hex-decoded to 32 bytes for the HMAC key. The beacon is hex-decoded to 48 bytes, read as UTF-8 (each invalid byte run becomes U+FFFD) and re-encoded, and :0 is appended to form the message. The first 4 bytes of the HMAC-SHA256 digest, read as a big-endian uint32, give the position by u % 48, which looks up its color and multiplier in the 6-tier table.
export function computePosition(serverSeed: string, drandSeed: string): number { const key = decodeHex(serverSeed); if (key.length === 0) throw new Error('serverSeed decodes to zero bytes'); return computePositionFromBuffer(key, drandSeed);}Real Bet Verified:
// Round 538493: Phase A, $0.01 on Dark Blue (2×){ "roundId": 538493, "request": { "amount": "0.01", "coin": "two" }, "result": { "position": 27, "winningCoin": "two", "serverSeed": "adace83dfe4957273152c5c52aea5e4fc112dabef87ff4baa350ca652420eb26", "drandRoundId": 28007049, "drandRandomness": "8d59f6f2c17c6c3a77f65dfc4b5530bb607c8891d21a90cdff2628d69a461ca692b6ad3c041e1c7a8a9d87005cd6621d", "isWin": true, "multiplier": "2.000000000000000000", "amountWon": "0.020000000000000000" }}Verification:
// computePosition("adace83d…", "8d59f6f2…")//// 1. key = hex_decode(serverSeed) // 32 bytes// 2. text = UTF-8 decode of hex_decode(drand) // 48 bytes → 47 characters// 3. message = UTF-8(text) + ":0" // 49 characters// 4. digest = HMAC-SHA256(key, message)// → d6b318ab366262e3139f86c6d1f6695b548ee0e56c05128f5ba0b8ae1b71b3b1// 5. u = first 4 bytes, big-endian // 0xd6b318ab → 3,602,061,483// 6. position = u % 48 // 3,602,061,483 % 48 = 27//// Output: position 27 → Dark Blue tier (positions 24–47, 2×) ✅// Payout: $0.01 × 2 = $0.02 ✅Technical Evidence & Verification5 sections
1.8Evidence Coverage Summary7 checks
| Verification Area | Coverage | Result |
|---|---|---|
| Seed hash integrity (Step 1) | 1,350 / 1,350 commitments opened and verified | Pass |
| Bet before drand beacon (Step 2) | 1,350 / 1,350 positive margins (min 14.763 s), on Duel’s clock | Pass |
| drand round ordering (Step 3) | 0 violations in 1,349 transitions | Pass |
| Server seed uniqueness (Step 4) | 1,350 distinct seeds, 1,350 distinct hashes | Pass |
| Position recomputation (Step 5) | 1,350 / 1,350 wheel positions | Pass |
| Bet-size invariance (Step 6) | 100 / 100 Phase C ($1.00) rounds | Pass |
| drand chain formula (Step 12) | 1,350 / 1,350 publication times | Pass |
1.9Code References9 source files
| File | Purpose |
|---|---|
| tests/verify.ts | The 19 scored steps (Steps 1–6 and 12 cover S1), informational items and the reproduction gate |
| tests/steps/commitment.ts | Steps 1–4: seed hash, bet before beacon, drand round ordering, seed uniqueness |
| tests/steps/determinism.ts | Steps 5–6: position recomputation, bet-size invariance |
| tests/steps/dataset.ts | Steps 11–13: dataset hash, drand chain formula, anti-circularity |
| src/rng.ts | HMAC-SHA256 position code and seed hash check (computePosition, verifyHash), rebuilt from docs/ALGORITHM.md |
| src/verify-drand-timing.js | npm run timing: re-checks the chain formula and margins and re-fetches every beacon (network) |
| src/loader.ts | Dataset loader, SHA-256 guard and the declared population |
| capture/castle-roulette-capture.reference.js | Reference record of the browser-session capture |
| capture/castle-roulette-enrich.reference.js | Reference record of the enrichment from Duel’s transactions API |
1.10Datasets UsedSource artifacts
| Property | Value |
|---|---|
| Source | Live Castle Roulette rounds on Duel.com, one test account |
| Total Records | 1,350 rounds (Phase A: 800, Phase B: 200, Phase C: 100, Phase D: 100, Phase E: 150) |
| drand Round Range | 28,007,049 → 28,035,974 (quicknet) |
| Capture Window | 2026-04-22T02:20:49.763Z → 2026-04-23T02:29:27.407Z |
| SHA-256 | 506e05ee9c07966a721715cd7d7b369e72159601b6a6439542330b311ffd66ce |
Fields used: roundId, phase, request.amount, request.coin, result.position, result.winningCoin, result.serverSeed, result.serverSeedHash, result.drandRoundId, result.drandRandomness, result.multiplier, result.amountCurrency, result.amountWon, result.isWin, timing.betPlacedAt, timing.drandPublishedAt, timing.commitmentBeforeDrand, timing.source. result.isWin and result.effectiveEdge are written by the capture script, not served.
1.11Verified Invariants8 invariants
| Invariant | Result |
|---|---|
| SHA-256(hex_decode(serverSeed)) = serverSeedHash for all 1,350 revealed seeds | Pass |
| drandPublishedAt × 1000 − betPlacedAt > 0 for all 1,350 rounds, on a transactions-API timestamp | Pass |
| Stored margin equals the recomputed margin on all 1,350 rounds | Pass |
| drandPublishedAt = genesis + (drandRoundId − 1) × 3 for all 1,350 rounds | Pass |
| drand round IDs strictly increasing across all 1,349 transitions | Pass |
| 1,350 distinct server seeds and 1,350 distinct hashes across 1,350 rounds | Pass |
| computePosition(serverSeed, drandRandomness) = position for all 1,350 rounds | Pass |
| Phase C ($1.00) rounds recompute like Phase A ($0.01): the bet amount is not an RNG input | Pass |
1.12Reproduction InstructionsRun locally
Clone the release, install, and run the audit:
git clone https://github.com/ProvablyFair-org/duel-castle-roulette.gitcd duel-castle-roulettegit checkout v1.2.1npm cinpm test# Steps 1–6 and 12 cover S1S1 steps, as printed:
[PASS] Step 1 — Seed Hash Integrity
[PASS] Step 2 — Bet Before drand Beacon
[PASS] Step 3 — drand Round Monotonicity
[PASS] Step 4 — Server Seed Uniqueness
[PASS] Step 5 — Position Recomputation
[PASS] Step 6 — Bet-Size Invariance
[PASS] Step 12 — drand Chain FormulaRNG & Entropy Model
Is the randomness genuinely random, or could it be rigged?
Our position code, src/rng.ts, was rebuilt from a written specification (docs/ALGORITHM.md) by an implementer who never opened Duel’s code. It reproduces all 1,350 captured positions. Duel’s own Verify-tab code is run unmodified as a second check only, and agrees on all 1,350. The only inputs are the server seed and the drand beacon, and all 1,350 beacon values equal the public chain’s. The draw is a plain uint32 % 48, with a bias of 1.55 × 10⁻¹⁰ per position.
What we verified
- Our position code, rebuilt from a written specification, reproduces all 1,350 live positions
- Duel’s published Verify-tab code, run unmodified as a second check, agrees on 1,350 / 1,350
- Only the server seed and the beacon go in: no timestamp, no client seed, no hidden state
- All 1,350 beacon values equal the values drand.cloudflare.com returns for their rounds
- The
% 48reduction is bounded: 1.55 × 10⁻¹⁰ per position, at or under 2⁻³² - 5M simulated rounds find no sign of positional bias (Fisher’s p = 0.7712) or serial dependence
What this means for you
- Every captured wheel position follows the published algorithm; the tiny reduction bias is measured, not assumed away
- The external input is the public beacon value, not a number Duel wrote down
- No input beyond the server seed and the beacon goes into the position
- Each round has a fresh seed and its own beacon: past results say nothing about the next one
- You can check every input yourself against the public drand chain
- Our position code, rebuilt from a written specification, reproduces all 1,350 live positions
- Duel’s published Verify-tab code, run unmodified as a second check, agrees on 1,350 / 1,350
- Only the server seed and the beacon go in: no timestamp, no client seed, no hidden state
- All 1,350 beacon values equal the values drand.cloudflare.com returns for their rounds
- The
% 48reduction is bounded: 1.55 × 10⁻¹⁰ per position, at or under 2⁻³² - 5M simulated rounds find no sign of positional bias (Fisher’s p = 0.7712) or serial dependence
- Every captured wheel position follows the published algorithm; the tiny reduction bias is measured, not assumed away
- The external input is the public beacon value, not a number Duel wrote down
- No input beyond the server seed and the beacon goes into the position
- Each round has a fresh seed and its own beacon: past results say nothing about the next one
- You can check every input yourself against the public drand chain
Position code rebuilt from the specPass
Duel verify code (second check)Pass
Disclosed inputs onlyPass
Beacon valuesPass
Draw biasPass
Simulation uniformityPass
Serial independencePass
Our spec-built position code reproduces every captured round, and Duel’s own code agrees on all 1,350. Every beacon value is the public chain’s. The % 48 bias is bounded at 1.55 × 10⁻¹⁰ per position, and 5M simulated rounds find no sign of positional bias or serial dependence.
| Check | Result | Evidence |
|---|---|---|
| Position code rebuilt from the spec | Pass | src/rng.ts, written from docs/ALGORITHM.md without Duel’s code, reproduces 1,350 / 1,350 positions; the spec’s own vectors and properties pass (119 / 119) |
| Duel verify code (second check) | Pass | Duel’s Verify-tab code, run unmodified with only its inputs filled in, returns the served position on 1,350 / 1,350 |
| Disclosed inputs only | Pass | HMAC-SHA256(key = server seed bytes, message = UTF-8(beacon bytes) + ":0"): every round recomputes from these two inputs alone |
| Beacon values | Pass | 1,350 / 1,350 equal drand.cloudflare.com’s value for the same round (quicknet), by exact string comparison |
| Draw bias | Pass | Plain uint32 % 48, no rejection: 1.552 × 10⁻¹⁰ per position, at or under the 2⁻³² ceiling of 2.328 × 10⁻¹⁰; largest tier effect 7.45 × 10⁻⁹ |
| Simulation uniformity | Pass | 5M rounds (10 streams × 500K), every stream replayed: Fisher’s T = 15.09, p = 0.7712; 0 / 10 streams below α = 0.01 |
| Serial independence | Pass | lag-1 z = −2.384 (|z| < 3), runs p = 0.4312 on the replayed 5M-round sequence |
Position code rebuilt from the specPass
Duel verify code (second check)Pass
Disclosed inputs onlyPass
Beacon valuesPass
Draw biasPass
Simulation uniformityPass
Serial independencePass
Our spec-built position code reproduces every captured round, and Duel’s own code agrees on all 1,350. Every beacon value is the public chain’s. The % 48 bias is bounded at 1.55 × 10⁻¹⁰ per position, and 5M simulated rounds find no sign of positional bias or serial dependence.
How It Works — RNG & Entropy Model9 sections
2.1RNG Function Implementation
Each round produces one wheel position from one HMAC-SHA256. The 32 hex-decoded server seed bytes are the key. The 48 beacon bytes are read as UTF-8, with each invalid byte run replaced by U+FFFD, re-encoded, and :0 appended: that is the message. The first 4 digest bytes, read as an unsigned big-endian 32-bit integer, are reduced by u % 48 to a position in [0, 47], which looks up its color and multiplier in the 6-tier table. No shuffle, no loop: one HMAC, one integer, one modulo, one lookup.
| Component | Detail |
|---|---|
| Hash function | HMAC-SHA256 |
| Key | hex_decode(serverSeed): 32 bytes |
| Message | The beacon bytes read as UTF-8 (lossy, deterministic), re-encoded, then :0 |
| Extraction | First 4 digest bytes as an unsigned big-endian 32-bit integer u |
| Mapping | u % 48 → wheel position 0–47, no rejection |
| Lookup | PAYOUT_TABLE[position] → { multiplier, color } from the 6-tier table |
| Output | One wheel position per round, shared by every player |
function buildMessage(drandBytes: Buffer): Buffer { const text = new TextDecoder('utf-8').decode(drandBytes); return Buffer.concat([Buffer.from(text, 'utf8'), Buffer.from(':0', 'ascii')]);}// …export function positionFromDigest(hmacHex: string): number { if (!/^[0-9a-fA-F]+$/.test(hmacHex) || hmacHex.length < DRAW_HEX_CHARS) { throw new Error('digest must be hex with at least 8 characters'); } const u = parseInt(hmacHex.slice(0, DRAW_HEX_CHARS), 16); return u % RANGE;}// …export function computePositionFromBuffer(keyBuffer: Buffer, drandSeed: string): number { const drandBytes = decodeHex(drandSeed); // §2.1 // §5.2: with no whole byte in the input the Verify page shows no result. if (drandBytes.length === 0) throw new Error('drandSeed decodes to zero bytes'); const message = buildMessage(drandBytes); // §2.2 const digest = createHmac('sha256', keyBuffer).update(message).digest('hex'); // §2.3 return positionFromDigest(digest);}2.2Code Origin & Second Check
src/rng.ts was rebuilt from docs/ALGORITHM.md, a written specification drawn from Duel’s public pages, black-box readings of Duel’s public Verify page, the standard provably fair construction, the drand beacon and the 1,350 live rounds, without Duel’s code. Each step there names its source. Duel’s own Castle Roulette Verify-tab code, saved verbatim from duel.com on 26 September 2026 and pinned by SHA-256, is run on every captured round as a second check, not used as the source. The specification left open whether a first uint32 in the top 16 values of 2³² is reduced by plain % 48 or rejected, because no captured round reaches one. Its probe vector has first uint32 4,294,967,284: plain % 48 gives position 4, a rejection draw 41. Duel’s published code returns 4, and so does src/rng.ts.
2.3Entropy Sources
All randomness comes from HMAC-SHA256 over two cleanly separated inputs. There is no player-contributed entropy: the external input is the drand quicknet beacon, a value published by an independent threshold network.
| Source | Controlled By | Purpose |
|---|---|---|
| Server Seed | Casino | Base randomness, committed by its SHA-256 hash when the round opens |
| drand Randomness | Public drand quicknet chain | External input: a BLS threshold signature (chain 52db9ba7…4e971) |
| Nonce Suffix | System (fixed) | Always :0: each server seed is used once, so no counter is needed |
How we know: all 1,350 live rounds recompute from these two inputs alone. Any hidden input would break the recomputation; none did.
Absent from the formula: timestamps, Math.random(), other external APIs or any further input. Only HMAC-SHA256(hex_decode(serverSeed), UTF-8(beacon bytes) + ":0"). The server still chooses the seed, and which later beacon a round uses is not published (S1.5).
The beacon values themselves are checked in 2.4.
2.4drand Beacon Values (Step 16)
2.3 shows that only the server seed and the beacon go into the RNG. This asks whether the beacon values are real: a recorded 48-byte string could in principle be anything. For every round, npm run timing fetched the beacon for its drand round ID from drand.cloudflare.com and compared the signature with the captured value. Step 16 recounts the pinned results row by row and binds each row to its dataset round.
const DRAND_API_BASE = `https://drand.cloudflare.com/${DRAND_CHAIN_HASH}/public`;// …const api = await fetchDrandRound(r.result.drandRoundId);const sigMatch = api.signature === r.result.drandRandomness;What a match shows. Every captured value is the value the public quicknet chain serves for that round, not one Duel made up. A fabricated value would fail here.
Coverage. All 1,350 rounds, not a spot check. The comparison is exact string equality with the API’s signature.
Reproducibility. The results are pinned in outputs/drand-api-verification.json, which every npm test re-reads. npm run timing re-fetches every signature (network needed).
2.5Modulo Bias Analysis
The HMAC output’s first 4 bytes are taken as a uniform uint32 over [0, 2³² − 1], and position = u % 48. 2³² is not a multiple of 48: 2³² = 48 × 89,478,485 + 16, so positions 0–15 each receive one extra value. No rejection sampling is applied. The bias per position is 1.552 × 10⁻¹⁰, at or under the 2⁻³² ceiling of 2.328 × 10⁻¹⁰ that Step 5 enforces. Carried into the payout identity, it moves a tier’s expected return by at most 7.45 × 10⁻⁹.
Mapping:
uint32 value u ∈ [0, 2³² − 1]
position = u % 48 ∈ [0, 47]
Modulo bias:
2³² = 4,294,967,296 = 48 × 89,478,485 + 16
Positions 0–15 each carry 89,478,486 values of 2³²
Positions 16–47 each carry 89,478,485 values of 2³²
Fair probability: 1 / 48 = 0.0208333333…
Positions 0–15: 89,478,486 / 2³² = 0.0208333335…
Positions 16–47: 89,478,485 / 2³² = 0.0208333333…
Bias per position: 1.552 × 10⁻¹⁰
Ceiling (2⁻³²): 2.328 × 10⁻¹⁰
Expected return per tier (Step 13):
Green (1 position × 48×): 1.0000000075
Red (2 positions × 24×): 1.0000000075
Purple (3 positions × 16×): 1.0000000075
Blue (6 positions × 8×): 1.0000000075
Grey (12 positions × 4×): 1.0000000000
Dark Blue (24 positions × 2×): 0.9999999963Green, Red, Purple and Blue sit wholly inside positions 0–15 and gain 7.45 × 10⁻⁹; Grey straddles the boundary and is exact; Dark Blue sits in 16–47 and loses 3.73 × 10⁻⁹. No sample size reached in play could detect this. A rejection draw would remove it entirely; the published algorithm does not use one, so the bias is measured and disclosed instead. The full anti-circularity proof is in S4 (Step 13).
2.6RNG Isolation
Each round uses a fresh server seed and its own beacon. The HMAC is a single stateless computation: no state shared between rounds, no cursor, no buffer. The :0 suffix is a constant, not a counter. Because every seed is used once, no input pair repeats.
Evidence: computePositionFromBuffer in 2.1 is a pure function of its two arguments: no module state, no external call, no memory between rounds. The position takes no per-player input, so every player in a round shares it by design.
2.7Monte Carlo Simulation (5M Rounds)
A 5,000,000-round simulation checks the position distribution at scale, through the same HMAC-SHA256 and % 48. It runs 10 independent 500,000-round streams from seeds pinned in src/sim-seeds.ts, tests each stream’s 48 positions with chi-squared, and combines the 10 p-values with Fisher’s method. Every npm test replays all 10 streams, the full 5,000,000-position sequence, and recomputes every statistic from it.
| Metric | Value |
|---|---|
| Total rounds | 5,000,000 (10 streams × 500,000) |
| Fisher’s combined statistic | T = 15.0912 (df = 20) |
| Fisher’s combined p-value | 0.7712 |
| Streams below α = 0.01 | 0 / 10 |
| Lag-1 autocorrelation (z) | −2.384 |
| Wald-Wolfowitz runs test (p) | 0.4312 |
| Simulated RTP, $1 on the 2× tier | 100.0070% |
| Baseline RTP | 100.0000% |
| Stream | chi² | p-value |
|---|---|---|
| 0 | 58.391 | 0.1232 |
| 1 | 36.706 | 0.8601 |
| 2 | 35.526 | 0.8899 |
| 3 | 58.862 | 0.1149 |
| 4 | 35.837 | 0.8825 |
| 5 | 52.226 | 0.2781 |
| 6 | 43.546 | 0.6164 |
| 7 | 43.998 | 0.5976 |
| 8 | 42.212 | 0.6708 |
| 9 | 38.581 | 0.8042 |
| Stream | Baseline RTP | Simulated RTP (500K rounds, 2× bet) |
|---|---|---|
| 0 | 100.0000% | 99.9624% |
| 1 | 100.0000% | 99.9156% |
| 2 | 100.0000% | 100.1916% |
| 3 | 100.0000% | 100.1888% |
| 4 | 100.0000% | 99.8312% |
| 5 | 100.0000% | 99.9300% |
| 6 | 100.0000% | 100.1028% |
| 7 | 100.0000% | 99.9356% |
| 8 | 100.0000% | 100.0604% |
| 9 | 100.0000% | 99.9516% |
| All 10 streams | 100.0000% | 100.0070% |
export const PASS1_STREAMS = 10;export const PASS1_ROUNDS_EACH = 500_000;export const PASS1_ROUNDS_TOTAL = PASS1_STREAMS * PASS1_ROUNDS_EACH; // 5,000,000export const PASS2_NONCES = 1_000;// …export function pass1Position(s: number, i: number): number { const serverSeed = deterministicSeed(i, `server-stream-${s}`); const drandSeed = deterministicSeed(i, `drand-stream-${s}`) + deterministicSeed(i, `drand2-stream-${s}`).slice(0, 32); return computePositionFromBuffer(Buffer.from(serverSeed, 'hex'), drandSeed);}% 48 model.Fisher’s combined test turns K independent p-values into T = −2 Σ ln(p_i), χ² with 2K degrees of freedom under a fair RNG. A biased RNG drives p-values down across streams and T up. Here T = 15.09 on 20 degrees of freedom, p = 0.7712.
2.8Serial Independence
Serial independence means one round’s position says nothing about the next. Two tests run on the replayed 5M-round sequence:
Lag-1 autocorrelation (z): Correlation between consecutive positions; z = r × √n. |z| ≥ 3 would point to structure. Observed: z = −2.384.
Wald-Wolfowitz runs test (p): Whether positions in the upper half (24–47) and the lower half come in the expected number of runs. p < 0.01 would point to structure. Observed: p = 0.4312.
export function lag1Autocorrelation(values: number[]): number { const n = values.length; if (n < 3) return 0; const mean = values.reduce((s, v) => s + v, 0) / n; let num = 0; let den = 0; for (let i = 0; i < n; i++) { den += (values[i] - mean) ** 2; if (i < n - 1) num += (values[i] - mean) * (values[i + 1] - mean); } return den === 0 ? 0 : num / den;}|z| < 3 and runs p ≥ 0.01: z = −2.384, runs p = 0.4312. Consecutive positions show no dependence.2.9Worked Example — Full RNG Trace
A real bet from the dataset: round 540514, the last Phase C round, $1.00 on Dark Blue (2×). It runs through the same path as the $0.01 round traced in S1. Values from data/castle-roulette-master-1350rounds.json:
serverSeed = 8fc3079d13a9dd48451dda45fd164406c72e85e55ef40ed3b448bdac870d1735
drandRoundId = 28027584
drandRandomness = 973a07744778398e8be015e73d88e0ca7e4da16cb032a3c7fa463d93fc6469fb
b61c2d027c9f10566abb7292cae288b4 (96 hex characters, 48 bytes)
Step 1 — Key:
key = hex_decode(serverSeed) (32 bytes)
Step 2 — Beacon text (lossy UTF-8):
text = UTF-8 decode of hex_decode(drandRandomness) (48 bytes → 46 characters)
Step 3 — Message with the fixed :0 suffix:
message = UTF-8(text) + ":0" (48 characters)
Step 4 — HMAC-SHA256:
digest = 63b2f5e60540f441fd2a2c17fe25002c10492c28c49c948ef845a18eea010ccf
Step 5 — First 4 bytes as a big-endian uint32:
u = 0x63b2f5e6 = 1,672,672,742
Step 6 — Modulo 48:
position = 1,672,672,742 % 48 = 38
Step 7 — Tier from PAYOUT_TABLE[38]:
Position 38 ∈ [24, 47] → Dark Blue, 2×| Step | Process | Output |
|---|---|---|
| 1 | Decode serverSeed from hex | key (32 bytes) |
| 2 | Decode drandRandomness from hex, read as UTF-8 | text (46 characters) |
| 3 | Append :0 | message (48 characters) |
| 4 | HMAC-SHA256(key, message) | 63b2f5e60540f441…ea010ccf |
| 5 | First 4 bytes, big-endian | 1,672,672,742 (uint32) |
| 6 | u % 48 | 38 (wheel position) |
| 7 | PAYOUT_TABLE[38] | Dark Blue (2×) |
coin: "two"), and 38 is in Dark Blue’s range [24, 47], so it wins 1 × 2 = 2.00, the amountWon in the dataset. The $1.00 stake follows the same path as the $0.01 round in S1; only the inputs differ.Technical Evidence & Verification5 sections
2.10Evidence Coverage Summary7 checks
| Verification Area | Coverage | Result |
|---|---|---|
| Position recomputation (Step 5) | 1,350 / 1,350 live positions; draw bias at or under 2⁻³² | Pass |
| Second checks (Step 5) | ProvablyFair.org site verifier and Duel’s Verify-tab code: 1,350 / 1,350 each | Pass |
| Specification tests (unit tests) | The spec’s own vectors and properties: 119 / 119 | Pass |
| drand beacon values (Step 16) | 1,350 / 1,350 equal drand.cloudflare.com’s | Pass |
| Simulation Pass 1 (Step 14) | Fisher’s p = 0.7712, 0 / 10 streams below α = 0.01, all 10 streams replayed | Pass |
| Serial independence (Step 14) | lag-1 z = −2.384, runs p = 0.4312 | Pass |
| Live-sample fit (Step 19, informational) | Positions χ² = 36.52, df 47, p = 0.865; every tier’s win rate fits the binomial | Pass |
2.11Code References9 source files
| File | Purpose |
|---|---|
| docs/ALGORITHM.md | The written specification src/rng.ts is rebuilt from |
| src/rng.ts | HMAC-SHA256 position code, position → color table, multiplier table |
| src/bias.ts | The draw-bias bound, computed over src/rng.ts’s own draw function |
| src/site-verifier.ts, src/operator-verifier.ts | Pin and run the ProvablyFair.org site verifier and Duel’s Verify-tab code (second checks) |
| src/simulate.ts, src/sim-seeds.ts | The two-pass simulation and its pinned seeds |
| src/stats.ts | Chi-squared, lag-1 autocorrelation, runs test |
| src/verify-drand-timing.js | Beacon re-fetch from drand.cloudflare.com (npm run timing) |
| tests/steps/determinism.ts, tests/steps/simulation.ts | Steps 5–6 and 14–16 |
| tests/castle-roulette/RngSpecTests.ts | The specification’s own tests, run against src/rng.ts |
2.12Verified Invariants11 invariants
| Invariant | Result |
|---|---|
| Recomputed position equals the live position for all 1,350 rounds | Pass |
| The key is the hex-decoded seed bytes, not the hex text | Pass |
The message is the beacon bytes read as UTF-8, re-encoded, plus :0 | Pass |
The :0 suffix is a constant, not a counter | Pass |
Per-position bias of the % 48 reduction at or under 2⁻³² (1.552 × 10⁻¹⁰) | Pass |
| No inputs beyond the server seed and the beacon | Pass |
| All 1,350 beacon values equal drand.cloudflare.com’s | Pass |
| Fisher’s combined p ≥ 0.01 (observed 0.7712) on 10 × 500K streams | Pass |
| 0 / 10 streams below α = 0.01 | Pass |
| |lag-1 z| < 3 (observed −2.384) and runs p ≥ 0.01 (observed 0.4312) | Pass |
Every stream’s counts regenerate from src/sim-seeds.ts | Pass |
2.13Datasets UsedSource artifacts
2.14Reproduction InstructionsRun locally
Clone the release, install, and run the audit:
git clone https://github.com/ProvablyFair-org/duel-castle-roulette.gitcd duel-castle-roulettegit checkout v1.2.1npm cinpm test# Steps 5, 14, 15, 16 and 19 cover S2S2 steps, as printed:
[PASS] Step 5 — Position Recomputation
[PASS] Step 14 — Simulation Pass 1 (Fisher's Combined — 10 Streams)
[PASS] Step 15 — Simulation Pass 2 (Casino Seeds)
[PASS] Step 16 — drand API Signature Verification
[PASS] Step 19 — Live-Sample Fit (informational, CASTLE-22)Verifier Parity
Does the live game actually follow its own rules?
Every captured round is recomputed: all 1,350, wins and losses, from the revealed server seed and the beacon. Each position, winning tier, multiplier and payout matches the live game. The ProvablyFair.org verifier players use on this site is pinned by hash and run on every captured round, and so is Duel’s own published verify code.
What we verified
- Every round recomputed from the server seed and the beacon: the wheel position, not just the payout
- Payouts are exact: stake × multiplier on wins, 0 on losses, on all 1,350 rounds
- Win flags are right: a round counts as a win exactly when the landed tier matches the bet, 1,350 / 1,350
- The served multiplier equals the table’s at the recomputed position on every round
- The bet amount is not an input: $1.00 rounds recompute exactly like $0.01 rounds
- The ProvablyFair.org verifier and Duel’s own code return the same positions
What this means for you
- The verifier is not a simulation: it gives the exact position the live game gave
- Any round you play can be recomputed from the revealed seed and the public beacon
- No hidden logic changed a captured payout, at either stake or on any color
- The game in production follows the published algorithm on every captured round
- Every round recomputed from the server seed and the beacon: the wheel position, not just the payout
- Payouts are exact: stake × multiplier on wins, 0 on losses, on all 1,350 rounds
- Win flags are right: a round counts as a win exactly when the landed tier matches the bet, 1,350 / 1,350
- The served multiplier equals the table’s at the recomputed position on every round
- The bet amount is not an input: $1.00 rounds recompute exactly like $0.01 rounds
- The ProvablyFair.org verifier and Duel’s own code return the same positions
- The verifier is not a simulation: it gives the exact position the live game gave
- Any round you play can be recomputed from the revealed seed and the public beacon
- No hidden logic changed a captured payout, at either stake or on any color
- The game in production follows the published algorithm on every captured round
Wheel-position recomputationPass
Payout correctnessPass
Win conditionPass
Color-position mappingPass
Bet-size invariancePass
ProvablyFair.org verifier parityPass
Duel verify code (second check)Pass
Phase coveragePass
All 1,350 captured rounds recompute to the served position. Payouts and win flags are exact on every round, and every served multiplier is the table’s. The ProvablyFair.org verifier and Duel’s own verify code return the same positions.
| Check | Result | Evidence |
|---|---|---|
| Wheel-position recomputation | Pass | 1,350 / 1,350 exact, from the server seed and the beacon alone (Step 5) |
| Payout correctness | Pass | All 1,350 rounds: stake × multiplier on wins, 0 on losses, exact on the 2-decimal money grid (Step 7) |
| Win condition | Pass | 1,350 / 1,350 capture-recorded win flags agree with the landed tier (Step 7) |
| Color-position mapping | Pass | The recomputed position maps to the served winning tier, and the served multiplier equals the table exactly (Step 8) |
| Bet-size invariance | Pass | 100 / 100 Phase C ($1.00) rounds recompute exactly; the bet amount is not an RNG input (Step 6) |
| ProvablyFair.org verifier parity | Pass | The site verifier, pinned by SHA-256, returns the served position, color and multiplier on 1,350 / 1,350 (Step 5) |
| Duel verify code (second check) | Pass | Duel’s Verify-tab code, run unmodified, returns the served position on 1,350 / 1,350 (Step 5) |
| Phase coverage | Pass | Phases A 800, B 200, C 100, D 100, E 150, as declared in the package (Step 10) |
Wheel-position recomputationPass
Payout correctnessPass
Win conditionPass
Color-position mappingPass
Bet-size invariancePass
ProvablyFair.org verifier parityPass
Duel verify code (second check)Pass
Phase coveragePass
All 1,350 captured rounds recompute to the served position. Payouts and win flags are exact on every round, and every served multiplier is the table’s. The ProvablyFair.org verifier and Duel’s own verify code return the same positions.
How It Works — Verifier Parity8 sections
3.1Why Parity Matters
If a verifier gave a different result from the live game, players could not rely on it: a single discrepancy would mean a bug in the verifier, a change in the live game, or an RNG that is not what it claims. Parity means a player can take the revealed server seed and the beacon value, run them through an independent verifier, and get the exact wheel position and payout the live round gave.
3.2Five-Phase Collection Design
The capture ran in five phases, each for a specific property: baseline coverage, every tier, bet size, and payout coverage on two rare tiers, Purple (16×) and Green (48×).
| Phase | Rounds | Color Bet | Stake | Purpose |
|---|---|---|---|---|
| A — Baseline | 800 | Dark Blue (2×) | $0.01 | Statistical coverage on the most common tier |
| B — Multi-tier | 200 | All 6 colors (rotating) | $0.01 | Every tier’s payout: 34 on Dark Blue (2×), 34 on Grey (4×), 33 each on Blue (8×), Purple (16×), Red (24×) and Green (48×) |
| C — Bet size | 100 | Dark Blue (2×) | $1.00 | The position does not depend on the stake (100× Phase A’s) |
| D — Rare tier | 100 | Purple (16×) | $0.01 | Coverage of the 3-position tier |
| E — Rare tier | 150 | Green (48×) | $0.01 | Coverage of the 1-position tier (P(win) ≈ 2.08%) |
3.3Wheel-Position Recomputation (Step 5)
For every round, Step 5 recomputes the position with computePosition(serverSeed, drandRandomness) and compares it with the served position. The count is bound to the population the package declares, so a shortened dataset fails too.
for (const r of rounds) { const computed = computePosition(r.result.serverSeed, r.result.drandRandomness); if (computed === r.result.position) { match++; } else { mismatch++; if (mismatches.length < 5) { mismatches.push(`round ${r.roundId}: expected pos=${r.result.position}, got ${computed}`); } }}3.4Player Verifiers & Duel’s Code
Step 5 runs two more implementations on every captured round. The ProvablyFair.org verifier on this site (derive.js with its HMAC library) is vendored in the package and pinned by SHA-256; Step 5 fails unless the copies hash to their pins, then executes it. Duel’s own Verify-tab code is run unmodified with only its two input values filled in.
| Implementation | Source | Rounds matched |
|---|---|---|
| src/rng.ts | Rebuilt from docs/ALGORITHM.md | 1,350 / 1,350 |
| ProvablyFair.org site verifier | derive.js 44f821b5…, hmac-sha256.js bc30bfe9… (pinned) | 1,350 / 1,350 |
| Duel’s Verify-tab code | Saved from duel.com on 26 September 2026, c83dca21… (pinned) | 1,350 / 1,350 |
for (const r of rounds) { const site = sv.deriveCastle({ serverSeed: r.result.serverSeed, drandRandomness: r.result.drandRandomness }); const pkg = computePosition(r.result.serverSeed, r.result.drandRandomness); siteCompared++; const ok = site.position === pkg && site.multiplier === getResult(pkg).multiplier && site.color === getResult(pkg).color && site.multiplier === coinToMult[r.result.winningCoin]; // …}3.5Payout Math & Win Condition (Step 7)
A bet wins when the landed position’s tier is the color bet; a win credits stake × multiplier, a loss 0. Step 7 checks every settlement on the 2-decimal money grid in whole units, so a credit off by a fraction of a cent fails. The win flag in the dataset is written by the capture script, so it is checked for consistency with the landed tier.
| Observation | Value |
|---|---|
| Rounds checked | 1,350 |
| Win flags agreeing with the landed tier | 1,350 |
| Overall win rate (informational) | 473 / 1,350 (35.04%) |
| Phase A win rate (Dark Blue 2×, P(win) = 50.00%) | 394 / 800 (49.25%) |
| Phase C win rate (Dark Blue 2×, P(win) = 50.00%) | 41 / 100 (41.00%) |
| Phase D win rate (Purple 16×, P(win) = 6.25%) | 5 / 100 (5.00%) |
| Phase E win rate (Green 48×, P(win) = 2.08%) | 4 / 150 (2.67%) |
for (const r of rounds) { // … if (r.result.isWin) { // Win: amountWon should = bet × multiplier, the full baseline payout. Step 9 holds // the same credit to the table multiplier exactly at 18 dp on every recomputed win. // Compared on the money grid: the credit must be a legal 2-dp amount AND the same // number of grid units as the expected payout. const expected = amount * multiplier; if (onGridM(won) && unitsM(won) === unitsM(expected)) { correct++; } else if (!onGridM(won)) { // … } else { wrong++; // … } } else { // Loss: amountWon = 0 — held to the same grid, so a 1e-9 credit on a loss is not // "zero" either. if (onGridM(won) && unitsM(won) === 0) { correct++; } else { wrong++; // … } }} // isWin is capture-recorded (the capture script compares winningCoin with the coin bet); consistency onlylet isWinCorrect = 0;for (const r of rounds) { const posResult = getResult(r.result.position); // … // Map coin keys to color names const coinToColor: Record<string, string> = { two: 'dark_blue', four: 'grey', eight: 'blue', sixteen: 'purple', twenty_four: 'red', forty_eight: 'green', }; const betColor = coinToColor[r.request.coin]; const actuallyWins = posResult.color === betColor; if (r.result.isWin === actuallyWins) isWinCorrect++;}3.6Color-Position Mapping (Step 8)
Step 8 takes the position from the recomputation, not from the served record, and requires on every round: the served position to equal it, the served winning tier to be the table’s tier there, and the served 18-decimal multiplier to equal the table’s multiplier exactly, parsed as an exact decimal.
const exactDecimalEquals = (s: string, m: number): boolean => { const mm = /^(\d+)(?:\.(\d+))?$/.exec(String(s)); if (!mm) return false; const frac = mm[2] ?? ''; return BigInt(mm[1] + frac) === BigInt(m) * 10n ** BigInt(frac.length);}; for (const r of rounds) { const pos = computePosition(r.result.serverSeed, r.result.drandRandomness); const expected = getResult(pos); const ok = pos === r.result.position && coinToMult[r.result.winningCoin] === expected.multiplier && exactDecimalEquals(r.result.multiplier, expected.multiplier); if (ok) match++; // …}3.7Phase C — Bet-Size Invariance (Step 6)
The bet amount is not part of the HMAC key or message. Phase C placed 100 bets at $1.00, 100× the Phase A stake, and Step 6 recomputes each from the server seed and the beacon alone. If the stake moved the wheel, a recomputation with no stake input would miss.
for (const r of phaseC) { const computed = computePosition(r.result.serverSeed, r.result.drandRandomness); if (computed === r.result.position) match++; else mismatch++;}3.8Worked Example — Full Parity Verification
A real bet from Phase E: round 541180, $0.01 on Green (48×), the rarest tier. It shows exact parity at the far end of the payout table. Values from data/castle-roulette-master-1350rounds.json:
roundId = 541180
serverSeed = 651a40d387346919ee59de3ac9858c3a8b20aa1d5dc78ecfd54d5a869bd5cfb5
serverSeedHash = 8930e42cbf5db531bf28177327324bea49f6711e8c19d7b0bcb61040a1d651a6
drandRoundId = 28034244
drandRandomness = 91f15725497c704c9f61ed8a7f5937067c7928022ba670f0b8fa5f7c23a15836
49fd470a748e1413864038285f4c1332 (96 hex characters, 48 bytes)
stake = $0.01
bet = forty_eight (Green, 48×)| Step | Process | Output |
|---|---|---|
| 1 | computePosition(serverSeed, drandRandomness) | 0 (wheel position) |
| 2 | PAYOUT_TABLE[0] | { multiplier: 48, color: "green" } |
| 3 | Landed tier against the bet | green === green → win |
| 4 | stake × multiplier | 0.01 × 48 = 0.48 (amount won) |
| 5 | Compare with the live round | All four match |
// Step 1: position from (serverSeed, drandRandomness)//// HMAC-SHA256 digest: 07129a702e6f6237d190061776e058804613bf2be5c5bad2647bb221c8dec392// First 4 bytes: 07129a70// uint32 value: 118,659,696// position = 118,659,696 % 48// = 0 ✅ (matches dataset) // Step 2: tier from PAYOUT_TABLE[0]// Position 0 → Green, 48× // Step 3: win condition// bet = forty_eight → Green// Green === Green → win ✅ // Step 4: payout// amount_won = 0.01 × 48// = 0.48 ✅ (matches dataset)0.01 × 48 = 0.48. The same code path produced the 2× rounds in S1 and S2; only the inputs differ.Technical Evidence & Verification5 sections
3.9Evidence Coverage Summary7 checks
| Verification Area | Coverage | Result |
|---|---|---|
| Wheel-position recomputation (Step 5) | 1,350 / 1,350 rounds, from the server seed and the beacon | Pass |
| Player verifier and Duel’s code (Step 5) | 1,350 / 1,350 each | Pass |
| Payout math and win flags (Step 7) | 1,350 / 1,350 on the 2-decimal money grid | Pass |
| Color-position mapping (Step 8) | 1,350 / 1,350, exact multipliers | Pass |
| Phase C bet-size invariance (Step 6) | 100 / 100 $1.00 rounds | Pass |
| Phase coverage (Step 10) | A 800 + B 200 + C 100 + D 100 + E 150 = 1,350 | Pass |
| Configuration coverage (Step 17) | All 6 tiers above 30 rounds; 48 / 48 positions landed | Pass |
3.10Code References6 source files
| File | Purpose |
|---|---|
| tests/steps/determinism.ts | Steps 5–6: position recomputation with both second checks, Phase C bet-size invariance |
| tests/steps/payouts.ts | Steps 7–10: payout math and win flags, color-position mapping, settlement edge, phase coverage |
| tests/steps/coverage.ts | Step 17: tier and position coverage |
| src/rng.ts | computePosition, getResult, the 6-tier PAYOUT_TABLE |
| verifier-parity/ | Pinned copies of the ProvablyFair.org site verifier and the runner for Duel’s code |
| src/loader.ts | Dataset loading and the declared population |
3.11Datasets UsedSource artifacts
3.12Verified Invariants10 invariants
| Invariant | Result |
|---|---|
Recomputed wheel position equals the live position for all 1,350 rounds | Pass |
| Win flag equals (landed tier = bet tier) for all 1,350 rounds | Pass |
amount_won = stake × multiplier on every winning round, in whole cents | Pass |
amount_won = 0 on every losing round | Pass |
| Served multiplier equals the table’s at the recomputed position, exactly | Pass |
| Phase C ($1.00) recomputes through the same code path as $0.01 rounds | Pass |
| No inputs beyond the server seed and the beacon: the bet amount is not an RNG input | Pass |
| All 5 capture phases present (A: 800, B: 200, C: 100, D: 100, E: 150) | Pass |
| All 6 color tiers bet, each above the 30-round floor | Pass |
| All 48 positions landed on in live play | Pass |
3.13Reproduction InstructionsRun locally
git clone https://github.com/ProvablyFair-org/duel-castle-roulette.gitcd duel-castle-roulettegit checkout v1.2.1npm cinpm test# Steps 5–8, 10 and 17 cover S3S3 steps, as printed:
[PASS] Step 5 — Position Recomputation
[PASS] Step 6 — Bet-Size Invariance
[PASS] Step 7 — Payout Math
[PASS] Step 8 — Color-Position Mapping
[PASS] Step 10 — Phase Coverage
[PASS] Step 17 — Configuration Coverage (coin tiers and wheel positions)RTP & Payout Logic
Is the return what the casino claims?
Theoretical RTP is 100.0% at the base stake tier. We derive it from first principles: every color tier has count × multiplier = 48, so the wheel and paytable return 100% on each tier, with no casino-supplied probability; the % 48 draw moves that by at most 7.45 × 10⁻⁹. Every captured win was credited the full multiplier, a settlement edge of 0 inside Duel’s Zero Edge allowance. The RTP claim rule records Duel’s Zero Edge line as noted, not tested. Above the allowance, Duel’s settings and client code give a 0.1%–5% edge, explained here from the config. A 5M-round simulation is consistent with the proof, and the casino-seed screen finds no sign that seeds were selected by outcome.
What we verified
- Theoretical RTP is 100% on all 6 color tiers: count × multiplier = 48, from first principles; the draw bias moves it by at most 7.45 × 10⁻⁹
- Every captured win was credited stake × the table multiplier: a settlement edge of 0 at $0.01 and $1.00 (473 / 473)
- RTP claim rule: NOTED. Duel’s Zero Edge line is recorded, not tested; the six tiers’ true range is 100.000000–100.000001%
- 5M simulated rounds: 100.007% on the 2× tier, consistent with 100%
- The casino-seed screen on all 1,350 revealed seeds finds no sign of seeds selected by outcome
- Bet size does not move the wheel: $1.00 and $0.01 rounds recompute alike
What this means for you
- Inside Duel’s Zero Edge allowance, the wheel returns 100% of wagering in expectation
- Duel states the allowance covers up to $1,000 of a bet, within $50,000 of wagering per 24 hours
- Beyond it, Duel’s settings and client code give an edge between 0.1% and 5%; that range was not tested
- The RTP proof does not rely on trusting the casino
- Your bet size does not move the wheel
- Theoretical RTP is 100% on all 6 color tiers: count × multiplier = 48, from first principles; the draw bias moves it by at most 7.45 × 10⁻⁹
- Every captured win was credited stake × the table multiplier: a settlement edge of 0 at $0.01 and $1.00 (473 / 473)
- RTP claim rule: NOTED. Duel’s Zero Edge line is recorded, not tested; the six tiers’ true range is 100.000000–100.000001%
- 5M simulated rounds: 100.007% on the 2× tier, consistent with 100%
- The casino-seed screen on all 1,350 revealed seeds finds no sign of seeds selected by outcome
- Bet size does not move the wheel: $1.00 and $0.01 rounds recompute alike
- Inside Duel’s Zero Edge allowance, the wheel returns 100% of wagering in expectation
- Duel states the allowance covers up to $1,000 of a bet, within $50,000 of wagering per 24 hours
- Beyond it, Duel’s settings and client code give an edge between 0.1% and 5%; that range was not tested
- The RTP proof does not rely on trusting the casino
- Your bet size does not move the wheel
Anti-circularityPass
RTP claim (RTP-CLAIM 1.2.0)Info
Settlement edge at the captured stakesPass
Settlement edge above the allowanceInfo
Multipliers and payoutsPass
Simulated RTP (Pass 1)Pass
Casino-seed screen (Pass 2)Pass
Bet-size invariancePass
The theoretical RTP is 100% on every color tier, derived from first principles and within 7.45 × 10⁻⁹ with the draw counted exactly. Every captured win was credited the full multiplier, a settlement edge of 0 inside Duel’s Zero Edge allowance. The simulation is consistent with it, and the casino-seed screen finds no sign of seeds selected by outcome.
With the % 48 draw counted exactly, every tier is within 7.45 × 10⁻⁹ of 1. Above Duel’s Zero Edge allowance, Duel’s settings and client code give a 0.1%–5% settlement edge, outside this proof.
| Check | Result | Evidence |
|---|---|---|
| Anti-circularity | Pass | Tier probabilities counted from the uint32 % 48 mapping: P × multiplier = 1 within 1.12 × 10⁻⁸ on all 6 tiers; a corrupted table (multiplier + 1) is rejected on every tier |
| RTP claim (RTP-CLAIM 1.2.0) | Info | Claim kind noted: Duel’s Zero Edge line is recorded, not tested. The 6 tiers are tabled at their exact RTP, 100.000000–100.000001%; the outcome is NOTED and moves no step |
| Settlement edge at the captured stakes | Pass | 473 / 473 wins credited stake × table multiplier exactly at 18 decimals (Step 9): 432 at $0.01, 41 at $1.00 |
| Settlement edge above the allowance | Info | From Duel’s settings and client code: the stake above the allowance × (multiplier − 1) / bankroll, between a 0.1% floor and a 5% ceiling. Explained from the config, not tested (4.7) |
| Multipliers and payouts | Pass | Every served multiplier equals the table’s at the recomputed position, and every payout is stake × multiplier (Steps 7, 8) |
| Simulated RTP (Pass 1) | Pass | 5M rounds: 100.007% on the 2× tier; every tier within one standard error of 100%; Fisher’s p = 0.7712 |
| Casino-seed screen (Pass 2) | Pass | 1,350 revealed seeds × 1,000 beacon values: 15 χ² failures against a threshold of 25 |
| Bet-size invariance | Pass | 100 / 100 Phase C ($1.00) rounds recompute; credits exact at both stakes |
Anti-circularityPass
RTP claim (RTP-CLAIM 1.2.0)Info
Settlement edge at the captured stakesPass
Settlement edge above the allowanceInfo
Multipliers and payoutsPass
Simulated RTP (Pass 1)Pass
Casino-seed screen (Pass 2)Pass
Bet-size invariancePass
The theoretical RTP is 100% on every color tier, derived from first principles and within 7.45 × 10⁻⁹ with the draw counted exactly. Every captured win was credited the full multiplier, a settlement edge of 0 inside Duel’s Zero Edge allowance. The simulation is consistent with it, and the casino-seed screen finds no sign of seeds selected by outcome.
How It Works — RTP & Payout Logic10 sections
4.1Anti-Circularity Proof (Step 13)
The anti-circularity proof derives the RTP from first principles, without any casino-supplied probability and without measured outcomes. For Castle Roulette it is short: every color tier satisfies count(tier) × multiplier(tier) = 48, so P(color) × multiplier = 1 and the expected return of every bet is 1 by construction. Step 13 counts each position’s probability from the % 48 mapping itself: positions 0–15 carry 89,478,486 of the 2³² draw values, positions 16–47 carry 89,478,485.
| Component | Formula | Source |
|---|---|---|
| Position probability | P(p) = 89,478,486 / 2³² for p < 16, else 89,478,485 / 2³² | Counted from the u % 48 mapping: pure arithmetic, no casino data |
| Tier probability | P(tier) = Σ P(p) over the tier’s positions | The 6-tier table in src/rng.ts, rebuilt from the written specification |
| Payout on a win | stake × multiplier(tier) | Verified on every captured round (Steps 7–9) |
| RTP | P(tier) × multiplier(tier) | Independent probability × verified payout |
| Result | = 1 within 1.12 × 10⁻⁸ on all 6 tiers | A first-principles proof, not a statistical estimate |
| Color Tier | Positions | Multiplier | count × multiplier | P(color) | Exact RTP |
|---|---|---|---|---|---|
| Green | 0 | 48× | 1 × 48 = 48 | 2.0833% | 100.000001% |
| Red | 1–2 | 24× | 2 × 24 = 48 | 4.1667% | 100.000001% |
| Purple | 3–5 | 16× | 3 × 16 = 48 | 6.2500% | 100.000001% |
| Blue | 6–11 | 8× | 6 × 8 = 48 | 12.5000% | 100.000001% |
| Grey | 12–23 | 4× | 12 × 4 = 48 | 25.0000% | 100.000000% |
| Dark Blue | 24–47 | 2× | 24 × 2 = 48 | 50.0000% | 100.000000% |
count × multiplier = 48 identity. With the % 48 draw counted exactly, the largest departure from 1 is Green’s +7.45 × 10⁻⁹, inside the 1.12 × 10⁻⁸ bound; the 48 probabilities sum to 1; a table with any multiplier raised by one is rejected on every tier. The proof is non-circular.Anti-Circularity Verification:
const total = 2 ** 32;const base = Math.floor(total / RANGE); // 89478485const remainder = total % RANGE; // 16 const tiers = [ { name: 'Green (48×)', positions: 1, mult: 48, start: 0 }, { name: 'Red (24×)', positions: 2, mult: 24, start: 1 }, { name: 'Purple (16×)', positions: 3, mult: 16, start: 3 }, { name: 'Blue (8×)', positions: 6, mult: 8, start: 6 }, { name: 'Grey (4×)', positions: 12, mult: 4, start: 12 }, { name: 'Dark Blue (2×)', positions: 24, mult: 2, start: 24 },]; // …const EV_BOUND = RANGE / 2 ** 32; // the uint32 claim, stated independently of `total`// …for (const tier of tiers) { // Compute exact probability for this tier's positions let tierProb = 0; for (let p = tier.start; p < tier.start + tier.positions; p++) { tierProb += (p < remainder ? base + 1 : base) / total; } const ev = tierProb * tier.mult; probByTier[tier.name] = tierProb; evByTier[tier.name] = ev; const dev = Math.abs(ev - 1.0); if (dev > maxEvDeviation) maxEvDeviation = dev; // EV should be very close to 1.000 — the baseline the paytable enforces if (dev > EV_BOUND) failures.push(`${tier.name}: P × multiplier departs from 1.0 beyond the ${EV_BOUND.toExponential(4)} bound (deviation ${dev.toExponential(4)})`);}// …let negativeControlAccepted = 0;for (const tier of tiers) { let tierProb = 0; for (let p = tier.start; p < tier.start + tier.positions; p++) tierProb += (p < remainder ? base + 1 : base) / total; if (Math.abs(tierProb * (tier.mult + 1) - 1.0) <= EV_BOUND) negativeControlAccepted++;}if (negativeControlAccepted > 0) failures.push(`negative control: a corrupted table (multiplier + 1) was accepted on ${negativeControlAccepted} tier(s)`);Why this proof is non-circular: the probabilities come from counting draw values per position, a property of the u % 48 mapping, not from casino data or observed outcomes. The multipliers come from the 6-tier table, and that table is checked against what Duel served on every captured round: the served multiplier equals the table’s at the recomputed position (Step 8), and every win is credited stake × that multiplier (Steps 7, 9).
4.2RTP Claim Rule (RTP-CLAIM 1.2.0)
The claim and where it is published. The only return figure Duel publishes for Castle Roulette is the “Zero Edge” label on the game screen. Its ceilings, up to $1,000 of a bet within $50,000 of wagering per 24 hours, come from Duel’s own statement and are not in the game settings. Under the rule, a zero-edge line is noted, not tested: the six tiers are still tabled at their exact RTP, but none is held to a figure.
How it is scored. A noted claim is recorded with outcome NOTED and status Info, so it moves no step and no verdict, and a house-side miss (RTP FIGURE OVERSTATED, exit 5) cannot arise. What Duel’s game settings do state is the edge beyond the allowance, a 0.1% floor and a 5% ceiling, set out in 4.7. No captured stake reached it.
| Color Tier | Exact RTP (rational) | RTP | Outcome |
|---|---|---|---|
| Green (48×) | 134,217,729 / 134,217,728 | 100.000001% | Noted |
| Red (24×) | 134,217,729 / 134,217,728 | 100.000001% | Noted |
| Purple (16×) | 134,217,729 / 134,217,728 | 100.000001% | Noted |
| Blue (8×) | 134,217,729 / 134,217,728 | 100.000001% | Noted |
| Grey (4×) | 1 / 1 | 100.000000% | Noted |
| Dark Blue (2×) | 268,435,455 / 268,435,456 | 100.000000% | Noted |
export const RTP_CLAIM_RULE_ENFORCED: boolean = true; export function computeRtpClaim(): RtpClaimResult { const domain = 1n << BigInt(4 * DRAW_HEX_CHARS); // 2^32 const R = BigInt(RANGE); const base = domain / R, extra = domain % R; const tiers = new Map<string, { mult: number; count: bigint }>(); PAYOUT_TABLE.forEach((cell, p) => { const t = tiers.get(cell.color) ?? { mult: cell.multiplier, count: 0n }; if (t.mult !== cell.multiplier) throw new Error(`tier ${cell.color} carries two multipliers`); t.count += base + (BigInt(p) < extra ? 1n : 0n); tiers.set(cell.color, t); }); if (PAYOUT_TABLE.length !== RANGE) throw new Error('payout table does not cover the wheel'); const acc = new RtpClaimAccumulator(RTP_CLAIM); for (const [color, t] of tiers) acc.add(`tier=${color} (${t.mult}x)`, t.count * BigInt(t.mult), domain); return acc.result();}outputs/rtp-claim-table.json, pinned by SHA-256.4.3Settlement Edge at the Captured Stakes (Step 9)
By Duel’s disclosure, its edge is applied at settlement, by reducing the multiplier, not inside the wheel draw. Step 9 derives the settlement edge from served data. A round is a win when the recomputed tier is the coin bet, and on each of the 473 winning rounds the credit Duel’s transactions API served must equal the served stake × the table multiplier exactly, at 18 decimals. A multiplier reduced by any amount at settlement fails here. The dataset’s effectiveEdge field is written by the capture script, so it is not scored.
for (const r of rounds) { const tier = getResult(computePosition(r.result.serverSeed, r.result.drandRandomness)); if (COIN_TO_COLOR[r.request.coin] !== tier.color) continue; wins++; const stakeKey = String(r.result.amountCurrency).replace(/^-/, ''); winsByServedStake[stakeKey] = (winsByServedStake[stakeKey] ?? 0) + 1; const stake = units18(r.result.amountCurrency); const won = units18(r.result.amountWon); if (stake !== null && won !== null && stake < 0n && won === -stake * BigInt(tier.multiplier)) exact++; else if (offList.length < MAX_LISTED) offList.push(`round ${r.roundId}: credited ${r.result.amountWon} on stake ${r.result.amountCurrency} at ${tier.multiplier}x`);}4.4Full RTP Table — All 6 Color Tiers
Castle Roulette’s RTP is one closed-form value per tier. The table shows each tier’s theoretical RTP beside its RTP on the 5M simulated rounds of Pass 1, computed from the per-position counts the simulation artifact ships.
| Color Tier | Multiplier | P(win) | Theoretical RTP | Simulated RTP (5M rounds) | Deviation |
|---|---|---|---|---|---|
| Green | 48× | 2.0833% | 100.0000% | 99.9283% | −0.0717% |
| Red | 24× | 4.1667% | 100.0000% | 100.1050% | +0.1050% |
| Purple | 16× | 6.2500% | 100.0000% | 100.0048% | +0.0048% |
| Blue | 8× | 12.5000% | 100.0000% | 99.9555% | −0.0445% |
| Grey | 4× | 25.0000% | 100.0000% | 99.9955% | −0.0045% |
| Dark Blue | 2× | 50.0000% | 100.0000% | 100.0070% | +0.0070% |
4.5Simulation Pass 1 — Fresh Seeds (Step 14)
4.1 proves the RTP. Pass 1 checks that the implementation produces it at scale: 5,000,000 rounds through the same HMAC-SHA256 and % 48, in 10 independent 500,000-round streams on seeds pinned in src/sim-seeds.ts. Every npm test replays all 10 streams and recomputes every statistic from the replayed sequence.
Chi-squared test (per stream): Observed counts on the 48 positions against the counts a fair wheel gives. 0 / 10 streams below α = 0.01.
Fisher’s combined test: Combines the 10 stream p-values into T = −2 × Σ ln(p_i), χ² with 20 degrees of freedom under a fair RNG. Observed T = 15.0912, p = 0.7712.
Serial independence: Lag-1 autocorrelation and the runs test on the replayed 5M-round sequence: lag1Z = −2.384 (rule |z| < 3), runsP = 0.4312 (rule ≥ 0.01).
RTP on the 2× tier: 100.0070% over 5M rounds, against the 100.0000% baseline.
for (let s = 0; s < PASS1_STREAMS; s++) { const counts = new Array(RANGE).fill(0); for (let i = 0; i < PASS1_ROUNDS_EACH; i++) { const pos = pass1Position(s, i); counts[pos]++; allPositions[k++] = pos; if (pos >= RANGE / 2) cumReturned += 2; if (PASS1_CONVERGENCE_POINTS.includes(k)) convergence.push({ rounds: k, rtp: cumReturned / k }); } streamsReplayed++; const art = rows[s]?.observed; const bad = Array.isArray(art) ? counts.findIndex((v, i) => v !== art[i]) : 0; if (bad === -1) streamsMatching++; // …} const lag1R = lag1Autocorrelation(allPositions);const lag1ZRecomputed = lag1R * Math.sqrt(PASS1_ROUNDS_TOTAL);const lag1PRecomputed = 2 * normalCDF(-Math.abs(lag1ZRecomputed));const runs = runsTest(allPositions.map(p => p >= RANGE / 2));// …const serialFailsRecomputed = Math.abs(lag1ZRecomputed) < 3 && runs.pValue >= 0.01 ? 0 : 1;% 48 model.4.6Casino-Seed Screen — Pass 2 (Step 15)
Could Duel have chosen server seeds that favour the house? Pass 2 takes each of the 1,350 seeds Duel actually used, pairs it with 1,000 beacon values from src/sim-seeds.ts, and runs a chi-squared test on that seed’s 48 positions. A seed chosen to bias the wheel would show up as an excess of failures. Every npm test replays it in full.
Threshold: At α = 0.01, 1,350 fair seeds give 13.5 failures on average. The pre-registered threshold, 13.5 plus three binomial standard deviations rounded up, is 25. Observed: 15.
Mean casino-seed RTP: 99.9985% over 1,350,000 simulated rounds on the 2× tier, against the 100.0000% baseline.
| Test | Result |
|---|---|
| Casino seeds tested | 1,350 (one per round) |
| Beacon values per seed | 1,000 |
| Rounds simulated | 1,350,000 |
| Chi-squared failures at α = 0.01 | 15 / 1,350 |
| Expected under a fair RNG | 13.5 |
| Failure threshold (3σ) | 25 |
| Mean RTP on the 2× tier | 99.9985% |
for (let s = 0; s < casinoSeeds.length; s++) { const keyBuf = Buffer.from(casinoSeeds[s], 'hex'); const obs = new Array(RANGE).fill(0); for (let n = 0; n < PASS2_NONCES; n++) { const pos = computePositionFromBuffer(keyBuf, pass2Drand(s, n)); obs[pos]++; wagered += 1; if (pos >= RANGE / 2) returned += 2; } if (chiSquaredTest(obs, expected).pValue < ALPHA) chi2Fails++;}// …const expectedFails = casinoSeeds.length * ALPHA;const threshold = Math.ceil(expectedFails + 3 * Math.sqrt(expectedFails * (1 - ALPHA)));if (casinoSeeds.length === 0) issues.push('zero casino seeds replayed');if (chi2Fails > threshold) issues.push(`${chi2Fails} replayed chi-squared failures exceed the H₀ threshold ${threshold}`);4.7Stake Tiers — Settlement Edge Above the Allowance (From the Config)
0% is the edge inside Duel’s Zero Edge allowance, not a fixed rate. Duel states the allowance covers up to $1,000 of each bet, within $50,000 of wagering per 24 hours. Duel’s client code takes the allowance off the stake first and applies the edge to what is left: excess × (multiplier − 1) / bankroll × 100, held between a 0.1% floor and a 5% ceiling, with a bankroll of 50,000,000 in Duel’s game settings. A bet the remaining allowance covers has an edge of 0, and so does every captured bet.
This is explained from the config, not certified. Duel’s game settings and client code were read on 5 October 2026, not on the capture days, and the client code is not pinned. The $1,000 and $50,000 allowance figures come from Duel’s own statement. No captured stake left the allowance, so what the server credits above it was not observed.
| Tile | Edge on the $24,000 above the allowance | Effective edge at a $25,000 stake |
|---|---|---|
| 2× | 0.048% | 0.1% (the floor binds) |
| 4× | 0.144% | 0.144% |
| 8× | 0.336% | 0.336% |
| 16× | 0.72% | 0.72% |
| 24× | 1.104% | 1.104% |
| 48× | 2.256% | 2.256% |
/api/v2/metadata/roulette) on 5 October 2026. On the five tiles that show a figure, the formula reproduces the edge Duel’s game screen displayed at a $25,000 stake; the 2× tile showed none. Once the daily allowance is used up, the client code computes the edge on the full stake, and as written returns 0 below the floor while Zero Edge is on. Consistent with the formula, not a verified payout.4.8Bet-Size Invariance (Step 6)
The bet amount is not part of the HMAC key or the message, and nothing in the position derivation reads it. Step 6 recomputes all 100 Phase C rounds, placed at $1.00, 100× the $0.01 stake of the other phases, from the server seed and the beacon alone. If the stake moved the wheel, a recomputation with no stake input would miss.
| Property | Result |
|---|---|
| Bet amount in the HMAC key | No: the key is the server seed bytes only |
| Bet amount in the HMAC message | No: the message is the beacon text + :0 only |
| Phase C at $1.00 | 100 / 100 positions recompute; 41 wins credited 2× exactly (Step 9) |
| Phases A, B, D and E at $0.01 | 1,250 / 1,250 positions recompute |
| Code path | computePosition(serverSeed, drandRandomness), the same at every stake |
4.9Informational Items (Not Scored)
Observed returns during the capture, for context only. At these sample sizes they show variance; the proof in 4.1 is the RTP evidence.
| Item | Value | Context |
|---|---|---|
| Phase A observed RTP | 98.50% | 800 bets at $0.01 on Dark Blue (2×); 394 wins |
| Phase B observed RTP | 82.00% | 200 bets at $0.01 across all 6 colors; 29 wins, $1.64 returned on $2.00 |
| Phase C observed RTP | 82.00% | 100 bets at $1.00 on Dark Blue (2×); 41 wins against 50 expected (p = 0.089) |
| Phase D observed RTP | 80.00% | 100 bets at $0.01 on Purple (16×); 5 wins against 6.25 expected |
| Phase E observed RTP | 128.00% | 150 bets at $0.01 on Green (48×); 4 wins against 3.13 expected |
| Total | 83.77% | 1,350 bets, $112.50 wagered; the $1.00 phase dominates (97.92% without it) |
| Position fit, 48 positions | χ² = 36.52, df 47, p = 0.865 | Step 19, informational |
| Win-rate fit, 6 tiers | 6 / 6 above the Bonferroni bound | Smallest p = 0.252 (Dark Blue 2×); Step 19 |
| Color bet | Rounds | Wins | Win rate | Expected | Observed RTP |
|---|---|---|---|---|---|
| Dark Blue (2×) | 934 | 449 | 48.1% | 50.0% | 83.2% |
| Grey (4×) | 34 | 8 | 23.5% | 25.0% | 94.1% |
| Blue (8×) | 33 | 4 | 12.1% | 12.5% | 97.0% |
| Purple (16×) | 133 | 5 | 3.8% | 6.3% | 60.2% |
| Red (24×) | 33 | 3 | 9.1% | 4.2% | 218.2% |
| Green (48×) | 183 | 4 | 2.2% | 2.1% | 104.9% |
4.10Worked Example — Payout Verification
A real bet from Phase B: round 540018, $0.01 on Red (24×), a mid-rarity tier. Values from data/castle-roulette-master-1350rounds.json, with the tier’s RTP from the count × multiplier = 48 identity:
roundId = 540018
serverSeed = e5e5f053134592b0529de6a4ec078399c4213f65d0f0b6202e81b15f9a138f33
serverSeedHash = 24cbb91a05d2c46c1bc052a547d6f6bf59b455e6a8cd38a4bbbbb38cd616b619
drandRoundId = 28022624
drandRandomness = 923e2633196c6cdcebd6422e6652e274c17980325f46bdaad68502c40867d7d4
feb8b10e7b42c231e7185cc00974a90c (96 hex characters, 48 bytes)
stake = $0.01
bet = twenty_four (Red, 24×)
amountWon = 0.240000000000000000 (served)Step 1 — Wheel position: computePosition("e5e5f053…", "923e2633…") → HMAC-SHA256 bf6d2df10030cc3c…22949eb9 → first 4 bytes = uint32 3,211,603,441 → 3,211,603,441 % 48 = 1
Step 2 — Tier: PAYOUT_TABLE[1] → { multiplier: 24, color: "red" } (positions 1–2 are Red)
Step 3 — Win condition: Bet twenty_four → Red; landed Red → win
Step 4 — Payout: 0.01 × 24 = 0.24 ✓ (equals the served credit)
Step 5 — Red tier RTP: P(Red) = 2 / 48 = 4.1667%; P × 24 = 1 (100%) ✓
| Step | Process | Output |
|---|---|---|
| 1 | computePosition(serverSeed, drandRandomness) | 1 (wheel position) |
| 2 | PAYOUT_TABLE[1] | { multiplier: 24, color: "red" } |
| 3 | Landed tier against the bet | red === red → win |
| 4 | stake × multiplier | 0.01 × 24 = 0.24 (amount won) |
| 5 | P(Red) × 24 | 4.1667% × 24 = 100% |
// Tier = Red (24×): RTP from first principles//// count(Red) = 2 (positions 1, 2)// P(Red) = 2 / 48 = 0.041666666666666664// P × 24 = 1.0000000000000000 = 100% ✅//// With the % 48 draw counted exactly (positions 0–15 carry one extra value out of 2³²):// P(position 1) = 89,478,486 / 2³² = 0.020833333488553762// P(position 2) = 89,478,486 / 2³² = 0.020833333488553762// P(Red) = 0.041666666977107525// P × 24 = 1.0000000074505806 (+7.45 × 10⁻⁹)//// The same identity holds on every tier:// count(tier) × multiplier(tier) = 48 → P(tier) × multiplier(tier) = 1Technical Evidence & Verification5 sections
4.11Evidence Coverage Summary7 checks
| Verification Area | Coverage | Result |
|---|---|---|
| Anti-circularity (Step 13) | 6 color tiers from the counted % 48 mapping; negative control rejected on all 6 | Pass |
| RTP claim rule (RTP-CLAIM 1.2.0) | 6 tiers tabled at their exact RTP; claim noted, not tested | Info |
| Settlement edge (Step 9) | 473 / 473 wins at the full multiplier, at $0.01 and $1.00 | Pass |
| Simulation Pass 1 (Step 14) | 5M rounds (10 streams × 500K), Fisher’s p = 0.7712, 0 / 10 streams below α = 0.01 | Pass |
| Casino-seed screen (Step 15) | 1,350 seeds × 1,000 beacon values, 15 failures against a threshold of 25 | Pass |
| Bet-size invariance (Step 6) | 100 / 100 Phase C rounds at $1.00 | Pass |
| Serial independence (Step 14) | lag1Z = −2.384, runsP = 0.4312 on the replayed 5M-round sequence | Pass |
4.12Code References7 source files
| File | Purpose |
|---|---|
| tests/steps/dataset.ts | Step 13: anti-circularity, per-tier expectation from the counted mapping, negative control |
| tests/steps/payouts.ts | Steps 7–9: payouts, multipliers and the settlement edge from served credits |
| tests/steps/simulation.ts | Steps 14–15: Pass 1 replay with Fisher’s combination and serial tests; Pass 2 casino-seed screen |
| src/rtp-settings.ts, src/rtp-claim.ts | The RTP claim rule 1.2.0 and the exact per-tier RTP table |
| src/simulate.ts, src/sim-seeds.ts | The two-pass simulation and its pinned seeds |
| src/stats.ts | Chi-squared, lag-1 autocorrelation, runs test |
| src/rng.ts | PAYOUT_TABLE, RANGE = 48, the position code |
4.13Datasets UsedSource artifacts
4.14Verified Invariants8 invariants
| Invariant | Result |
|---|---|
| P(tier) × multiplier = 1 within 1.12 × 10⁻⁸ on all 6 tiers, from the counted mapping | Pass |
| The 48 position probabilities sum to 1 within 10⁻¹⁰ | Pass |
| A table with any multiplier raised by one is rejected on every tier | Pass |
| Every win credited stake × table multiplier exactly at 18 decimals (473 / 473) | Pass |
| Fisher’s combined p ≥ 0.01 on 10 × 500K streams (observed 0.7712) | Pass |
| Casino-seed failures at or under the threshold (15 ≤ 25) | Pass |
| Phase C ($1.00) positions recompute like the $0.01 rounds | Pass |
| The committed RTP claim table equals the run and its pin | Pass |
4.15Reproduction InstructionsRun locally
git clone https://github.com/ProvablyFair-org/duel-castle-roulette.gitcd duel-castle-roulettegit checkout v1.2.1npm cinpm test# Steps 6–9, 13–15 and 19 cover S4S4 steps, as printed:
[PASS] Step 6 — Bet-Size Invariance
[PASS] Step 7 — Payout Math
[PASS] Step 8 — Color-Position Mapping
[PASS] Step 9 — Settlement Edge Verification
[PASS] Step 13 — Anti-Circularity (Baseline RTP by Construction)
[PASS] Step 14 — Simulation Pass 1 (Fisher's Combined — 10 Streams)
[PASS] Step 15 — Simulation Pass 2 (Casino Seeds)
[PASS] Step 19 — Live-Sample Fit (informational, CASTLE-22)
The RTP claim rule, as printed:
rtp-claim: ENFORCED — NOTED, never scored as a miss
rtp-claim: true range 100.000000–100.000001% over 6 settings · true min 100.000000% (tier=dark_blue (2x)) · true max 100.000001% (tier=green (48x))
rtp-claim: outcome NOTED (never a miss, enforced or not) · per-setting table: all 6 rowsFairness Integrity Testing
Does the implementation maintain fairness under non-standard conditions?
Sections 1–4 prove the game is mathematically fair. Section 5 proves the implementation maintains integrity under non-standard conditions. We applied 15 standard fairness integrity tests covering seed integrity, bet timing, outcome determinism, cross-player isolation, payout integrity, and wheel-position distribution integrity. For Castle Roulette, the framework is adapted from the pan-game matrix to reflect the dual-entropy (server seed + drand) architecture and the discrete 48-position outcome model: there is no client seed to test, no nonce sequence per player, no per-player outcome divergence, and the commit-reveal chain is anchored against an external public beacon.
What we verified
- Seed commitment — server seed hash published before drand beacon emits (1,350 / 1,350 verified)
- drand authenticity — every beacon value matches the public drand chain byte-for-byte (1,350 / 1,350)
- Bet timing — bet placed before drand publication for every round (min margin 14.763s)
- Outcome determinism — identical inputs produce identical wheel positions (1,350 / 1,350 recomputed)
- Cross-player isolation — all players see the same wheel position per round (global outcome model)
- Distribution integrity — wheel-position distribution is uniform across 48 positions (Fisher's
p = 0.7712)
What this means for you
- No one — not the player, not the casino — can alter the wheel position through the API
- The casino commits to each round's outcome before the external entropy is even known
- Every round is cryptographically isolated from every other — no state leakage
- The external entropy comes from a public beacon the casino cannot forge or withhold
- The server's outcome is computed from the canonical inputs only — adversarial probes confirmed the server rejects malformed bet parameters and ignores injected outcome fields
- Seed commitment — server seed hash published before drand beacon emits (1,350 / 1,350 verified)
- drand authenticity — every beacon value matches the public drand chain byte-for-byte (1,350 / 1,350)
- Bet timing — bet placed before drand publication for every round (min margin 14.763s)
- Outcome determinism — identical inputs produce identical wheel positions (1,350 / 1,350 recomputed)
- Cross-player isolation — all players see the same wheel position per round (global outcome model)
- Distribution integrity — wheel-position distribution is uniform across 48 positions (Fisher's
p = 0.7712)
- No one — not the player, not the casino — can alter the wheel position through the API
- The casino commits to each round's outcome before the external entropy is even known
- Every round is cryptographically isolated from every other — no state leakage
- The external entropy comes from a public beacon the casino cannot forge or withhold
- The server's outcome is computed from the canonical inputs only — adversarial probes confirmed the server rejects malformed bet parameters and ignores injected outcome fields
Seed integrityPass
Bet timingPass
Outcome determinismPass
Cross-player isolationPass
Payout integrityPass
Distribution integrityPass
15 standard fairness integrity tests: 14 pass, 1 N/A (player-action invariance — global outcome model).
Category Coverage
| Check | Result | Evidence |
|---|---|---|
| Seed integrity | Pass | 5 tests — all SEED-001..005 pass (commitment, drand authenticity, uniqueness, determinism, statistical quality χ² p = 0.5505, H = 7.99583 bits/byte) |
| Bet timing | Pass | Bet placed before drand in 1,350 / 1,350 rounds (min margin 14.763s); drand round IDs strictly increasing (28,007,049 → 28,035,974) |
| Outcome determinism | Pass | Identical inputs produce identical wheel positions — 1,350 / 1,350 confirmed. Bet-size invariance verified (Phase C 100 / 100). Player-action invariance: architecturally N/A under global outcome model |
| Cross-player isolation | Pass | RNG state independent (lag1Z = −2.384, runsP = 0.4312); global outcome model — all players see same wheel position |
| Payout integrity | Pass | 2 adversarial socket probes pass (FI-PAYOUT-001 parameter limits: 5/5 invalid bets dropped; FI-PAYOUT-002 field injection: 3/3 injected wheel_position/payout_multiplier/result fields ignored) |
| Distribution integrity | Pass | Wheel positions uniform across 48 bins (live position chi² p = 0.8650 on 1,350 rounds; Fisher's combined p = 0.7712 across 10 × 500K-round streams) |
Seed integrityPass
Bet timingPass
Outcome determinismPass
Cross-player isolationPass
Payout integrityPass
Distribution integrityPass
15 standard fairness integrity tests: 14 pass, 1 N/A (player-action invariance — global outcome model).
How It Works — Fairness Integrity Testing2 sections
5.1Framework Overview
Testing follows the ProvablyFair.org Fairness Integrity Framework — a structured methodology derived from real, historically observed failures in provably fair systems. For Castle Roulette, the framework is adapted to the dual-entropy model and the discrete 48-position outcome wheel: seed integrity includes bet timing against a public external beacon (drand), outcome determinism is verified position-by-position against the 6-tier PAYOUT_TABLE, and a Castle-specific category covers wheel-position distribution uniformity. Scope boundary: S5 tests whether fairness guarantees hold under non-standard API interaction. Platform-level implementation testing falls outside standard certification.
| Category | Tests | What It Catches |
|---|---|---|
| Seed Integrity | 5 | Hash mismatches, drand forgery, seed reuse, non-determinism, non-uniform seed generation |
| Bet Timing | 2 | Late-commitment attacks, round shopping, post-hoc drand selection |
| Determinism | 3 | Non-deterministic outputs, player-action influence on global outcome, bet-size influence on outcome |
| Isolation | 2 | Cross-round state leakage, cross-player outcome divergence |
| Payout Integrity | 2 | Parameter enforcement, server-side computation verification |
| Distribution Integrity | 1 | Biased wheel-position distribution across the 48-position discrete outcome space |
5.2Severity Framework & Hard Fail Criteria
Findings are classified by severity. Hard fail criteria — any one triggers a NOT PROVABLY FAIR verdict.
| Severity | Meaning | Action |
|---|---|---|
| PASS | Test passed — no issue detected | None |
| N/A | Test not applicable to this game type | None |
| FLAG | Anomaly detected, documented for transparency | Disclosed |
| HARD FAIL | Fairness guarantee cannot be confirmed | Certification blocked until remediated |
| Condition | Consequence |
|---|---|
| Negative commitment margin (bet placed after drand published) | Pre-commitment guarantee broken — operator could have seen beacon first |
drand signature mismatch against api.drand.sh | External entropy forged — no independent randomness source |
| drand round ID non-monotonic (round shopping) | Operator cherry-picking favourable beacons post-hoc |
| Wheel-position recomputation mismatch | Undisclosed inputs affecting outcomes |
| Server seed reuse across rounds | Commit-reveal guarantee broken |
| Per-player wheel-position divergence in the same round | Cross-player isolation broken / hidden per-user seed |
Position-tier mapping mismatch (PAYOUT_TABLE[position] ≠ live winningCoin) | Static payout table modified server-side mid-round |
15 tests · 14 pass · 1 N/A
Seed Integrity5/5
FI-CR-SEED-001PassServer seed is committed (hashed) before the round's drand beacon is known
S1, Step 1 — 1,350/1,350 hashes verified. SHA-256(serverSeed_bytes) === serverSeedHash published pre-drand.
FI-CR-SEED-002Passdrand beacon is authentic and externally verifiable against the public drand chain
S2, Step 16 — 1,350/1,350 drand signatures cross-verified against api.drand.sh (chain 52db9ba7…4e971). 0 forgeries.
FI-CR-SEED-003PassServer seed is unique per round — no reuse across the captured sample
S1, Step 4 — 1,350 unique seeds and 1,350 unique hashes across 1,350 rounds.
FI-CR-SEED-004PassWheel position is deterministic from (serverSeed, drandRandomness) — no hidden entropy
S3, Step 5 — 1,350/1,350 wheel positions independently recomputed via HMAC-SHA256(serverSeed, drand:0) % 48. 0 mismatches.
FI-CR-SEED-005PassCaptured server seeds show no statistical patterns — uniform byte distribution, high entropy, no round-order correlation
Statistical quality check on 43,200 bytes (1,350 seeds × 32 bytes): byte-value χ² p = 0.5505; Shannon entropy H = 7.99583 bits/byte; round-order × first-byte Spearman ρ = −0.0446 (p = 0.1009). All thresholds met (p ≥ 0.01, H > 7.9, |ρ| < 0.1).
Bet Timing2/2
FI-CR-TIMING-001PassBet placement precedes drand beacon publication for every round — operator commits to the seed before external entropy is known
S1, Step 2 — 1,350/1,350 rounds with positive commitment margin (min 14.763s, mean 20.067s, max 20.405s). Single negative margin = hard fail.
FI-CR-TIMING-002Passdrand round IDs strictly increase across the capture window — no round shopping
S1, Step 3 — 1,350 rounds, drand round IDs strictly increasing across range 28,007,049 → 28,035,974. No gaps, no backward jumps.
Determinism3/3
FI-OUTCOME-001PassGiven identical inputs (serverSeed, drandRandomness), the game always produces the same wheel position
S3, Step 5 — 1,350/1,350 wheel positions independently recomputed from the two inputs, zero mismatches.
FI-OUTCOME-002N/AWheel position cannot be influenced by player actions — single global outcome computed before any player bets
Architectural — Castle Roulette uses a single global outcome model. Wheel position is computed from (serverSeed, drandRandomness) before any player bets. Players choose bet type (color tier 2× through 48×) but cannot alter the outcome. No manipulation surface exists.
FI-CR-DETERMINISM-003PassWheel position cannot be influenced by bet size — outcome is invariant under stake changes
S3 / S4, Step 6 — all 100 Phase C ($1) rounds verify under the identical RNG code path as the $0.01 rounds. Bet amount is not an input to the HMAC key or message.
Isolation2/2
FI-ISO-001PassRNG state is fully independent across rounds — no carry-over from one round to the next
S2, Step 14 — serial independence tested on combined 5M-round sequence: lag1Z = −2.384 (within |Z|<3), runsP = 0.4312 (well above 0.01 threshold).
FI-ISO-002PassAll players see the same wheel position per round — single global outcome model, no per-user seed, no cross-user dependence
Architectural — computePosition(serverSeed, drandRandomness) takes no per-user input. RNG code path confirmed in S2 (2.1 Implementation).
Payout Integrity2/2
FI-PAYOUT-001PassBet parameters cannot exceed defined limits — invalid amounts and out-of-range bet types are rejected server-side
Adversarial socket probe — 6 place bet requests over wss://roulette.duel.com/s/. Control bet (coin=two, amount=0.01) accepted. 5 adversarial bets all silently dropped (no own_bet response within 8 s): amount=−1, amount=50001, coin="invalid_category", position=48 (out-of-range), position=−1. controlBetAccepted=true, acceptedCount=0, noResponseCount=5. Evidence: testing/tests/castle-roulette/fi-payout-001 in integrity-test repo.
FI-PAYOUT-002PassPayout and wheel-position fields cannot be injected into the bet request — server computes outcome only from canonical inputs
Adversarial socket probe — 7 place bet requests over wss://roulette.duel.com/s/. Betting phase: 3 bets accepted across consecutive rounds (598911-598913) with wheel_position=1000, payout_multiplier=999, and result="win" injected respectively — every injected field absent from server responses. injectedFieldsLeaked=false. Spin phase: 3 injection bets silently dropped (betting window closed). No injected value influenced the wheel position or payout outcome. Evidence: testing/tests/castle-roulette/fi-payout-002 in integrity-test repo.
Distribution Integrity1/1
FI-CR-DIST-001PassWheel-position distribution is uniform across 0-47 — no mapping bias, no serial correlation
S2, Steps 14 and 19 — chi-squared goodness-of-fit on 48-bin position distribution. Live dataset (Step 19): position chi² = 36.52 (df = 47, p = 0.8650, n = 1,350) — null hypothesis of uniform distribution not rejected. Simulation (Step 14): Fisher's combined p = 0.7712 across 10 × 500K-round streams; 0 / 10 streams fail at α = 0.01.
Technical Evidence & Verification4 sections
5.3Coverage Summary15 checks
| Test ID | Category | Verification Source | Status |
|---|---|---|---|
| FI-CR-SEED-001 | Seed | S1, Step 1 (data-driven) | Pass |
| FI-CR-SEED-002 | Seed | S2, Step 16 (data-driven) | Pass |
| FI-CR-SEED-003 | Seed | S1, Step 4 (data-driven) | Pass |
| FI-CR-SEED-004 | Seed | S3, Step 5 (data-driven) | Pass |
| FI-CR-SEED-005 | Seed | Statistical analysis (data-driven) | Pass |
| FI-CR-TIMING-001 | Timing | S1, Step 2 (data-driven) | Pass |
| FI-CR-TIMING-002 | Timing | S1, Step 3 (data-driven) | Pass |
| FI-OUTCOME-001 | Determinism | S3, Step 5 (data-driven) | Pass |
| FI-OUTCOME-002 | Determinism | Structural — global outcome model | N/A |
| FI-CR-DETERMINISM-003 | Determinism | S3 / S4, Step 6 (data-driven) | Pass |
| FI-ISO-001 | Isolation | S2, Step 14 (simulation) | Pass |
| FI-ISO-002 | Isolation | Structural — global outcome model | Pass |
| FI-PAYOUT-001 | Payout | Adversarial socket probe | Pass |
| FI-PAYOUT-002 | Payout | Adversarial socket probe | Pass |
| FI-CR-DIST-001 | Distribution | S2, Step 14 (simulation) + Step 19 (position chi² on live dataset) | Pass |
5.4Additional Integrity Evidence (S1–S4)7 records
| Property | Source | Finding |
|---|---|---|
| 473 / 473 wins credited stake × table multiplier exactly | S4, Step 9 | Zero house edge — no scaling, no per-tier variation, no edge factor in the RNG formula |
| 1,350 / 1,350 PAYOUT_TABLE multiplier match | S3, Step 8 | Color-position mapping correct — static 6-tier table not server-modified |
| Anti-circularity proven for 6 color tiers | S4, Step 13 | 100% RTP from count × multiplier = 48 identity — derived from wheel structure, not casino data |
| 15 / 1,350 Pass 2 chi² fails ≤ 25 threshold | S4, Step 15 | No seed pre-selection bias — mean casino-seed RTP = 99.9985% |
| Mean simulated RTP = 100.0070% | S4, Step 14 | Within 0.01% of theoretical 100.0000% across 5M rounds (10 × 500K streams) |
| 1,350 / 1,350 wheel-position parity | S3, Step 5 | No post-RNG conditional logic, no hidden entropy — verifier produces identical position to live game |
| Phase coverage verified: A 800 + B 200 + C 100 + D 100 + E 150 = 1,350 | S3, Step 10 | All 5 capture phases represented — full multi-tier and bet-size coverage |
5.5Scope
This certification covers the 15 standard fairness integrity tests listed above — the minimum required to verify that the provably fair implementation holds up under non-standard conditions, adapted to Castle Roulette's dual-entropy architecture and 48-position discrete outcome model. This is not a penetration test. It focuses specifically on the provably fair implementation — not the operator's broader platform security.
Standard scope: The 15 tests above are our standard fairness integrity matrix for Castle Roulette games, adapted from the pan-game framework to reflect dual-entropy (server seed + drand) architecture and discrete 48-position outcomes.
Single-account scope: Tests were conducted from a single auditor account. Cross-player consistency (all users seeing the same wheel position per round) is verified architecturally via RNG code path, not empirically through multi-account capture.
No infrastructure testing: Server security, network-level protections and operational controls fall under platform-level security, not game-level fairness, and sit outside this certification.
Point-in-time: Results apply to the game configuration and codebase at the time of audit. Post-audit changes require re-certification.
5.6Reproduction InstructionsRun locally
Data-driven tests (12 of 15): Fully reproducible from the open-source repo. These tests run against the captured dataset and produce deterministic results.
git clone https://github.com/ProvablyFair-org/duel-castle-roulette.gitcd duel-castle-roulettegit checkout v1.2.1npm cinpm testExpected output (S5-related steps):
[PASS] Step 1 — Seed Hash Integrity → FI-CR-SEED-001
[PASS] Step 2 — Bet Before drand Beacon → FI-CR-TIMING-001
[PASS] Step 3 — drand Round Monotonicity → FI-CR-TIMING-002
[PASS] Step 4 — Server Seed Uniqueness → FI-CR-SEED-003
[PASS] Step 5 — Position Recomputation → FI-CR-SEED-004, FI-OUTCOME-001
[PASS] Step 6 — Bet-Size Invariance → FI-CR-DETERMINISM-003
[PASS] Step 14 — Simulation Pass 1 (Fisher's Combined — 10 Streams) → FI-ISO-001, FI-CR-DIST-001
[PASS] Step 15 — Simulation Pass 2 (Casino Seeds) → FI-CR-DIST-001
[PASS] Step 16 — drand API Signature Verification → FI-CR-SEED-002Statistical Quality Test (FI-CR-SEED-005):
// FI-CR-SEED-005: Server-seed byte distribution quality// Runs on the 1,350 revealed server seeds from data/castle-roulette-master-1350rounds.json//// Three sub-checks (all PASS thresholds):// 1. Byte-value chi² across 256 buckets — pass if p ≥ 0.01// 2. Shannon entropy (bits/byte) — pass if H > 7.9// 3. Round-order × first-byte Spearman — pass if |ρ| < 0.1 AND p ≥ 0.01//// Observed (43,200 bytes from 1,350 × 32-byte seeds):// 1. χ² = 251.4844, p = 0.5505 ✓// 2. H = 7.99583 bits/byte ✓// 3. ρ = −0.0446, p = 0.1009 ✓//// Overall: PASSAPI Probe Tests (completed):
# FI-PAYOUT-001: Bet parameter limits# bet_amount = -1, 50001 (exceeds max)# coin = "invalid_category"# position = 48 (out of range), -1# Result: PASS — 5/5 adversarial bets silently dropped (no own_bet within 8s) # FI-PAYOUT-002: Payout / position field injection# Injected wheel_position=1000, payout_multiplier=999, result="win" in request body# Result: PASS — 3/3 injected fields absent from server responses (injectedFieldsLeaked=false) # Status: PASS — see integrity-test repo testing/tests/castle-roulette/Player Verification
Can a player verify their own bets without trusting anyone?
Every Castle Roulette round can be recomputed from two inputs the player can see: the server seed revealed after the spin and the public drand beacon. Save the round’s server seed hash before you bet. A revealed seed that hashes to your saved copy is the seed that was fixed before you played, and the beacon can be checked against any drand relay. This section walks through the steps, with an independent verifier and scripts you can run yourself.
Key principles
- Save the round’s server seed hash before you bet: your own copy is what shows the seed was fixed in advance
- Every wheel position recomputes from two inputs you can see; no hidden input goes in
- If the revealed seed hashes to your saved copy and the beacon matches the public chain, the position is the one those inputs produce
- ProvablyFair.org’s verifier code, pinned in the package, returned the served position on all 1,350 captured rounds
What you need
- Server Seed — revealed in the round’s Provably Fair panel after the spin; its hash is broadcast when the round opens
- drand Round ID — the public beacon round the server used for this round
- drand Randomness — that round’s beacon value, the same on any drand relay
- Save the round’s server seed hash before you bet: your own copy is what shows the seed was fixed in advance
- Every wheel position recomputes from two inputs you can see; no hidden input goes in
- If the revealed seed hashes to your saved copy and the beacon matches the public chain, the position is the one those inputs produce
- ProvablyFair.org’s verifier code, pinned in the package, returned the served position on all 1,350 captured rounds
- Server Seed — revealed in the round’s Provably Fair panel after the spin; its hash is broadcast when the round opens
- drand Round ID — the public beacon round the server used for this round
- drand Randomness — that round’s beacon value, the same on any drand relay
Player can access all required inputsPass
Commitment can be saved before bettingInfo
External input verifiablePass
Independent verifier availablePass
Casino verifier cross-checkedPass
Manual recomputation possiblePass
No hidden or proprietary stepsPass
Only disclosed inputs are used, and identical inputs always give the same position. Save the hash before you bet and the timing is yours to check too.
- 1
Save the Hash & Bet
Before you bet, copy the round’s server seed hash and keep it. Then pick a color tier and bet while the betting window is open.
- 2
Open the Provably Fair Panel
After the spin, the round’s panel shows the server seed hash, the revealed server seed, the drand round ID and the drand randomness. Copy the full values.
- 3
Recompute & Confirm
Enter the values and your saved hash in the ProvablyFair.org verifier, or run a script. The hash must match your copy, and the position must match your round.
- 4
Check the Beacon (Optional)
Fetch the drand round from any relay. Its signature must equal the panel’s drand randomness.
Verify a real bet, step by stepVerify a real bet · Swipe for all 4 steps →
Verify with ProvablyFair.org
Recompute any Castle Roulette round from its revealed seed and drand beacon, independently of the casino.
Open independent verifierBuilt-in verification
Duel’s own Verify page. Its published code returned the served position on all 1,350 captured rounds; the live page was read on one of them.
Open Duel verifierVisual Walkthroughstep-by-step
Before you bet, copy the round’s Server Seed Hashed value as it is shown for that round and keep it: Duel broadcasts the hash when the round opens. That saved copy is what lets you check later that the seed was fixed before you played. Then pick a color tier (Dark Blue 2×, Grey 4×, Blue 8×, Purple 16×, Red 24× or Green 48×) and bet while the window is open. The position depends only on the server seed and the beacon, not on your stake or your color.

Duel.com Castle Roulette — the 48-position wheel, the six color tiers and the Provably Fair button. Other players’ names are masked.
After the spin, open the round’s Provably Fair panel. It shows the round ID, the server seed hash, the revealed server seed, the drand round ID and the drand randomness, each with a copy button for the full value (the panel shortens them on screen). The revealed seed, hashed as the 32 bytes its hex encodes, must equal the hash you saved:
Server Seed Hashed — the commitment. Compare it with your saved copy.
Server Seed — the plaintext behind the commitment, revealed after the spin.
Drand Round ID — the public beacon round the server used for this round.
Drand Randomness — that round’s beacon value, 96 hex characters; any drand relay serves the same value.

Provably Fair panel of a settled round (599568, illustrative: not in the dataset). Other players’ names are masked.
Click Verify in the panel to open Duel’s Provably Fair page with the drand seed and server seed filled in; it shows the roll inline. For a check that does not rely on Duel’s page, enter the same values and the hash you saved in the ProvablyFair.org verifier, or run a script from 6.8. The position must equal your round’s, and its tier sets the payout.

Duel’s Provably Fair page with round 599568’s seeds: roll 17 (Grey, 4×). The same inputs recompute to 17.
Open api.drand.sh/v2/beacons/quicknet/rounds/ followed by the drand Round ID from the panel, in any browser. Its signature field must equal the panel’s drand randomness exactly. drand is a public beacon run by an independent network; the audit matched all 1,350 captured values against drand.cloudflare.com (Step 16).

Public drand API response for one quicknet round (illustrative, not the round above): its round number and signature.
Manual Verification (Advanced)7 sections
6.5Why Manual Verification Matters
Manual verification needs no casino tool and no verifier you have to trust. The calculation runs on your own machine, from the specification in the release, and you can read every line of it.
6.6How the Algorithm Works (Plain English)
Two inputs fix the wheel position:
- The server seed — Duel’s secret for this round, committed by broadcasting its SHA-256 hash when the round opens
- The drand beacon — a public value the drand quicknet network publishes every 3 seconds; every captured bet was placed before its round’s beacon was published
HMAC-SHA256, keyed with the server seed’s bytes, takes the beacon value read as text plus :0. The first 4 bytes of the result, read as a number, are reduced modulo 48 to a position from 0 to 47, and the position sets the winning tier: Green 48× (position 0), Red 24× (1–2), Purple 16× (3–5), Blue 8× (6–11), Grey 4× (12–23), Dark Blue 2× (24–47). Your stake and your color do not go in, so every player in the round shares the position. If the revealed seed hashes to the copy you saved before betting, the seed was fixed before the beacon was published and could not be chosen to suit it. Which beacon round the server pairs with a round is not published; the panel shows the one it used.
6.7Casino Verifier vs ProvablyFair.org Verifier3 records
Both tools should give the same position. If they ever differ, something has changed.
| Duel.com Verifier | ProvablyFair.org Verifier | |
|---|---|---|
| Source | Casino-controlled | Independent, open source |
| Access | duel.com/provably-fair/verify | provablyfair.org/verify-bets/duel |
| Trust model | Requires trusting the casino | Not controlled by the casino |
6.8JavaScript Verification Script
Paste your round’s values into the four constants and run it with Node.js. Use the hash you saved before betting, not one read after the reveal:
// node verify-round.js — paste your round's values into the four constants// serverSeedHashed: the hash you saved BEFORE bettingconst crypto = require('crypto');const serverSeed = '', serverSeedHashed = '', drandRandomness = '', position = 0; const TIERS = [[0, 0, 'Green', 48], [1, 2, 'Red', 24], [3, 5, 'Purple', 16], [6, 11, 'Blue', 8], [12, 23, 'Grey', 4], [24, 47, 'Dark Blue', 2]];const key = Buffer.from(serverSeed, 'hex');const hashMatches = crypto.createHash('sha256').update(key).digest('hex') === serverSeedHashed;const text = new TextDecoder('utf-8').decode(Buffer.from(drandRandomness, 'hex')); // invalid bytes → U+FFFDconst message = Buffer.concat([Buffer.from(text, 'utf8'), Buffer.from(':0')]);const digest = crypto.createHmac('sha256', key).update(message).digest();const pos = digest.readUInt32BE(0) % 48; // no rejectionconst [, , color, multiplier] = TIERS.find(([from, to]) => pos >= from && pos <= to);console.log({ hashMatches, position: pos, tier: `${color} ${multiplier}×`, matches: pos === position });6.9Python Verification Script
The same steps in Python, standard library only:
# python3 verify_round.py — paste your round's values into the four constants# server_seed_hashed: the hash you saved BEFORE bettingimport hashlib, hmac server_seed, server_seed_hashed, drand_randomness, position = '', '', '', 0 TIERS = [(0, 0, 'Green', 48), (1, 2, 'Red', 24), (3, 5, 'Purple', 16), (6, 11, 'Blue', 8), (12, 23, 'Grey', 4), (24, 47, 'Dark Blue', 2)]key = bytes.fromhex(server_seed)hash_matches = hashlib.sha256(key).hexdigest() == server_seed_hashedtext = bytes.fromhex(drand_randomness).decode('utf-8', errors='replace') # invalid bytes → U+FFFDmessage = text.encode('utf-8') + b':0'digest = hmac.new(key, message, hashlib.sha256).digest()pos = int.from_bytes(digest[:4], 'big') % 48 # no rejectioncolor, multiplier = next((c, m) for lo, hi, c, m in TIERS if lo <= pos <= hi)print({'hash_matches': hash_matches, 'position': pos, 'tier': f'{color} {multiplier}×', 'matches': pos == position})6.10Worked Example7 records
A captured round, 538493 from Phase A: server seed adace83dfe4957273152c5c52aea5e4fc112dabef87ff4baa350ca652420eb26, drand round 28007049. Its commitment, SHA-256 of the seed bytes, is ae7a5f98e2f4785022a58890db980cb71bb9f0c1bd02a44a1d69699ad18baaaa. The steps:
| Step | Input | Output |
|---|---|---|
| Hash check | SHA-256 of the 32 seed bytes | ae7a5f98…ad18baaaa = the commitment ✓ |
| Beacon text | drand randomness 8d59f6f2…5cd6621d, 48 bytes, read as UTF-8 | 47 characters |
| Message | beacon text + :0 | 49 characters |
| HMAC-SHA256 | key = seed bytes | d6b318ab366262e3…ae1b71b3b1 |
| First 4 bytes | 0xd6b318ab | 3,602,061,483 |
| Modulo 48 | 3,602,061,483 % 48 | position 27 |
| Tier | positions 24–47 | Dark Blue, 2× |
The bet was $0.01 on Dark Blue (coin: "two"), so it wins $0.02, the served credit. Any quicknet relay returns the same randomness for round 28,007,049; the audit matched it against drand.cloudflare.com (Step 16).
6.11Evidence Screenshots6 records
| Evidence | Description |
|---|---|
| step1-game-ui.png | Castle Roulette game screen: the wheel, the six color tiers and the Provably Fair button (other players’ names masked) |
| step2-fairness-page.png | Provably Fair panel of settled round 599568 (illustrative: not in the dataset; names masked) |
| step3-verification-result.png | Duel’s Provably Fair page with the same round’s seeds: roll 17 |
| step4-drand-verification.png | Public drand API response for one quicknet round (illustrative) |
| E07, E08 | The package’s exhibits of Duel’s fairness page and its verification tab (game selector, seed inputs, published code) |
| E09 | Duel’s Castle Roulette Verify-tab code, saved verbatim on 26 September 2026, SHA-256 c83dca21… |
Verify a real bet, step by stepVerify a real bet · Swipe for all 4 steps →
How it works
- 1
Save the Hash & Bet
Before you bet, copy the round’s server seed hash and keep it. Then pick a color tier and bet while the betting window is open.
- 2
Open the Provably Fair Panel
After the spin, the round’s panel shows the server seed hash, the revealed server seed, the drand round ID and the drand randomness. Copy the full values.
- 3
Recompute & Confirm
Enter the values and your saved hash in the ProvablyFair.org verifier, or run a script. The hash must match your copy, and the position must match your round.
- 4
Check the Beacon (Optional)
Fetch the drand round from any relay. Its signature must equal the panel’s drand randomness.
Visual Walkthroughstep-by-step
Before you bet, copy the round’s Server Seed Hashed value as it is shown for that round and keep it: Duel broadcasts the hash when the round opens. That saved copy is what lets you check later that the seed was fixed before you played. Then pick a color tier (Dark Blue 2×, Grey 4×, Blue 8×, Purple 16×, Red 24× or Green 48×) and bet while the window is open. The position depends only on the server seed and the beacon, not on your stake or your color.

Duel.com Castle Roulette — the 48-position wheel, the six color tiers and the Provably Fair button. Other players’ names are masked.
After the spin, open the round’s Provably Fair panel. It shows the round ID, the server seed hash, the revealed server seed, the drand round ID and the drand randomness, each with a copy button for the full value (the panel shortens them on screen). The revealed seed, hashed as the 32 bytes its hex encodes, must equal the hash you saved:
Server Seed Hashed — the commitment. Compare it with your saved copy.
Server Seed — the plaintext behind the commitment, revealed after the spin.
Drand Round ID — the public beacon round the server used for this round.
Drand Randomness — that round’s beacon value, 96 hex characters; any drand relay serves the same value.

Provably Fair panel of a settled round (599568, illustrative: not in the dataset). Other players’ names are masked.
Click Verify in the panel to open Duel’s Provably Fair page with the drand seed and server seed filled in; it shows the roll inline. For a check that does not rely on Duel’s page, enter the same values and the hash you saved in the ProvablyFair.org verifier, or run a script from 6.8. The position must equal your round’s, and its tier sets the payout.

Duel’s Provably Fair page with round 599568’s seeds: roll 17 (Grey, 4×). The same inputs recompute to 17.
Open api.drand.sh/v2/beacons/quicknet/rounds/ followed by the drand Round ID from the panel, in any browser. Its signature field must equal the panel’s drand randomness exactly. drand is a public beacon run by an independent network; the audit matched all 1,350 captured values against drand.cloudflare.com (Step 16).

Public drand API response for one quicknet round (illustrative, not the round above): its round number and signature.
Technical evidence
6.5Why Manual Verification Matters
Manual verification needs no casino tool and no verifier you have to trust. The calculation runs on your own machine, from the specification in the release, and you can read every line of it.
6.6How the Algorithm Works (Plain English)
Two inputs fix the wheel position:
- The server seed — Duel’s secret for this round, committed by broadcasting its SHA-256 hash when the round opens
- The drand beacon — a public value the drand quicknet network publishes every 3 seconds; every captured bet was placed before its round’s beacon was published
HMAC-SHA256, keyed with the server seed’s bytes, takes the beacon value read as text plus :0. The first 4 bytes of the result, read as a number, are reduced modulo 48 to a position from 0 to 47, and the position sets the winning tier: Green 48× (position 0), Red 24× (1–2), Purple 16× (3–5), Blue 8× (6–11), Grey 4× (12–23), Dark Blue 2× (24–47). Your stake and your color do not go in, so every player in the round shares the position. If the revealed seed hashes to the copy you saved before betting, the seed was fixed before the beacon was published and could not be chosen to suit it. Which beacon round the server pairs with a round is not published; the panel shows the one it used.
6.7Casino Verifier vs ProvablyFair.org Verifier3 records
Both tools should give the same position. If they ever differ, something has changed.
| Duel.com Verifier | ProvablyFair.org Verifier | |
|---|---|---|
| Source | Casino-controlled | Independent, open source |
| Access | duel.com/provably-fair/verify | provablyfair.org/verify-bets/duel |
| Trust model | Requires trusting the casino | Not controlled by the casino |
6.8JavaScript Verification Script
Paste your round’s values into the four constants and run it with Node.js. Use the hash you saved before betting, not one read after the reveal:
// node verify-round.js — paste your round's values into the four constants// serverSeedHashed: the hash you saved BEFORE bettingconst crypto = require('crypto');const serverSeed = '', serverSeedHashed = '', drandRandomness = '', position = 0; const TIERS = [[0, 0, 'Green', 48], [1, 2, 'Red', 24], [3, 5, 'Purple', 16], [6, 11, 'Blue', 8], [12, 23, 'Grey', 4], [24, 47, 'Dark Blue', 2]];const key = Buffer.from(serverSeed, 'hex');const hashMatches = crypto.createHash('sha256').update(key).digest('hex') === serverSeedHashed;const text = new TextDecoder('utf-8').decode(Buffer.from(drandRandomness, 'hex')); // invalid bytes → U+FFFDconst message = Buffer.concat([Buffer.from(text, 'utf8'), Buffer.from(':0')]);const digest = crypto.createHmac('sha256', key).update(message).digest();const pos = digest.readUInt32BE(0) % 48; // no rejectionconst [, , color, multiplier] = TIERS.find(([from, to]) => pos >= from && pos <= to);console.log({ hashMatches, position: pos, tier: `${color} ${multiplier}×`, matches: pos === position });6.9Python Verification Script
The same steps in Python, standard library only:
# python3 verify_round.py — paste your round's values into the four constants# server_seed_hashed: the hash you saved BEFORE bettingimport hashlib, hmac server_seed, server_seed_hashed, drand_randomness, position = '', '', '', 0 TIERS = [(0, 0, 'Green', 48), (1, 2, 'Red', 24), (3, 5, 'Purple', 16), (6, 11, 'Blue', 8), (12, 23, 'Grey', 4), (24, 47, 'Dark Blue', 2)]key = bytes.fromhex(server_seed)hash_matches = hashlib.sha256(key).hexdigest() == server_seed_hashedtext = bytes.fromhex(drand_randomness).decode('utf-8', errors='replace') # invalid bytes → U+FFFDmessage = text.encode('utf-8') + b':0'digest = hmac.new(key, message, hashlib.sha256).digest()pos = int.from_bytes(digest[:4], 'big') % 48 # no rejectioncolor, multiplier = next((c, m) for lo, hi, c, m in TIERS if lo <= pos <= hi)print({'hash_matches': hash_matches, 'position': pos, 'tier': f'{color} {multiplier}×', 'matches': pos == position})6.10Worked Example7 records
A captured round, 538493 from Phase A: server seed adace83dfe4957273152c5c52aea5e4fc112dabef87ff4baa350ca652420eb26, drand round 28007049. Its commitment, SHA-256 of the seed bytes, is ae7a5f98e2f4785022a58890db980cb71bb9f0c1bd02a44a1d69699ad18baaaa. The steps:
| Step | Input | Output |
|---|---|---|
| Hash check | SHA-256 of the 32 seed bytes | ae7a5f98…ad18baaaa = the commitment ✓ |
| Beacon text | drand randomness 8d59f6f2…5cd6621d, 48 bytes, read as UTF-8 | 47 characters |
| Message | beacon text + :0 | 49 characters |
| HMAC-SHA256 | key = seed bytes | d6b318ab366262e3…ae1b71b3b1 |
| First 4 bytes | 0xd6b318ab | 3,602,061,483 |
| Modulo 48 | 3,602,061,483 % 48 | position 27 |
| Tier | positions 24–47 | Dark Blue, 2× |
The bet was $0.01 on Dark Blue (coin: "two"), so it wins $0.02, the served credit. Any quicknet relay returns the same randomness for round 28,007,049; the audit matched it against drand.cloudflare.com (Step 16).
6.11Evidence Screenshots6 records
| Evidence | Description |
|---|---|
| step1-game-ui.png | Castle Roulette game screen: the wheel, the six color tiers and the Provably Fair button (other players’ names masked) |
| step2-fairness-page.png | Provably Fair panel of settled round 599568 (illustrative: not in the dataset; names masked) |
| step3-verification-result.png | Duel’s Provably Fair page with the same round’s seeds: roll 17 |
| step4-drand-verification.png | Public drand API response for one quicknet round (illustrative) |
| E07, E08 | The package’s exhibits of Duel’s fairness page and its verification tab (game selector, seed inputs, published code) |
| E09 | Duel’s Castle Roulette Verify-tab code, saved verbatim on 26 September 2026, SHA-256 c83dca21… |
Only disclosed inputs are used, and identical inputs always give the same position. Save the hash before you bet and the timing is yours to check too.
Reproducibility & Artifacts
Can anyone independently reproduce every finding in this audit?
All 19 scored steps ship as code in the open-source release. Check out v1.2.1, run npm ci and npm test: in about 80 seconds it re-verifies all 1,350 live rounds offline and compares its results field by field with the committed ones. The repository is the credential, not this report.
Repository Details
- GitHub: ProvablyFair-org/duel-castle-roulette
- Release: v1.2.1 · commit
d396ac9, 21 October 2026 - Original audit: commit
e57da3e, 4 June 2026 - Public Verifier: provablyfair.org/verify-bets/duel
Prerequisites
- Node.js 22.x (
.nvmrc) - npm 9 or later
- Git
npm ciinstalls Mocha and ts-node from the lockfile
- GitHub: ProvablyFair-org/duel-castle-roulette
- Release: v1.2.1 · commit
d396ac9, 21 October 2026 - Original audit: commit
e57da3e, 4 June 2026 - Public Verifier: provablyfair.org/verify-bets/duel
- Node.js 22.x (
.nvmrc) - npm 9 or later
- Git
npm ciinstalls Mocha and ts-node from the lockfile
Check out v1.2.1 and npm test reproduces all 19 scored steps and compares them with the committed evidence: REPRODUCED, exit 0. The dataset hash pins the same 1,350 rounds.
Commands to Reproduce
Clone the release tag and confirm its release manifest: artifact hashes, verdict and scored counts. Node 22.x; the check needs nothing installed.
npm ci installs the toolchain (Mocha, ts-node) from the lockfile. npm test runs the 24 unit tests, then the 19 scored steps, and compares the run with the committed results. Below is the output as run on a fresh clone; the unit-test listing and one long line are shortened (…). The Node version printed is your own.
Both optional. npm run test:full runs the unit tests, regenerates the 5M-round simulation into outputs/run/, then verifies; the regenerated files are byte-identical to the pinned ones (about 2 minutes). npm run timing needs network: it re-checks the chain formula and the margins, re-fetches all 1,350 beacons from drand.cloudflare.com and rewrites outputs/drand-api-verification.json; when every fetch matches, the file is byte-identical to the pinned one.
Audit Reproducibility Pinning
- Release
v1.2.1· commit d396ac9537f3d723d1fd7a17ef5561f8d28f310a- Original Audit
- commit e57da3e96211d6e9fd404f44e497ceac0b59e55d · 4 June 2026
- Framework
- 1.1 · Castle Roulette profile 1.0.2
- Node Version
- 22.x (
.nvmrc) - Dataset
- data/castle-roulette-master-1350rounds.json (1,350 rounds, Phases A–E)
- Dataset Hash (SHA-256)
- 506e05ee9c07966a721715cd7d7b369e72159601b6a6439542330b311ffd66ce
- RNG Code (SHA-256)
- src/rng.ts · dbe46b269d43d1491af5694ab3eadf9c7d3c364f5d171fbdd4e832f5518542db
- drand Chain
- quicknet · 52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971
- Capture Window
- 22–23 April 2026 (UTC)
- Runtime
npm test82 s (Apple M2 Max, Node 22.23.1)- Mutation Battery
- 30 / 30 must-fail mutations caught by their named step; all 19 scored steps reached
- Signed Tag
- v1.2.1, ProvablyFair.org SSH key SHA256:gEujiJm2pRyq7lQsfYQfQ1r97H/J7GdaKHbOW8GtikY
- Audit ID
- PF-2026-DL07
Output Artifacts5 files · SHA-256 pinned
| File | Contents | SHA-256 |
|---|---|---|
| verification-results.json | All 19 scored steps: status, detail, profile checks and informational items | 82800394b4b4ecb8… |
| rtp-claim-table.json | The 6 color tiers at their exact RTP under the RTP claim rule | d633c433749651e9… |
| simulation-results.json | 5M-round Pass 1 with per-position counts; Pass 2 on 1,350 casino seeds | c91033bd6aed05fb… |
| drand-api-verification.json | All 1,350 beacon values against drand.cloudflare.com | cd5554cecdc37448… |
| rtp-convergence.html | Interactive RTP convergence chart, self-contained | e5b14d856f95f97c… |
Repository Structure
duel-castle-roulette/ (v1.2.1) ├── src/ │ ├── rng.ts → HMAC-SHA256 position code and 6-tier table, built from docs/ALGORITHM.md │ ├── bias.ts → Draw-bias bound of the % 48 reduction │ ├── rtp-claim.ts → The framework’s RTP claim rule (1.2.0) │ ├── rtp-settings.ts → The claim (noted) and the exact 6-tier RTP table │ ├── operator-verifier.ts → Runs Duel’s Verify-tab code unmodified (second check) │ ├── site-verifier.ts → Pins and runs the ProvablyFair.org site verifier │ ├── simulate.ts · sim-seeds.ts → Monte Carlo, 10 streams × 500K; pinned seeds │ ├── verify-drand-timing.js → `npm run timing`: chain formula, margins, beacon re-fetch │ ├── artifact-pins.ts → SHA-256 pins of the artifacts of record │ └── loader.ts → Dataset, SHA-256 guard, declared population ├── tests/ │ ├── verify.ts → 19 scored steps │ ├── steps/ → commitment, determinism, payouts, dataset, simulation, │ │ coverage, artifacts, live-fit │ ├── castle-roulette/ → 24 Mocha unit tests, including the spec’s own (119 checks) │ └── mutations.json → 30 must-fail mutations ├── data/ │ └── castle-roulette-master-1350rounds.json → 1,350 live rounds (Phases A–E) ├── outputs/ → Committed results of record │ └── run/ → Your run writes here, never over the record ├── evidence/ → Screenshots, Duel’s game settings, Duel’s Verify-tab code ├── verifier-parity/ → Pinned copy of the ProvablyFair.org verifier, runner for Duel’s code ├── docs/ALGORITHM.md → The written specification ├── capture/ → Reference records of the capture scripts ├── README.md · MANIFEST.md └── RELEASE-MANIFEST.json → Artifact hashes, verdict, signing key
Step-to-Section Cross-Reference19 scored steps mapped
| Step | Test Name | Report Section |
|---|---|---|
| 1 | Seed Hash Integrity | S1, S5 |
| 2 | Bet Before drand Beacon | S1, S5 |
| 3 | drand Round Monotonicity | S1, S5 |
| 4 | Server Seed Uniqueness | S1, S5 |
| 5 | Position Recomputation | S1, S2, S3, S5, S6 |
| 6 | Bet-Size Invariance | S1, S3, S4, S5 |
| 7 | Payout Math | S3, S4 |
| 8 | Color-Position Mapping | S3, S4, S5 |
| 9 | Settlement Edge Verification | S4, S5 |
| 10 | Phase Coverage | S3, S5 |
| 11 | Dataset Hash | S7 |
| 12 | drand Chain Formula | S1 |
| 13 | Anti-Circularity (Baseline RTP by Construction) | S4, S5 |
| 14 | Simulation Pass 1 (Fisher's Combined — 10 Streams) | S2, S4, S5 |
| 15 | Simulation Pass 2 (Casino Seeds) | S2, S4, S5 |
| 16 | drand API Signature Verification | S2, S5 |
| 17 | Configuration Coverage (coin tiers and wheel positions) | S3 |
| 18 | Artifact Integrity (pinned artifacts of record) | S7 |
| 19 | Live-Sample Fit (informational, CASTLE-22) | S2, S4, S5 |
Exit Codes0 · 1 · 2 · 5
The exit code is the verdict, so a script or CI job can read it directly.
| Code | Verdict | When |
|---|---|---|
| 0 | PROVABLY FAIR — Full Pass | Every step passes and the run reproduces the committed results |
| 2 | PROVABLY FAIR — Conditional Pass | At least one flag |
| 5 | RTP FIGURE OVERSTATED | No draw check failed, but a published RTP figure is above the game’s real return beyond the ±0.1 pp band. Under this game’s noted claim it cannot arise |
| 1 | NOT PROVABLY FAIR | At least one hard fail, or a reproduction difference beyond tolerance |
Reproduction Gateoutputs/run/
An ordinary run writes nothing into outputs/. Its results and diff.json go to outputs/run/, so a re-run can never replace the evidence it scores. outputs/run/diff.json compares the run with the committed results field by field: 1e-14 absolute + 1e-12 relative, and two distinct integers never agree.
| Committed artifact | Differences in our run |
|---|---|
| outputs/verification-results.json | 0 |
Result: REPRODUCED, 0 fields beyond tolerance; our run’s outputs/run/verification-results.json is byte-identical to the committed file.
Release History5 entries
The dataset is the same in every release.
| Release | What changed | Verdict |
|---|---|---|
| e57da3e · 4 June 2026 | Original audit published: 16 scored steps | PROVABLY FAIR — Full Pass |
| v1.0.0 | Original audit tagged, with artifact pinning (17 steps) | Unchanged |
| v1.1.0 | Re-certified under Framework 1.1: 19 scored steps, the RTP claim rule, configuration coverage, the live-sample fit | Unchanged |
| v1.2.0 | Position code rebuilt from the written specification; Duel’s Verify-tab code kept as a second check | Unchanged |
| v1.2.1 | Line-ending fix so a Windows clone stays byte-identical; no audit content changed | Unchanged |
reproduce-audit.sh
Check out v1.2.1 and npm test reproduces all 19 scored steps and compares them with the committed evidence: REPRODUCED, exit 0. The dataset hash pins the same 1,350 rounds.
Game Profile Coverage
Is every check of the Castle Roulette profile accounted for?
Framework 1.1 gives each game a profile: a fixed list of checks the audit must cover. Castle Roulette profile 1.0.2 has 30 checks. 19 are covered by scored steps, 6 by package checks, and 5 are not applicable, each with its reason: the game has no seed rotation, no nonce, no client seed and no balance field. Two checks are partial, as the package states.
| Check | What it covers | Covered by | Coverage |
|---|---|---|---|
| CASTLE-01 | Every revealed seed hashes to its commitment | Step 1 | Full |
| CASTLE-02 | Each rotation’s next-seed hash is the next epoch’s commitment | n/a — no seed rotation and no next-seed hash; round ordering is carried by the beacon instead (Step 3) | N/A |
| CASTLE-03 | Every bet in an epoch carries its epoch’s commitment | n/a — each round has its own server seed: 1,350 distinct seeds and hashes (Step 4) | N/A |
| CASTLE-04 | Nonces start at the declared base, with no reuse | n/a — no nonce: the message is the beacon value + :0, and no record carries a nonce field | N/A |
| CASTLE-05 | Round, seed and phase counts match the capture plan | Steps 4, 10 | Full |
| CASTLE-06 | The client seed changes the outcome | n/a — no client seed: the unpredictable input is the public drand beacon (Steps 2, 16) | N/A |
| CASTLE-07 | Every position recomputes from its revealed seed and beacon | Step 5 | Full |
| CASTLE-08 | Draw-bias bound of the % 48 reduction | Step 5 | Full |
| CASTLE-09 | RNG built from the written spec; operator code as a second check | Package check: spec, spec tests, operator-code run | Full |
| CASTLE-10 | Win condition from the recomputed position | Steps 7, 8 | Full |
| CASTLE-11 | Every credit equals stake × multiplier on the money grid | Step 7 | Full |
| CASTLE-12 | Bet size does not change the position or the payout | Step 6 | Full |
| CASTLE-13 | Served multipliers equal the declared table exactly | Step 8 | Full |
| CASTLE-14 | Tier identity, count × multiplier = 48; caps (none declared, 48× is the maximum) | Steps 8, 13 | Full |
| CASTLE-15 | Coin-tier and wheel-position coverage | Step 17 | Full |
| CASTLE-16 | Balance ledger across consecutive bets | n/a — no balance or wallet field appears in the captured data; every credit is verified instead (Step 7) | N/A |
| CASTLE-17 | Beacon: public value, publication time, ordering, bet timing, commitment before the beacon | Steps 2, 3, 12, 16 | Partial |
| CASTLE-18 | RTP from counted draw values, not casino data | Step 13 | Full |
| CASTLE-19 | Settlement edge served and derived | Steps 9, 13 | Full |
| CASTLE-20 | Simulation, 10 streams × 500,000 rounds | Step 14 | Full |
| CASTLE-21 | Casino-seed screen on every revealed seed | Step 15 | Partial |
| CASTLE-22 | Live-sample fit of positions and win rates | Step 19 | Full |
| CASTLE-23 | Framework S5 matrix in the package | Package check: MANIFEST S5 matrix, from the captured data | Full |
| CASTLE-24 | ProvablyFair.org verifier matches the audit RNG | Step 5 | Full |
| CASTLE-25 | Player instructions: where the seed is, fields, encoding, reduction | Package check: MANIFEST, Verify a bet | Full |
| CASTLE-26 | Dataset pinned by SHA-256 | Step 11 | Full |
| CASTLE-27 | Artifacts of record pinned, with value domains | Step 18 | Full |
| CASTLE-28 | Fresh-clone reproduction and test counts | Package check: fresh-clone run | Full |
| CASTLE-29 | Mutation battery reaches every scored step | Package check: 30 must-fail mutations | Full |
| CASTLE-30 | Declared limitations and premises | Package check: MANIFEST limitations | Full |