Architecture
System Overview
┌─────────────────────────┐
│ Operator Casino │
│ ┌───────────────────┐ │
│ │ Player Wallet │ │
│ └────────┬──────────┘ │
└───────────┼──────────────┘
│ Seamless Wallet API
│ (HMAC-SHA256 signed)
┌───────────┼──────────────┐
│ Velo RGS │
│ ┌────────┴──────────┐ │
│ │ Round Manager │ │
│ │ ┌────────────┐ │ │
│ │ │ Pricing │ │ │
│ │ │ Engine │ │ │
│ │ │ (BS+Cal) │ │ │
│ │ └────────────┘ │ │
│ └───────────────────┘ │
└───────────┬──────────────┘
│
┌───────────────────┼───────────────────┐
│ │ │
┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐
│ Binance WS │ │ Chainlink │ │ BigQuery │
│ (Live Prices)│ │ (Settlement) │ │ (Audit Log) │
└───────────────┘ └───────────────┘ └───────────────┘Components
Velo RGS (Remote Game Server)
The core game server, built in Rust with the Axum framework and Tokio async runtime.
| Component | Technology | Purpose |
|---|---|---|
| HTTP/gRPC Server | Axum + tonic | API endpoints and game communication |
| Pricing Engine | Custom Rust | Black-Scholes + isotonic calibration pipeline |
| Round Manager | Tokio tasks | Round lifecycle (start → active → locked → settled) |
| Oracle Client | WebSocket | Real-time price feeds from Binance |
| Settlement | Pyth Network | Decentralized settlement with on-chain proof |
| Wallet Provider | velo-wallet crate | Abstraction layer for all money operations |
Wallet Integration
The RGS uses a WalletProvider trait that abstracts all balance operations. Two implementations ship out of the box:
| Mode | Implementation | When Used |
|---|---|---|
| Demo | DemoWallet | Development/demo — operates against local demo_players DB table |
| B2B Production | SeamlessWalletClient | Live — sends HMAC-signed HTTP requests to your wallet API |
Both implementations write every transaction to the wallet_transactions audit table for GLI-19 compliant reconciliation. The mode is selected automatically:
OPERATOR_WALLET_URLset → SeamlessWalletClient (B2B mode)- Otherwise → DemoWallet (demo mode)
Pricing Pipeline
Each price tick flows through this pipeline:
- Volatility Estimation — 360-candle rolling window, 10s subsampling
- Black-Scholes — Base probability calculation
- Drifted Brownian Bridge — Path-conditioned probability adjustment
- Isotonic Calibration — Smoothed probability mapping
- Trend Persistence — Momentum-conditioned adjustment
- Vig Application — 5-10% house edge, probability-scaled
Round Lifecycle
WAITING ──► ACTIVE ──► LOCKED ──► SETTLING ──► SETTLED
(3s) (4m50s) (10s) (<1s) (3s)
│ │
│ Bets accepted │ Chainlink
│ Odds updating │ settlement- Active: Bets accepted, odds update every tick
- Locked (buffer zone): Last 10 seconds, no new bets
- Settling: Chainlink price fetched and verified
- Settled: Results published, wallet credits/debits executed
Infrastructure
Hosted on Google Cloud Platform:
| Service | GCP Component | Purpose |
|---|---|---|
| Compute | Cloud Run | Auto-scaling containers, warm instances |
| Database | Cloud SQL (PostgreSQL) | Transaction history, round records |
| Cache | Memorystore (Redis) | Real-time round state, session data |
| Analytics | BigQuery | Audit trail, long-term analytics |
| Security | Cloud Armor + VPC | DDoS protection, network isolation |