Games. Markets. Insurance. One protocol, one RNG.
Every card, spin, reel and crash multiplier on the protocol is keccak256(pRev, hRev, sessionSeed, channelId, k) — one secret from the player, one from the house, both committed on-chain before play, both revealed per round. Random if either party is honest. No VRF, no oracle, no randomness provider to trust, bribe or censor. It is the most adversarial consumer of randomness there is — a casino — and it runs on it in production on two live deployments.
Two reference deployments, both on Arbitrum One, both play-money, both pre-audit: maycasino.xyz (#1 — 13 table games, ChannelManager V4) and playmarkets.bet (#2 — Engine V2 slots, Craps, Live Crash, Outperform markets, ChannelManagerAA smart accounts). Contract addresses are in the table below.
At login the house commits houseSeedCommit = keccak256(houseSeed) before seeing the player's seed; the player's EIP-712 OpenChannel signature binds both playerSeed and that commit. Both parties also publish the root of a 4,096-deep hash chain. Everything is on-chain in the open transaction.
The contract checks the commit, then fixes sessionSeed = keccak256(houseSeed, playerSeed, channelId) and emits SessionSeedCommitReveal — the public fairness anchor for the whole session. One transaction; the channel is Active in the same block.
Round k: the player signs the bet together with pRev_k (next chain preimage); the house answers hRev_k + countersignature. r = keccak256(pRev, hRev, sessionSeed, channelId, k); the game maps r to an outcome (% 37, % 52, % 100 + 1, or a full slot engine seeded by r). Bet before randomness, always.
import { outcome, verifyRound } from '@rain/rng-core';
const r = outcome({ pRev, hRev, sessionSeed, channelId, k }); // uint256 — same keccak as the verifiers
const ok = verifyRound({ pRev, hRev, sessionSeed, channelId, k, hAnchor, claimed: r }); // true ⇔ VERIFIED
console.log(r % 37n, ok); // e.g. roulette number, and whether the house told the truth
Package @rain/rng-core 2.1 — MIT + attribution (“Powered by RAIN RNG”). npm: ready, unpublished; source on the sdk-v2 mirror branch ↗. Integrator guide →
13 table games (maycasino) + 8 Engine V2 slots + Craps + Live Crash (playmarkets) — one channel per login, all games inside it, zero gas, email login via smart accounts (ERC-1271, Alchemy gas-sponsored, session key as validation entity → zero wallet popups). Every action is an off-chain dual-signed state; two on-chain transactions per session. Vertical → · Games →
Risk traded for profit. The Rain prediction-markets side runs permissionless markets with an order book, liquidity, split/merge, and an AI + dispute + appeal resolution layer — the protocol's oracle for world events — shipped as rain-sdk-v2. Vertical →
Risk sold away as protection. A parametric cover is a prediction-market position bought as protection: flight delayed, rainfall > X, price < Y — resolved on public data, underwritten by vault capacity, paid instantly. Personal/individual insurance: roadmap, Stage 2. Vertical →
5-minute pari-mutuel “which asset outperforms” markets on BTC / ETH / SOL / BNB: buy shares of the coin you think moves most, price-curve dividends flow to earlier holders, rounds are keeper-settled on-chain (CryptoRace 0x340991442B5BFCD80a46D709748be28b788414B7). Honest scope: settlement prices come from a house-signed off-chain oracle v1 (median of OKX + Bybit REST tickers, EIP-712-attested through OffchainOracleAdapter 0x47b33BbE635682E7164f0A4f33D02e25592D006e) — not provably fair yet; the house can't cherry-pick prices late (60-s deadline, else the round voids and refunds), but it can choose not to settle. The Pyth path is planned (adapter deployed, re-enabled via 48-h timelock). Trade it live ↗
RAIN RNG is a core protocol capability, not a casino side-effect: oracle-free since v2.6.0, unbiased if either party is honest, with on-chain fraud proofs (proveBadTransition) and a bonded house. Use it without the casino — integrator personas: casinos wanting only the RNG, AI-agent builders, game studios. Research →
The ChannelManager takes the settlement token and vault as constructor parameters. Deployment #1 settles in RUSD, deployment #2 in USDTTT — both play-money, both just instances. Any operator can run a USDC/USDT instance; limits, bonds and the fee waterfall follow. Deployment config →
Position limits are a pure, public function of vault TVL — not a negotiation. At the design target of $300M TVL the protocol underwrites $600,000 even-money positions. Three exposure rules bound the book mathematically. Whitepaper §3 · see the math run live.
You bring brand, players and marketing; the platform holds liquidity, house node, games and RNG. A brand is a config layer (brand.json: identity, palette, promos, game list, legal, admin) generated by a 6-step wizard, applied for via the self-serve portal at playmarkets.bet/partners (free hosted URL · platform subdomain · your own domain), and operated from a multi-brand back-office (brands list, approve, deploy progress, redeploy, monthly rev-share statement — tiers 25 / 30 / 35 % of NGR by monthly GGR, 3-month soft negative carryover). Reference brand #1: maycasino.xyz (wizard at /create.html, on-chain claimBrand revenue via FeeSplitter). RTP and game math are untouchable by the brand.
Take the layers you need: @rain/rng-core (just the randomness + verifier), @rain/rng-session (hash chains, commit-reveal, EIP-712), @rain/channels (open / act / close / dispute against ChannelManager), @rain/games (rules engines mirroring the on-chain verifiers), @rain/markets (pari-mutuel Outperform + rain-sdk-v2 wrapper). Run your own token instance, your own house node, your own bond. SDK layering →
Honest scope: white-label and SDK both run on play-money deployments today (RUSD on #1, USDTTT on #2), pre-audit. Real-money operation requires the external audit and the licensing steps listed in the audit package — that is the claim, nothing more.
| CONTRACT | ADDRESS | STATUS |
|---|---|---|
| ChannelManagerAA (ERC-1271 smart-account channels, session-key validation, Alchemy gas-sponsored) | 0x60743006c2a5Dd5b9907CA37e7381854ff860959 | Sourcify exact_match ✅ · Sourcify |
| EngineV2RulesVerifier (8 Engine V2 slot games, engine-hash committed per game) | 0x5d6048AB261e6151AB44fE6053e7AEb35Cb5C1B1 | Sourcify exact_match ✅ · Sourcify |
| GameMuxVerifier9 (current mux — one verifier for all games in the channel; mux8 ranges + craps 224–254; supersedes GameMuxVerifier8 0xb72B…1b25 which stays for old disputes) | 0xDf214594D021a36bD61aB398c20c4A14cDD0b48e | Sourcify exact_match ✅ · Sourcify |
| HouseBond (operator bond; slashable on liveness fault) | 0x3D2d25373836C9d102E83f4200e87d087B29b998 | Sourcify exact_match ✅ · Sourcify |
| USDTTT (settlement token — play-money, 6 decimals) | 0x528F42C8560BBDa048690fB0982B07A9Ae52551A | Sourcify exact_match ✅ · Sourcify |
| CryptoRace v1.1 (Outperform — 5-min pari-mutuel markets) | 0x340991442B5BFCD80a46D709748be28b788414B7 | Sourcify exact_match ✅ · Sourcify |
| OffchainOracleAdapter v1 (house-signed EIP-712 price attestations — not provably fair) | 0x47b33BbE635682E7164f0A4f33D02e25592D006e | Sourcify exact_match ✅ · Sourcify |
| CONTRACT | ADDRESS | STATUS |
|---|---|---|
| ChannelManager V4 (active — oracle-free session seed) | 0xD8a856BD76ad773875dcF9EA8c9255A3805e678a | Sourcify exact_match ✅ · Sourcify |
| ChannelManager V3 (legacy — Pyth-seed era, superseded) | 0xe13DC056111906aA4d3659880EBDC67138c76DA7 | Sourcify exact_match ✅ · Sourcify |
| GameMuxVerifier (manager's verifier) | 0x14155583112F87777B95AB0EA76786bf079c6A83 | Sourcify exact_match ✅ · Sourcify |
| GameMuxVerifier3 (routes all 13 games) | 0x5289cbE7F668362ee648e0a9d3026A6c9FE93fa5 | Deployed · Arbiscan |
| BaccaratRulesVerifier | 0x1c3cF9D0f5757F420C06d64b28612Cca3A3E57fD | Deployed · Arbiscan |
| BlackjackRulesVerifier | 0xFdcCE2DE2F8A28cBBdBaB01131C3bab138Eb9293 | Sourcify exact_match ✅ · Sourcify |
| RouletteRulesVerifier | 0x5239969ff32e5733F319d3e80eD64D19adF4962f | Sourcify exact_match ✅ · Sourcify |
| HouseBond (2×100k RUSD operator bonds) | 0x37E41E1d1EE2F96cE0203af06d639448547ade84 | Sourcify exact_match ✅ · Sourcify |
| RUSD (demo token, 6 decimals) | 0x260c7019E760763988843Bc5b873d749b5937469 | Play-money faucet token |
Deployment #1 max position is 3,125 RUSD, bond-limited (design target at $300M TVL: $520k–600k): the exposure engine clamps the table limit by the smallest of float-derived cap (1733 ppm of vault float), operator bond headroom (slashable/32) and operator liquidity; today the 100k RUSD bond binds. Raising bonds raises the limit automatically — no redeploy. Derivation in DEPLOYMENT.md.
Two on-chain transactions per session; every position in between is an off-chain dual-signed EIP-712 state. On-chain close enforces the last dual-signed state even if the counterparty vanishes: forceClose → finalizeClose (and reclaimStale for abandoned channels) is the self-custody guarantee. Architecture.
Every game has an on-chain IRulesVerifier — a pure referee. proveBadTransition slashes whoever signed an illegal state; a house liveness fault voids the stake and pays the player max(2× gross at risk, floor) from HouseBond. Channels spec.
One login → one channel → every game inside it, one bankroll, no reopen friction (#2: email login through an ERC-1271 smart account with a session key as validation entity, gas sponsored — no wallet popups, no gas). CASH OUT ALL settles the whole session in one on-chain close.
A Position is {stake, distribution, payoutTable, spread}. The engine is product-agnostic and distribution-aware: a blackjack hand, a slot spin, a 5-minute outperformance market, a flight-delay index — the protocol knows only distributions, payout tables and spreads. Listing is decided by math: Σ(pᵢ·payoutᵢ) ≤ 1 − 1.25% and the exposure profile must be computable.
Base spread 1.25%, decomposed on-chain: 0.15% protocol fee → RAIN buyback & burn · 0.25% distribution · ~0.17% trader rebates · 0.05% Anchor Reserve standby · ~0.63% residual to the risk vault. Brands add 0–2.5% markup, disclosed on-chain.
reclaimStale designed in as a consequence.forge coverage unobtainable under via_ir; Outperform's oracle is house-signed (v1); no external audit yet.