Skip to main content

Private Raffle

A confidential raffle system on Solana where participants submit encrypted guesses, and winners are determined through encrypted comparisons — no one can see the winning number or anyone’s guess until results are revealed.

How It Works

The raffle follows a simple “guess the number” game:
  1. Authority creates a raffle with a ticket price
  2. Players buy tickets with encrypted guesses (1-100)
  3. Authority draws by setting an encrypted winning number
  4. Players check if their guess matches (encrypted comparison)
  5. Winners claim their prize through on-chain verification

Privacy Guarantees

DataVisibility
Player’s guessOnly the player can see
Winning numberOnly authority knows
Win/loss resultOnly the ticket owner sees
Prize amountOnly the winner sees
Ticket purchasePublic (on-chain transaction)

Key Features

  • Encrypted Guesses: Players submit encrypted numbers, hidden from everyone
  • Encrypted Drawing: The winning number is never revealed on-chain
  • Private Results: Only ticket owners can see if they won
  • On-chain Verification: Winners prove their prize amount with Ed25519 signatures
  • Trustless Payout: Prize transfers are verified and executed on-chain

Setup

Project configuration and dependencies

Program

Raffle program instructions and accounts

Client Integration

TypeScript usage and testing

Quick Example

Source Code