v2.8 · RNG PRE-SUBMISSION PACKAGE v1.2
RAIN RNG · PRE-SUBMISSION PACKAGE v1.2 · DOCUMENT

CHANGELOG — 2.0.0 → 2.1.0

Source sdk-v2/CHANGELOG.md · commit 96368332 · GLI CSR §2.2: Version identification · ← package index · raw on GitHub ↗

Changelog

2.1.0 — 2026-09-13 · "lab-grade draws, Web2 latency"

Answers the slot-builder feedback on 2.0 point by point. No protocol change on-chain; outcome / gameSeed / chains are byte-identical to 2.0 and the Arbitrum verifiers.

feedback 2.1
(a) one RAIN seed per spin, not keccak per draw · (b) 32-bit compat path not production-secure drbg(r, gameId) in @rain/rng-core: r (256-bit) → HMAC_DRBG SHA-256 (SP 800-90A §10.1.2, default) or ChaCha20 (RFC 8439) → index-addressed draw(i), uint32, uint53, float, unbiased intBelow (rejection), shuffle, cursor(). Own zero-dep SHA-256/HMAC. KATs: NIST CAVP HMAC_DRBG (32), FIPS 180-4, RFC 4231, RFC 8439 §2.3.2/§2.4.2/A.1; statistical smoke (chi-square, monobit, runs). seed32Compat() deprecated (warns, development only).
(c) reseed per round, never per session fresh r_k per round; DRBG state never spans rounds — documented in docs/RNG.md §2.5
(d) 100–480 ms per spin too slow pipelining in @rain/rng-session: client.prefetch() commits k+1 during k's animation; maxInFlight (default 2) on house and client; latencyMs per round + latencyStats(). Load test: RNG on the /spin critical path p95 0.5 ms (local or 40 ms-RTT node) vs 41 ms unpipelined remote
(e) 4,096 chain exhausts in < 2 h default chain 65,536; automatic rotation at 90 % (rotateTerms → rotate → rotated, fresh commit + reveal pair, no chain tx unless anchored); rotations[] / history[] audit records
(f) engine/rng.js + engine/rng.py drop-ins @rain/rng-core (ESM+CJS) and packages/rng-py (rain_rng, pure Python, stdlib only: keccak-f[1600], ceremony, HMAC-DRBG, ChaCha20); cross-language vectors generated from TS (scripts/gen-drbg-vectors.mjs), 26 pytest
(g) certify one RNG layer once for all games the draw layer is game-agnostic (domain-separated by gameId); docs/LAB-READINESS.md maps GLI-19 §3 point by point

Also: spinSeed(k) / RainSpinClient one-call ceremony with in-process, WebSocket, HTTP long-poll transports; examples/slot-spin-endpoint (operator /spin + /verify + load test); docs/INTEGRATION-OPERATOR.md. Tests: rng-core 4 → 7 files/… see README § Tests.

Breaking (minor): RainRngHouse/RainRngClient default chainLen 4096 → 65536 (constructor takes ≈1.3 s of keccak; pass chainLen for tests). RoundResult gained sessionId, sessionSeed, latencyMs. settle()'s reveal argument is optional when the reveal was receive()d.

2.0.0 — 2026-09-13 · "protocol-level"

v1 (@rain/risk-markets-sdk 0.1.0, July 2026, sdk/) was a single private package wrapping the MAY blackjack/roulette channels client on the RUSD demo ChannelManager, a passthrough of rain-sdk-v2 prediction markets, and vault reads. v2 is what the protocol became while Playmarket shipped on it. Everything below is live on Arbitrum One unless marked.

Protocol changes since v1 (what the SDK now reflects)

area v1.0 (July) v2.0 (September)
Channel manager ChannelManager V3/V4 on RUSD demo; Pyth Entropy session seed (V3) → two-party commit-reveal (V4) ChannelManagerAA V4.1 0x6074…0959 on USDTTT: identical to V4 + ERC-1271 player authorisation → smart-account (ERC-4337 / Alchemy Modular Account v2) players; reclaimStale (30-day permissionless escrow recovery); tiered challenge windows; fee waterfall on-chain
Login / signing EOA signs OpenChannel; one wallet popup per channel AA path: one signature ever (or the site login signature) → deterministic session material; RAIN session wallet installed as a signature-only validation entity (entity 0x52a1) on the account; gas-sponsored approve / installValidation / forceClose UserOps; zero popups for open/top-up/emergency withdraw
Games per channel one gameType per channel (blackjack or roulette) one channel, all games: CasinoGame/EngineV2Game/CrapsGame payload kinds switched while idle (mux action 255); global reveal cursor k shared across games; GameMuxVerifier 4 → 5 → 6 → 7 → 8 (→ 9 with craps): ranges 0..31 BJ · 32..63 roulette · 64..95 baccarat · 96..127 crash · 128..159 quick · 160..191 step · 192..223 Engine V2 · 224..254 craps
Randomness per-hand card reveals from two 4096-chains, sessionSeed from V4 same primitive, now documented as a standalone component (docs/RNG.md), with per-game domains: quick/craps r = keccak(pRev,hRev,sessionSeed,channelId,k), Engine V2 seed = keccak(…, k, keccak(gameId)), Live Crash per-round chains keccak(…, roundId, k)
Slot engine — Slot Engine V2 (5×4 ways, cascades, bonus): 8 games (Foundry, Lantern Tide, Quarry, Vault, Sugar Rush, Pharaoh's Book, Sakura 777, Olympus Thunder) on EngineV2RulesVerifier-v3 0x5d60…C1B1 — hybrid class: seed/money/commitment verified on-chain, evaluation off-chain by both parties under a registered engineHash
Quick games — dice · 3-reel slots (5 tables) · roulette · basketball in one QuickGamesVerifier 0xa974…9C035, math byte-copied from the legacy per-tx contracts
Live Crash — CrashRulesVerifier 0x9aE6…a385, interleaved two-party ticks, decision-before-reveal cash-out, per-round chains
Step games — Penaldo + Counter Attack (StepGamesVerifier 0xC03e…4012)
Craps — CrapsRulesVerifier (61-word payload, fair-value contract bets), mux 9
Markets rain-sdk-v2 prediction markets passthrough Outperform / CryptoRace pari-mutuel primitive: linear bonding curve, 10 % early-entrant dividend, 5 % rake split 40/10/50, rollover, void; v1.1 live with OffchainOracleAdapter (house-signed EIP-712 prices), v1 Pyth adapter retained
White-label MAY casino as the reference FE white-label backend program: brand config, revshare, self-serve wizard (docs/whitelabel/* in the Playmarket repo); token-agnostic deployments registry in the SDK
Fairness UX fairness panel in MAY uniform fairness object across games (FORMULAS), tools/engine-v2-audit.mjs (540/540 live rounds recomputed OK)

SDK changes

  • New monorepo sdk-v2/ (npm workspaces, TS, ESM + CJS, ethers@^6.13 peer). Five packages: @rain/rng-core, @rain/rng-session, @rain/games, @rain/channels, @rain/markets.
  • @rain/rng-core — zero dependencies, own keccak; test vectors generated from the live FE engines; live cross-check of EngineV2RulesVerifier.seedOf and SessionSeedCommitReveal events; badge() for the attribution term.
  • @rain/rng-session — the RNG ceremony without a chain; RngAnchor.sol (not deployed) + zero-dep adapter; examples/agent-dice.
  • @rain/games — vendored rules modules with sha256 manifest; Engine V2 per-game bundle dispatch identical to the FE/house node; engineHash live check; ADDING-A-GAME.md.
  • @rain/channels — replaces rain.games + rain.core of v1: AA login helpers, ChannelSession (open/restore/act()/closes) over the live client class, centralised shouldAdopt() rules (never adopt an unverified house reveal; never adopt a settle without local recompute), heldBet force-close fallback, fraud-proof preflight, watchtower, deployments registry with Sourcify links.
  • @rain/markets — replaces rain.predictions: CryptoRace instead of the rain-sdk-v2 passthrough (that dependency is dropped).
  • Dropped from v2: rain.vaults read layer (RiskVault/HouseBond limits derivation) and the MAY blackjack/roulette/baccarat client — both remain in sdk/ 0.1.0 unchanged. Can be re-added as @rain/vaults / @rain/games-may if wanted.
  • Licence: MIT + attribution condition ("Powered by RAIN RNG") for the RNG packages — see LICENSE.

Known gaps (tracked in README § Gaps)

No external audit · house node not operator-runnable from the SDK · Engine V2 hybrid trust · CryptoRace v1.1 oracle house-signed · admin keys pre-audit · craps act() not e2e-tested · MAY games not vendored.

0.1.0 — 2026-07-29 · @rain/risk-markets-sdk (private)

Unified SDK: rain.games (blackjack + roulette channels on RUSD demo), rain.predictions (rain-sdk-v2@2.1.3 passthrough), rain.vaults (limits derivation), rain.core (deployment registry). See sdk/README.md.

← Back to the package index · Rendered 2026-09-14 09:34 UTC from the repository copy; the markdown in the zip / repo is the document of record.