Coin Flip

web-based coinflip gambling app, needs to be 18+ to enter with self

Coin Flip

Created At

ETHGlobal Cannes

Project Description

Project Overview This is a web-based gambling application that demonstrates how to integrate Self Protocol's zero-knowledge proof system for age verification before allowing users to access age-restricted content. The project showcases a practical implementation of privacy-preserving identity verification in a real-world application.

What It Does Core Functionality Age-Gated Access: Users must prove they are 18+ years old before accessing the coinflip game Privacy-Preserving Verification: Uses Self Protocol's ZK proofs to verify age without revealing actual birth date or personal information Simple Gambling Game: A basic coinflip (heads/tails) game that serves as the age-restricted content User Experience Flow User visits the web application Clicks "Verify Identity" button A QR code appears on screen User scans QR code with the Self mobile app User completes age verification in Self app (using mock passport for testing) Upon successful verification, the coinflip game unlocks User can play heads/tails gambling game

How it's Made

Technical Architecture Frontend (React + TypeScript) Framework: React 19 with TypeScript Build Tool: Vite for fast development Self Protocol Integration: Uses @selfxyz/qrcode and @selfxyz/core packages State Management: React hooks for managing verification state Error Handling: React Error Boundary to catch and display errors gracefully Backend (Node.js + Express) Server: Express.js running on port 3001 Self Protocol Backend: Uses SelfBackendVerifier for off-chain verification Mock Passport Support: Configured for testing with mock passports CORS: Enabled for cross-origin requests from frontend

Key Technical Features

  1. Off-Chain Verification No Blockchain Required: Uses Self Protocol's off-chain verification system Mock Passport Support: Can test with mock passports for development Local Backend: Verification happens on local Express server
  2. Privacy-Preserving Identity Zero-Knowledge Proofs: User proves they're 18+ without revealing actual age No Personal Data Storage: Application never sees or stores birth dates Cryptographic Verification: Age verification is mathematically proven
  3. User Session Management UUID Generation: Each user gets a unique session ID State Persistence: Verification status maintained during session Error Recovery: Graceful error handling with retry mechanisms
  4. Development-Friendly Hot Reload: Vite provides instant development feedback Error Boundaries: Clear error messages instead of blank screens Mock Support: Easy testing with mock passports Self Protocol Integration Details Frontend Integration QR Code Generation: SelfQRcodeWrapper component displays verification QR code Event Handling: Listens for verification success/failure events Configuration: Uses SelfAppBuilder to configure verification requirements Backend Integration Verification Endpoint: /api/verify handles verification requests Proof Validation: SelfBackendVerifier validates ZK proofs Mock Mode: Supports mock passport verification for testing Verification Process Frontend generates QR code with verification requirements User scans QR code with Self mobile app Self app generates ZK proof of age verification Proof sent to backend /api/verify endpoint Backend validates proof using Self Protocol SDK Frontend receives verification result and unlocks game Use Cases & Applications Primary Use Case Age-Restricted Gambling: Demonstrates how to implement age gates for gambling applications Privacy Compliance: Shows how to meet age verification requirements without collecting personal data Extended Applications Adult Content Platforms: Age verification for adult websites Alcohol/Tobacco Sales: Age verification for restricted product sales Financial Services: Age verification for financial products Gaming Platforms: Age verification for mature-rated games
background image mobile

Join the mailing list

Get the latest news and updates