Multiplayer trivia + penalty kicks game on Avalanche. Host tournaments on a big screen while players compete from their phones β Kahoot-style with Web3 prizes.
Built for B2B events, conferences, and watch parties. The host projects the game; players join with a PIN code and compete for AVAX prizes.
- Host creates a tournament on desktop/projector, deposits AVAX as prize
- Players scan QR / enter PIN on their phones to join the lobby
- 5 trivia rounds β each with a question + penalty kick shootout
- Winner claims the prize via Passkey wallet (no seed phrase needed)
| Host Lobby | Player Game | Claim Prize |
|---|---|---|
![]() |
![]() |
![]() |
Replace with actual screenshots
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React 18, TypeScript |
| Styling | Tailwind CSS, CSS animations |
| 3D | React Three Fiber (penalty kicks) |
| Realtime | Supabase Realtime (game sync) |
| Database | Supabase (PostgreSQL) |
| Blockchain | Avalanche C-Chain (Fuji testnet) |
| Wallets | Thirdweb SDK + Passkey wallets |
| Smart Contract | Solidity 0.8.20 (Hardhat) |
βββββββββββββββββββ Supabase Realtime ββββββββββββββββββββ
β HOST (desktop) βββββββββββββββββββββββββββΊβ PLAYERS (mobile) β
β /host/* β status updates β /play/* β
ββββββββββ¬ββββββββββ ββββββββββ¬βββββββββββ
β β
β Thirdweb SDK β Passkey wallet
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Avalanche Fuji Testnet β
β LuckyGoalEscrow (prize deposit + claim) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Game flow: Host controls all phase transitions (question β penalty β results) via Supabase status updates. Players react in real-time. Answer evaluation is local for instant feedback; scores are submitted to the DB.
Penalty logic: Wrong trivia answer = 0% goal chance. Correct answer = random goalkeeper direction + 30% save chance if same direction picked.
LuckyGoalEscrow β deployed on Avalanche Fuji testnet
| Address | 0xd638D0f20B3b7a6FDaf6eba5753b05Ad1695012F |
| Network | Avalanche Fuji (Chain ID 43113) |
| Solidity | 0.8.20 |
| Source | src/contracts/LuckyGoalEscrow.sol |
Functions:
createTournament(code)β payable, deposits AVAX prizeclaimPrize(code, winner)β transfers prize to winner's walletgetTournament(code)β view tournament state
- Node.js 18+
- npm
Create .env.local:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_THIRDWEB_CLIENT_ID=your_thirdweb_client_id
NEXT_PUBLIC_ESCROW_CONTRACT=0xd638D0f20B3b7a6FDaf6eba5753b05Ad1695012F
DEPLOYER_PRIVATE_KEY=your_deployer_key # only for contract deploymentnpm install --legacy-peer-deps
npm run dev
--legacy-peer-depsis required because React Three Fiber v9 expects React 19, but the project uses React 18.
- Find your local IP:
ipconfig getifaddr en0(Mac) - Open on phone:
http://YOUR_IP:3000 - Both devices must be on same WiFi
npx hardhat run scripts/deploy.ts --network fujisrc/
βββ app/
β βββ host/ # Host screens (desktop/projector)
β β βββ page.tsx # Create tournament
β β βββ lobby/[code]/ # QR + waiting room
β β βββ game/[code]/ # Game flow (projector view)
β βββ play/ # Player screens (mobile)
β β βββ page.tsx # Enter PIN
β β βββ join/[code]/ # Choose avatar + nickname
β β βββ lobby/[code]/ # Waiting room
β β βββ game/[code]/ # Game flow (mobile view)
β βββ claim/[code]/ # Winner claims prize
βββ lib/
β βββ gameLogic.ts # Supabase CRUD operations
β βββ escrow.ts # Thirdweb contract helpers
β βββ questions.ts # 20 trivia questions
β βββ thirdweb.ts # Thirdweb client config
βββ hooks/
β βββ useGameSync.ts # Supabase Realtime subscription
β βββ useCountdown.ts # Timer hook
βββ components/
β βββ PenaltyScene.tsx # React Three Fiber 3D scene
βββ contracts/
β βββ LuckyGoalEscrow.sol
βββ types/
βββ game.ts # TypeScript interfaces
MIT



