RISE Logo-Light

RISE Slots

Build a production-grade slot machine with instant VRF, gasless gameplay, and 3ms results

Introduction

In this tutorial, you'll build a fully onchain slot machine that showcases RISE's three most powerful features working together: Fast VRF for instant provably-fair randomness, Session Keys for gasless gameplay without popups, and Shreds for 3ms event streaming. This is a complete production-ready game with real token economics.

What You'll Build

A complete casino-style slot machine with:

  • Smart contracts: ERC20 game token + VRF-powered slot machine
  • Symbol-based win detection with weighted probabilities
  • Four payout tiers (15x to 500x)
  • Session keys for completely gasless, popup-free gameplay
  • Token faucet for broke players
  • Real-time event watching with results caching
  • Animated slot reels with instant VRF results
  • Full game economy (10 RCT per spin, tiered payouts)

Production Ready: Unlike many tutorials that just demo features, this is a complete game ready for real users. All RISE features (VRF, Session Keys, Shreds) work together seamlessly in production.

What You'll Learn

  • Building VRF consumer contracts with symbol mapping
  • Creating ERC20 tokens with game-specific features
  • Session key permissions for gasless gameplay
  • Ultra-fast event watching with Shreds WebSocket
  • Results caching pattern for sub-millisecond UX
  • P256 session key management in the browser
  • Token economics and payout calculations
  • Production patterns for onchain gaming

Game Flow

  1. Player connects wallet with RISE Wallet (passkey-based)
  2. Creates session key (one popup, grants 7-day permissions)
  3. Claims 1000 RCT tokens (one-time free claim)
  4. Player spins (10 RCT per spin, completely gasless via session key)
  5. VRF returns 3 random numbers in 3-5ms
  6. Contract maps numbers to symbols and checks for matches
  7. Payouts distributed instantly if player wins
  8. Events streamed via Shreds for real-time UI updates
  9. Faucet refills broke players with 1000 RCT

Why This Matters

Traditional VRF solutions take seconds to minutes. RISE's VRF delivers results in 3-5 milliseconds, and with Session Keys, players spin without any wallet popups. This tutorial shows you how to build the responsive, gasless UX that onchain gaming needs.

Game Mechanics

Symbol Probabilities (for triple match):

  • 🍒 Cherry (0-3): 6.4% chance → 15 RCT payout
  • 🍋 Lemon (4-6): 2.7% chance → 30 RCT payout
  • 💎 Diamond (7-8): 0.8% chance → 100 RCT payout
  • 9️⃣ Lucky 9 (9): 0.1% chance → 500 RCT payout

Economics:

  • Cost per spin: 10 RCT
  • House starts with 10M RCT bankroll
  • Expected return: ~31% (69% house edge)

Prerequisites

Before starting, make sure you have:

  • Node.js 18+ installed
  • Basic knowledge of Solidity and React
  • Foundry installed (getfoundry.sh)
  • Some testnet ETH (get from RISE Faucet)

This tutorial uses RISE Wallet for gasless transactions. No private keys in code - everything is passkey-based and secure.

Source Code

The complete source code for this project is available on GitHub: awesamarth/rise-slots