All Projects
Contract Complete

Sui Blackjack

Provably fair on-chain blackjack with native randomness

MoveSui RandomnessVue 3TypeScript@mysten/sui

The Problem

Most blockchain games use off-chain randomness which can be manipulated. Players have no way to verify the game is fair.

The Solution

A fully on-chain blackjack game using Sui's native randomness module. Every shuffle and card draw is verifiable on-chain.

Key Features

  • Sui native randomness for provably fair shuffling
  • Treasury system with house edge management
  • 3:2 blackjack payout ratio
  • Split, double-down, and insurance mechanics
  • 389-line Move contract (clean, auditable)

Architecture

The Move contract manages game state, card deck, and treasury. Each game session creates a new randomness context. The frontend calls PTBs (Programmable Transaction Blocks) to play moves.

Challenges

  • Understanding Sui's randomness module semantics
  • Managing treasury funds safely with proper access control
  • Encoding card values efficiently in Move structs

Lessons Learned

  • Sui randomness is powerful but requires careful context management
  • Move's ownership model makes game state management elegant
  • On-chain games need careful gas optimization

Interested in this project or want to collaborate?

Get in Touch