A daily on-chain lottery app where users deposit a fixed amount of USDC to enter. One winner gets 99% of the prize pool. 1% goes to the platform. Target: high frequency, high engagement, simple mechanics.
- View current active pools:
$1,$10,$100 - See time/countdown to draw
- Show prize pool growing in real-time
- Call-to-action: “Buy Ticket”
- Select pool (amount tier)
- Buy 1 or multiple tickets (no limit)
- Connect wallet → Pay with USDC
- Show confirmation + entry number(s)
- Each pool has a fixed draw time (e.g., every 24 hours at 9 PM UTC)
- On-chain draw triggered by anyone (permissionless crank)
- Use VRF (Switchboard/Drand) or hash-based randomness
- 1 winner selected
- 99% sent to winner
- 1% sent to dev wallet
- Winners + prize amount shown
- History of past draws
- Button: “Buy for next draw”
- Tiered pools:
$1,$10,$100 - Store participants as array or Merkle root
- USDC transfer for each ticket
- Cap entries per pool (optional)
- Draw at fixed UTC time (via crank)
- VRF/random hash for fair winner
- Transfer prize: 99% to winner, 1% to platform
- Prevent duplicate entries in same TX
- Guard against flash loan attacks
- Audit randomness integrity
- Custom referral link per wallet
- If friend joins → referrer gets +1 ticket (or cashback)
- Enter 7 days in a row → 1 free ticket
- Weekly leaderboard (e.g., most entries = bonus)
- If < minimum participants → pool rolls over to next day
- Daily tweet with winner & prize
- Leaderboard for biggest wins
- 1% platform/dev fee from each pool
- Optional: % of rollover interest (if pooled in a yield vault)
- Wallet connect (Phantom, Solflare, etc.)
- Realtime pool stats
- Buy/confirm tickets
- Draw countdowns
- Winner announcement animation
- Referral tracking & link generation
- Unit tests: Ticketing, drawing, payout logic
- Integration tests: end-to-end simulation of user flow
- Testnet faucet for USDC mock
- Cron-based draw simulations
- Daily NFT for each entry
- Multi-winner days
- DAO voting for pool themes
Before setting up the project, ensure you have the following installed:
- Solana CLI - Command line interface for Solana blockchain
- Anchor Framework - Development framework for Solana programs
- Android Studio - IDE for Android development
- Java JDK - Required for Android development
- Node.js & npm - For package management
# Clone the repository
git clone https://github.com/vitwit/fortunex
# Navigate to project directory
cd <project-name>
# Install dependencies
npm install# Build the Anchor program
anchor build
# Generate a new Solana keypair
solana-keygen new
# Deploy the program to local testnet
anchor deploy
# Sync Anchor keys with Solana CLI
anchor keys sync
# Rebuild after key sync
anchor build
# Deploy again
anchor deploy# Run local Solana test validator
solana-test-validator# Set provider URL to local testnet
export ANCHOR_PROVIDER_URL=http://localhost:8899
# Set wallet path
export ANCHOR_WALLET=~/.config/solana/id.json# Run the client service
npx ts-node client/client.ts
# Run the crank service (in separate terminal)
npx ts-node crank/draw.ts# Navigate to frontend directory
cd frontend
# Install mobile app dependencies
npm installEdit the utils/constant.ts file with the following values:
export const PROGRAM_ID = new PublicKey(
'HD5X9GyjdqEMLyjP5QsLaKAweor6KQrcqCejf3NXwxpu'
);
export const RPC_URL = 'http://10.0.2.2:8899'; // Local testnet URL for Android emulator
export const AIRDROP_SERVICE_URL = 'http://10.0.2.2:3000'; // Client service URL- Open Android Studio
- Create a new virtual device (AVD)
- Start the emulator
- Connect Android phone via USB
- Enable USB debugging in Developer Options
- Ensure device is recognized by running
adb devices
# Start Metro bundler (in one terminal)
npm run start
# Build and run on Android (in another terminal)
npm run androidThe app will automatically install and launch on your connected device or emulator.
- Install the Phantom Wallet app from Google Play Store
- Create a new account or import an existing one
- Go to Settings → Developer Settings
- Enable Testnet Mode
- Open the FortuneX mobile app
- Click on the Connect Wallet button
- Connect your Phantom wallet when prompted
- Ensure you're on the testnet network
- Start using the application
Before performing any transactions, you'll need testnet SOL and test USDC tokens in your wallet:
- Open the FortuneX app
- Navigate to the Profile section
- Find the Airdrop options for SOL and USDC
- Request airdrop for both tokens
- Wait for the tokens to appear in your wallet
Once you have test tokens, you can:
- View Live Pools - Browse available lottery pools on the main screen
- Buy Pool Tickets - Purchase tickets for active lottery pools
- Cancel Ticket Purchase - Cancel your ticket purchases if needed
- Monitor Transactions - Track your ticket purchases and winnings
If you want to create a standalone APK file for installation:
# Navigate to android directory
cd android
# Build release APK
./gradlew assembleReleaseThe APK file will be generated at:
app/build/outputs/apk/release/app-release.apk
- Transfer the APK file to your mobile device
- Enable "Install from Unknown Sources" in device settings
- Open the APK file to install
# Install directly using ADB
adb install app/build/outputs/apk/release/app-release.apk- If you encounter connection issues, ensure all services are running on the correct ports
- For Android emulator, use
10.0.2.2instead oflocalhostto access host machine services - If you face issues connecting to the RPC using
10.0.2.2:8899, forward the port using ngrok or from VS Code and use that endpoint instead - Verify that the Solana test validator is running before starting the mobile app
- Check that environment variables are properly set in your terminal session
localhost:8899- Used when running services directly on host machine10.0.2.2:8899- Used by Android emulator to access host machine's localhost- Port
3000- Default port for the airdrop/client service