Game catalog, live games protocol & reference casinos
BetPlug ships a continuously expanding catalog of provably-fair house games across five runtime shapes (/api/openapi.yaml, /api/): Instant games, Stateful Session games, Originals Slots, shared Live Shows, and per-operator Live Tables. Every game below is mounted and served by the BetPlug API across sandbox and live, executing deterministic fixed-point integer arithmetic with zero floats on money or outcomes.
1. Full game catalog & runtime matrix#
Instant games (single-request settle)#
Every Instant game settles in one round-trip (POST /v1/rounds headless or POST /v1/ embedded) and ships a zero-raster SVG + TypeScript <betrail-game> client bundle (<= 150 KB gzip) as @betrail/:
GameSlug | Engine ID & version | Client bundle | RNG stream, params & availability |
|---|---|---|---|
dice | DICE v1 | @betrail/ | dice-sha512 (SHA-512(server_); DiceParams (direction, chance, payout); mounted in the BetPlug API |
limbo | LIMBO v1 | @betrail/ | hmac-nonce (HMAC-SHA256(server_, no :cursor, 12-dec bcdiv byte sum S); LimboParams (target); mounted in the BetPlug API |
plinko | PLINKO v1 | @betrail/ | plinko-hmac (HMAC-SHA256(server_, c = 0 for 8 pins / c = 0, 1 for 9..16 pins); 27 pinned Binomial paytables (8..16 pins x LOW/MEDIUM/HIGH); PlinkoParams; mounted in the BetPlug API |
roulette | ROULETTE v1 | @betrail/ | hmac-nonce (HMAC-SHA256(server_, no :cursor, 12-dec bcdiv byte sum S); single-zero 37-pocket wheel; RouletteParams (chips); mounted in the BetPlug API |
diamonds | DIAMONDS v1 | @betrail/ | hmac-nonce (HMAC-SHA256(server_, no :cursor, 12-dec bcdiv byte sum S); 5-gem draw across 7 hands; DiamondsParams ({}); mounted in the BetPlug API |
packs | PACKS v1 | @betrail/ | FairRandom; 5-card booster pack over 242-card table (RTP = 19/20); PacksParams ({}); mounted in the BetPlug API |
range-dice | RANGEDICE v1 | @betrail/ | FairRandom; configurable [low, high] interval; RangediceParams (mode, target/ranges, multiplier); mounted in the BetPlug API |
wheel | WHEEL v1 | @betrail/ | FairRandom; risk-tiered segment paytables; WheelParams (risk, segments); mounted in the BetPlug API |
drill | DRILL v1 | @betrail/ | FairRandom; multi-target depth multiplier; DrillParams (target, pick); mounted in the BetPlug API |
slide | SLIDE v1 | @betrail/ | FairRandom; target crash-multiplier reel; SlideParams (target); mounted in the BetPlug API |
cases | CASES v1 | @betrail/ | FairRandom; weighted mystery-case paytables; CasesParams (difficulty); mounted in the BetPlug API |
bars | BARS v1 | @betrail/ | FairRandom; multi-bar reveal grid; BarsParams (difficulty, picks); mounted in the BetPlug API |
keno | KENO v1 | @betrail/ | FairRandom; Fisher-Yates 10-of-40 draw (1..10 picks); KenoParams (risk, picks); mounted in the BetPlug API |
darts | DARTS v1 | @betrail/ | FairRandom; radial board ring paytables; DartsParams (difficulty); mounted in the BetPlug API |
tarot | TAROT v1 | @betrail/ | FairRandom; 3-arcana multiplier product; TarotParams (difficulty); mounted in the BetPlug API |
baccarat | BACCARAT v1 | @betrail/ | FairRandom; Punto Banco third-card tableau (player / banker / tie + side bets); BaccaratParams (bets); mounted in the BetPlug API |
kaboom | KABOOM v1 | @betrail/ | FairRandom; instant minefield preset sweep (cap_rule: refuse); KaboomParams (charge, spot); mounted in the BetPlug API |
tilt | TILT v1 | @betrail/ | FairRandom; balance-beam multiplier (cap_rule: refuse); TiltParams (notch); mounted in the BetPlug API |
Stateful session games (multi-step open -> /actions)#
Stateful games debit stake once at POST /v1/rounds (or POST /v1/), advance deterministically via POST /v1/ (or /v1/) with monotonic step >= 1, block seed rotation while a round is open (409 round_open), and settle on cash-out, terminal loss, or POST /v1/. Player do: "force_close" is always refused (422 invalid_action).
GameSlug | Engine ID & version | Availability status | Mechanics & schemas |
|---|---|---|---|
chicken | CHICKEN v1 | Mounted in the BetPlug API (FairRandom) | Lane-stepping survival ladder (step, cashout) — ChickenParams / ChickenAction |
pump | PUMP v1 | Mounted in the BetPlug API (FairRandom) | Balloon inflation multiplier ladder (pump, cashout) — PumpParams / PumpAction |
mines | MINES v1 | Mounted in the BetPlug API (FairRandom) | 5x5 grid (1..24 mines; sweep, cashout; note preset (12, 11) returns 409 not_offered) — MinesParams / MinesAction |
towers | TOWERS v1 | Mounted in the BetPlug API (FairRandom) | Multi-floor climb across difficulty tiers (sweep, cashout) — TowersParams / TowersAction |
blackjack | BLACKJACK v1 | Mounted in the BetPlug API (FairRandom) | Infinite shoe (hit, stand, double, split, insurance, no_insurance) — BlackjackParams / BlackjackAction |
hilo | HILO v1 | Mounted in the BetPlug API (FairRandom) | Sequential card higher/lower/skip chain (guess, skip, cashout) — HiloParams / HiloAction |
snakes | SNAKES v1 | Mounted in the BetPlug API (FairRandom) | Dice-driven board path with snake hazards (roll, cashout) — SnakesParams / SnakesAction |
flip | FLIP v1 | Mounted in the BetPlug API (FairRandom) | Compounding coin-flip streak (flip, cashout) — FlipParams / FlipAction |
rps | RPS v1 | Mounted in the BetPlug API (FairRandom) | Multi-step rock-paper-scissors streak (throw, cashout) — RpsParams / RpsAction |
moles | MOLES v1 | Mounted in the BetPlug API (FairRandom) | Whack-a-mole grid survival ladder (hit, cashout) — MolesParams / MolesAction |
video-poker | VIDEOPOKER v1 | Mounted in the BetPlug API (FairRandom) | 5-card draw + hold (Jacks or Better; draw) — VideopokerParams / VideopokerAction |
sky-rush | SKYRUSH v1 | Mounted in the BetPlug API (FairRandom, cap_rule: refuse) | Step-by-step altitude cash-out (fly, cashout) — SkyrushParams / SkyrushAction |
dead-shot | DEADSHOT v1 | Mounted in the BetPlug API (FairRandom, cap_rule: refuse) | Chamber cylinder survival (fire, stop) — DeadshotParams / DeadshotAction |
meme-kombat | KOMBAT v1 | Mounted in the BetPlug API (FairRandom, cap_rule: refuse) | Single-player fighter duel (next, live_bet) — KombatParams / KombatAction |
stack-packs | STACKPACKS v1 | Mounted in the BetPlug API (FairRandom, cap_rule: refuse) | Progressive pack-stacking session (draw, cashout) — StackpacksParams / StackpacksAction |
Originals slots (single-nonce spin + bonus rounds)#
Each Originals Slot runs on OriginalsSlotEngine, consuming a single (server_seed, client_seed, nonce) commitment per paid spin (including triggered cascades and free-spin bonus rounds):
GameSlug | Engine ID & version | Client package | Bundle asset path |
|---|---|---|---|
grimoire-of-gains | GRIMOIRE v1 | @betrail/ | /games/ |
pharaoh-pump | PHARAOH v1 | @betrail/ | /games/ |
shogun-shiba | SHOGUN v1 | @betrail/ | /games/ |
All three are mounted in the BetPlug API (FairRandom): params is {} (SlotParams), and the settled view is SlotView.
Tip: New sandbox brands enable the full catalog automatically on onboarding. Existing brands can enable additional games anytime in Console or via
PUT /console/(a disabled brand game returnsbrands/ {brand}/ games/ {environment} 409 not_offered).
Live multiplayer shows & tables#
GameSlug | Engine ID & version | Topology | Money entry route (REST) | Socket commands (receiveLiveCommand) | Isolation & policy |
|---|---|---|---|---|---|
trapdoor | TRAPDOOR v1 (ShowEngine) | Shared environment show | POST /v1/ (createLiveBet) | TrapdoorCommand (snapshot, pick, bank, plan) | Zero cross-operator crowd figures |
kombat-multiplayer | KOMBATMP v1 (ShowEngine) | Shared environment show | POST /v1/ (createLiveBet) | KombatmpCommand (snapshot) | Zero cross-operator crowd figures |
crash | CRASH v1 (ShowEngine) | Shared environment show | POST /v1/ (createLiveBet) | CrashCommand (snapshot, cashout) | Zero cross-operator crowd figures |
meme-trade | MEME_TRADE v2 (ShowEngine) | Shared environment show | POST /v1/ (createMemeTradeBuyIn) | LiveCommand (snapshot, open, close, sidebet, auto_sell) | Enabled in sandbox & live; position adds refused; mid-round force-close retired; OutageVoid refunds open buy-ins; zero crowd figures |
stack-o-pass | STACKOPASS v1 (Engine live tables) | Per-operator 6-seat lobbies | POST /v1/ (live_seat: { table, seat }) | StackOPassCommand (snapshot, watch, open, pass, cashout, leave) | Per-operator tables; per-player FairRandom seeds |
2. Live games protocol & WebSocket state machine#
Live WebSocket channels, commands, and settlement frames are specified in /api/.
Warning: Live multiplayer games (
trapdoor,kombat-multiplayer,stack-o-pass,crash,meme-trade) always require a real player session backed by a seamless wallet (mode: "real"). Demo sessions are refused on live tickets and live bets with403.
Live WebSocket state machine#
[1] POST /v1/launch (mode:"real") -> [2] POST /v1/sessions (bts_<token>)
|
v
[3] POST /v1/live/{game}/tickets (0-byte body, Idempotency-Key) -> 30 s single-use ticket
|
v
[4] WS wss://live.betrail.example/v1/live/{game} [Sec-WebSocket-Protocol: betrail.v1, ticket.<ticket>]
|
+-----------------------------------------+-----------------------------------------+
| | |
v v v
SNAPSHOT (seq: 1) ---> WAITING (lobby) ---> ACTIVE (ticks / commands) ---> SETTLED (LiveSettledFrame)
(or on seq gap: (stakes enter (crash cashout, trapdoor + seed revealed / skipped_link
send snapshot cmd) via REST POST) pick/bank, meme-trade trades) + round.settled webhookConcrete live WebSocket frames (snapshot, tick, settled, skipped_link)#
Every server frame uses the LiveFrame envelope (type, game, seq, at, plus optional request_id and data). Below are schema-valid CrashFrame examples (CrashProjectedSnapshot, CrashTickFrame, CrashSettlement carrying CrashResultBeforeReveal) and a MemeTradeFrame MemeTradeSkippedLink broadcast from /api/:
{
"type": "snapshot",
"game": "crash",
"seq": 1,
"at": 1793238301300,
"data": {
"show": {
"type": "snapshot",
"show": {
"type": "lobby",
"chain": "crash-main-01",
"index": 1042,
"commit": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"salt": "00000000000000000001e3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4",
"salt_source": "bitcoin:870000",
"lobby_closes_at": 1793238300000
},
"phase": "ACTIVE",
"step": 14,
"tick": 13,
"multiplier": "1.08",
"elapsed_ms": 1300
},
"self_bets": [
{
"bet_id": "bet_01jbx7q2w3e4r5t6y7u8i9o0pa",
"currency": "BTC",
"stake": "0.00100000",
"settled": false
}
]
}
}{
"type": "tick",
"game": "crash",
"seq": 15,
"at": 1793238311600,
"data": {
"type": "tick",
"tick": 116,
"multiplier": "2.00",
"elapsed_ms": 11600
}
}{
"type": "settled",
"game": "crash",
"seq": 42,
"at": 1793238311650,
"data": {
"bet_id": "bet_01jbx7q2w3e4r5t6y7u8i9o0pa",
"currency": "BTC",
"stake": "0.00100000",
"payout": "0.00200000",
"refund": "0.00000000",
"settled_by": "play",
"view": {
"chain_id": "crash-main-01",
"round_index": 1042,
"ended_by": "CASHED_OUT",
"reason": "MANUAL",
"auto_cashout": null,
"cap_multiplier": "1001.00",
"settled_step": 117,
"at_tick": 116,
"elapsed_ms": 11600,
"multiplier": "2.00",
"seed_revealed_at_settle": false
}
}
}{
"type": "skipped_link",
"game": "meme-trade",
"seq": 43,
"at": 1793238320000,
"data": {
"type": "skipped_link",
"link": {
"chain": "mt-main-01",
"index": 1042,
"commit": "113459eb7bb31bddee85ade5230d6ad5d8b2fb52879e00a84ff6ae1067a210d3",
"salt": "00000000000000000001e3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4",
"salt_source": "bitcoin:870000"
},
"serverSeed": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
"tick": 1842
}
}Step-by-step handshake, betting & settlement details#
- Mint a
reallaunch credential (POST /v1/launch) and exchange it in the browser (POST /v1/sessions) forbts_<token>(kept strictly in closure memory). - Mint a 30-second single-use join ticket (
POST /v1/): Sendlive/ {game}/ tickets Authorization: Bearer bts_…, a freshIdempotency-Key, and a 0-byte empty body. Returns201 { ticket: "v1.<payload>.<mac>", url: "wss://live.. The live server verifies HMAC andbetrail. example/ v1/ live/ {game}", expires_at } Originfirst (nullrefused403 origin_not_allowed) and consumesjtilast so rejected handshakes do not burn the ticket. - Upgrade via
Sec-WebSocket-Protocol(joinTicketscheme): Connect withnew WebSocket(url, ["betrail.v1", "ticket." + ticket]). Access logs scrubSec-WebSocket-Protocolso tickets never leak; the server echoesbetrail.v1only. - Gap recovery: Every frame carries monotonic
seq. On any gap, send{ "type": "snapshot", "request_id": "req_01" }(LiveCommandrequires["type", "request_id"]withadditionalProperties: false). - REST money entry & outbox settlement:
- Shared shows (
trapdoor,kombat-multiplayer,crash): Stakes enter over REST viaPOST /v1/(live/ {game}/ bets { show, stake, params },Idempotency-Key), debiting<bet_and creditingid>:0:<attempt>:debit <bet_id>:crediton settlement. MEME_TRADEv2 (meme-trade): Buy in over REST viaPOST /v1/(live/ meme-trade/ buy-ins { round, amount },Idempotency-Key, debiting<show_). In-round commands (round_ id>:<player_ ref>:b<buyIn>:<attempt>:debit open,close,sidebet,auto_sell) travel over WebSocket under the tick barrier. Position adds are refused, mid-round force-close retired (POST /v1/returnsplayers/ {player_ref}/ force-close 200 {"rounds":[],without touching"pending":0} MEME_TRADE;PUT /v1/revokes live sessions immediately; post-rug outbox credits run unconditionally; writer outages refund open buy-ins viaplayers/ {player_ref}/ status OutageVoid).STACKOPASS(stack-o-pass): Buy into a per-operator 6-seat table viaPOST /v1/(session/ rounds { stake, params, live_seat: { table, seat } }), playopen/pass/cashoutover WebSocket, and settle per hand via<round_id>:credit.- Unified
LiveSettlement(LiveSettledFrame): Emits{ bet_id, currency, stake, payout, refund, settled_by: "play" | "force_close" | "outage", view }over the socket alongside the signedround.settledwebhook.
- Shared shows (
Demo and replay in the embedded live clients#
Live games ship embedded clients: crash, kombat-multiplayer, meme-trade, trapdoor and stack-o-pass (@betrail/). <betrail-game mode="demo"> for one of them needs no token and no session: it runs a simulated show in the browser (a simulated table for stack-o-pass) using a local seed chain (local seeds for stack-o-pass), the verifier's own maths, and a fake balance of 1000.00000000 DEMO. It opens no socket, mints no ticket, places no bet, and sends no record anywhere.
For these clients the element asks for no demo session: each client declares that its demo needs none, so the element sends no POST /v1/demo/sessions, on any origin. Nothing is refused, so the host bridge receives no error event, and the stack-o-pass cockpit displays only the simulated table's state. This behaves identically on an operator's origin and on BetPlug's (note that POST /v1/demo/sessions accepts only BetPlug's own site origins and returns 403 origin_not_allowed on an operator's origin; Instant, Stateful, and Slot games still use it in demo mode).
The stage and phase bar display a badge, and after each simulated bet settles, the client replays it locally in the browser, never a server record:
| Client | Badge | Demo verdict |
|---|---|---|
crash | DEMO (simulated show) | DEMO: the simulated bet replays from its revealed seed (no server record) |
kombat-multiplayer | DEMO (simulated show) | DEMO: the simulated bet replays from its revealed seed (no server record) |
meme-trade | DEMO (simulated show) | DEMO: the simulated round replays from its revealed seed (no server record) |
trapdoor | DEMO (simulated show) | DEMO: the simulated bean replays from its revealed seed (no server record) |
stack-o-pass | DEMO (simulated show) | DEMO: the simulated hand replays from its revealed seed (no server record) |
On an operator's origin, set mode="demo" with no token: POST /v1/launch with mode: "demo" for a live game returns 409 not_offered ("This live game has no demo play.").
<betrail-game mode="replay" token="..." round-id="..."> exchanges the launch token, reads one settled round record (GET /v1/), and replays it without opening a socket. A live show bet becomes readable once its show reveals its seed (404 before then), displaying VERIFIED MATCH (replay) with chain anchor unanchored. A stack-o-pass hand replays once the player's seed pair rotates.
Provable fairness & zero cross-operator crowd leakage#
- Reverse hash chains (
TRAPDOOR,KOMBATMP,CRASH,MEME_TRADE): Each shared show pre-commits the terminal digest of a reverseSHA-256hash chain (link_{k} = SHA256(link_{k+1})) combined with an external block beacon published before betting opens, disclosing unused links viaskipped_link. - Zero cross-operator crowd figures: Shared shows emit zero
round_totals, zero aggregate player counts, and zero cross-player bet frames so no operator can subtract its own share to infer competitors' volume.stack-o-passisolates tables strictly per operator.
3. Reference casinos (examples/)#
Three end-to-end reference casinos in the repository demonstrate headless REST play, <betrail-game> / iframe embedding, WalletHandler with Ed25519 answer signing, and raw-body webhook verification:
| Reference casino | Stack & SDK | Highlights |
|---|---|---|
./examples/ | Next.js + TypeScript (./sdk/ts) | Server-side BetrailClient, createWalletHandler with Ed25519 answers, raw-byte verifyWebhook, <betrail-game> + betrail:v1 host bridge, strict nonce CSP, zero raster assets. |
./examples/ | Go 1.27 net/http + html/template (./sdk/go) | Zero third-party dependencies, betrail.NewClient, betrail. (GenerateEd25519WalletKeyPair + FileBackedNonceStore), betrail. over r.RequestURI, SVG-only UI. |
./examples/ | PHP 8.2+ / Laravel-style (./sdk/php) | Betrail\Sdk\Client, WalletHandler (Ed25519:: + FileBackedWalletBook + FileBackedNonceStore), Webhooks::verify over raw php://input and $_SERVER['REQUEST_URI'], strict CSP iframe launch. |
Each reference casino mounts representative games (dice, packs, wheel) and ships an end-to-end local-stack integration test suite.
4. Building join-ticket protocols & handling live frames (runnable sample)#
import assert from "node:assert/strict";
import crypto from "node:crypto";
function buildLiveProtocols(ticket: string): [string, string] {
assert.match(ticket, /^v1\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/, "expected signed v1 join ticket");
return ["betrail.v1", `ticket.${ticket}`];
}
const protocols = buildLiveProtocols("v1.eyJzaWQiOiJzZXNzXzAxIn0.c2lnbmF0dXJl");
assert.deepEqual(protocols, ["betrail.v1", "ticket.v1.eyJzaWQiOiJzZXNzXzAxIn0.c2lnbmF0dXJl"]);
// Gap recovery commands carry "request_id" and CrashFrame settlements carry LiveFrame + CrashResultBeforeReveal
const snapshotCmd = { type: "snapshot", request_id: "req_01" } as const;
assert.deepEqual(Object.keys(snapshotCmd).sort(), ["request_id", "type"]);
const settledFrame = {
type: "settled" as const,
game: "crash" as const,
seq: 42,
at: 1793238311650,
data: {
bet_id: "bet_01jbx7q2w3e4r5t6y7u8i9o0pa",
currency: "BTC",
stake: "0.00100000",
payout: "0.00200000",
refund: "0.00000000",
settled_by: "play" as const,
view: {
chain_id: "crash-main-01",
round_index: 1042,
ended_by: "CASHED_OUT" as const,
reason: "MANUAL" as const,
auto_cashout: null,
cap_multiplier: "1001.00",
settled_step: 117,
at_tick: 116,
elapsed_ms: 11600,
multiplier: "2.00",
seed_revealed_at_settle: false as const,
},
},
};
assert.ok(["play", "force_close", "outage"].includes(settledFrame.data.settled_by));
assert.equal(settledFrame.data.view.elapsed_ms, settledFrame.data.view.at_tick * 100);
assert.equal(settledFrame.data.view.seed_revealed_at_settle, false);
// Verify MemeTradeSkippedLink commitment: sha256_hex(serverSeed) === link.commit
const skippedLink = {
type: "skipped_link" as const,
game: "meme-trade" as const,
seq: 43,
at: 1793238320000,
data: {
type: "skipped_link" as const,
link: {
chain: "mt-main-01",
index: 1042,
commit: "113459eb7bb31bddee85ade5230d6ad5d8b2fb52879e00a84ff6ae1067a210d3",
salt: "00000000000000000001e3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4",
salt_source: "bitcoin:870000",
},
serverSeed: "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
tick: 1842,
},
};
const computedCommit = crypto.createHash("sha256").update(skippedLink.data.serverSeed, "utf8").digest("hex");
assert.equal(computedCommit, skippedLink.data.link.commit);