A production-ready React/Next.js frontend for a Private Prediction Market powered by Fhenix CoFHE on Ethereum Sepolia testnet.
✨ Encrypted Voting - All votes are encrypted using FHE (Fully Homomorphic Encryption) until results are revealed 🔐 Privacy First - Orange-red gradient theme with lock/shield icons emphasizing encryption 📊 Real-time Markets - Browse active prediction markets with live countdown timers 💳 Wallet Integration - Connect MetaMask or any injected wallet provider 🌐 Multi-Chain - Supports Ethereum Sepolia and Arbitrum Sepolia 📱 Responsive Design - Mobile-friendly interface with loading states and error handling
To enable admin features (create and resolve predictions), set your wallet address in .env.local:
# .env.local
NEXT_PUBLIC_OWNER_ADDRESS=0x742d35Cc6634C0532925a3b844Bc9e7595f82bF0Replace with your actual wallet address.
npm install
# or
yarn installnpm run dev
# or
yarn devOpen http://localhost:3000 to view the app.
- Address:
0x2ec0aAAc3b6845f1bA5CE5F923301Ec00A4eA296 - Network: Ethereum Sepolia (chainId: 11155111)
- RPC: https://rpc.sepolia.org
- Navbar - Wallet connection, chain switcher, network badge
- PredictionCard - Individual market display with countdown, voting buttons
- CreatePredictionModal - Owner-only form to create new markets
- VoteButtons - Encrypted voting with FhenixJS integration
- TallyViewer - Owner-only feature to view and decrypt vote tallies after resolution
- Providers - WagmiProvider + QueryClientProvider setup
- Connect Wallet - Use MetaMask or compatible wallet
- Browse Markets - View all active prediction markets with live timers
- Vote Encrypted - Click Yes/No to submit encrypted vote via FhenixJS
- Owner Functions (if you set NEXT_PUBLIC_OWNER_ADDRESS):
- Create new predictions using the floating action button
- Resolve predictions to reveal encrypted tallies
- Decrypt results using your private key
The app includes comprehensive error handling with toast notifications for:
- Transaction pending/success/failure
- FHE encryption errors
- CoFHE permit requirements (check Fhenix Discord/docs if needed)
- Network connection issues
- Next.js 16 - React framework
- Wagmi 2.x - Ethereum wallet integration
- Viem 2.x - Blockchain client
- FhenixJS - Fully Homomorphic Encryption library
- shadcn/ui - Component library
- Tailwind CSS - Styling with dark mode
- React Hook Form - Form management
- Sonner - Toast notifications
- Date-fns - Date formatting
NEXT_PUBLIC_OWNER_ADDRESS= # Your wallet address for admin features
POST /api/prediction- Fetch individual prediction details
- All predictions are displayed with countdown timers
- Encrypted votes remain sealed until owner resolves the market
- Only the contract owner can resolve markets and view decrypted tallies
- Mobile-responsive with loading skeletons during data fetching
- Dark mode with orange-red accent colors
For issues with FHE or CoFHE permits, check the Fhenix Discord or Fhenix Documentation.