About
## Wave 1 submission
Wave 1: Complete zkPredict Implementation - Privacy-First Prediction Markets on Aleo
Live Deployment:
- Program: zkpredict2.aleo on Aleo Testnet - TX ID: at1uaezw9wsrskwex086wu6aj6ryas6m6eq90xn5qydwj7ymlva2qgstgl3vt - Frontend: https://zkpredict.lat - Explorer: https://testnet.explorer.provable.com/program/zkpredict2.aleo
Smart Contract Features:
1. Multi-Outcome Markets: Support for 2-255 outcomes per market (not just YES/NO). Dynamic outcome_pools mapping using hash-based keys. Perfect for elections, tournaments, price predictions. 2. Category System: Five categories (Sports, Politics, Crypto, Weather, Other) stored as u8 in Market struct. Frontend filtering and category-specific discovery. 3. Auto-Resolve: Time-based auto-resolution allows anyone to trigger resolution after end_time. Creator maintains control before deadline. Prevents abandoned markets. 4. Bet ID Claim System: Unique bet_id via BHP256 hash (bettor || market_id || outcome || nonce). claim_winnings accepts bet_id instead of full encrypted Bet record. Solves wallet compatibility. BetData mapping enables verification. Double-claim prevention via claimed_bets mapping. 5. Privacy + Transparency: Bet positions stored as private Records (zero-knowledge proofs). Pool totals public for fair parimutuel odds. No front-running or surveillance possible.
Frontend Implementation:
1. Multi-Wallet Support: Custom adapters for Puzzle and Shield wallets. Seamless Leo Wallet integration. Robust connection handling with polling detection. 2. Market Discovery: Category-based filtering, statistics dashboard (total markets, active markets, volume), real-time updates via React Query. 3. Hybrid Architecture: On-chain state (pools, resolution) from Aleo + off-chain metadata (titles, images) from Supabase. Custom hooks (useOnChainMarket, useMarketMetadata) for efficient sync. 4. Complete User Flows: Create Market (multi-step form with outcome builder, category selector), Place Bet (odds display, bet_id extraction), Resolve Market (creator/auto-resolve), Claim Winnings (bet ID input, payout calculation).
Technical Achievements:
- 313 lines of production Leo code with comprehensive validation - Type-safe TypeScript with custom types (Market, Bet, Category) - Responsive design (TailwindCSS, DaisyUI) - WASM/webpack config for Aleo SDK browser compatibility - Deployment cost: 6.908620 credits
Testing:
- Multi-outcome market creation/resolution verified - Category filtering validated - Bet_id extraction from transaction futures confirmed - Double-claim prevention tested - Multi-wallet connections working (Leo, Puzzle, Shield)
Documentation:
- Comprehensive README.md with architecture diagrams - DEPLOYMENT.md with full deployment history - Inline code comments and type definitions
## Wave 2 submission
Wave 2: Privacy-First Architecture & Critical Bug Fixes
🔒 Privacy Model Overhaul (Addressing Wave 1 Feedback)
Wave 1 Judge Feedback: "predictions are made using public inputs which makes it difficult to claim that the prediction amounts are private"
Solution: Complete refactor from zkpredict2.aleo → zkpredict_v6.aleo
Key Changes:
1. Private Bet Amounts: Replaced public amount: u64 parameter with private credits.aleo/credits record 2. Private Outcome Choices: Changed public outcome: bool to private input outcome: u8 3. Eliminated bet_data Mapping: Removed public storage of individual bets - now only in private Records 4. Private Transfers: Uses transfer_private_to_public() to hide sender and amount
Result: True zero-knowledge betting - only pool totals visible, all positions encrypted.
---
🐛 7 Critical Bug Fixes
Deployed zkpredict_v6.aleo (TX: at1hcty9vhpnpnpcsyrx2lk5w0mrwf882j3p968fya0nvdyhrq26ypqcmfwak):
- Funds Trapped - claim_winnings never transferred credits. Fixed with transfer_public_to_private()
- Post-Expiration Bets - Added assert(block.height < market.end_time)
- Scope Violations - Fixed async function variable assignments
- Parlay Validation - Replaced get() with get_or_use() pattern
- Pool Initialization - Fixed conditional set() race conditions
---
🚀 New Features
Reputation System: 4-tier progression (Novice→Oracle) with private tracking, tier bonuses (1.0x→1.3x), and selective disclosure proofs.
Parlay Betting: 2-5 leg combinations with exponential odds (2-leg: 3.5x, 5-leg: 28x), gated by reputation tier.
Time-Weighted Betting: Early bettor rewards (2.0x first 6h → 1.0x after 24h).
Batch Claims: claim_two_winnings() for 50% gas savings.
---
💻 Frontend Improvements
Live: https://zkpredict.lat
- Wallet Integration: Auto-decryption (DecryptPermission.OnChainHistory), multi-wallet support, record management UI
- Hybrid Architecture: On-chain state (Aleo) + off-chain metadata (Supabase)
- Mobile-Responsive: Touch-optimized (48px+ targets), responsive grids
- Market Creation Wizard: 4-step flow with outcome builder, category selector, privacy disclosure
- Parlay Builder: Visual leg selector with real-time odds
- Reputation Dashboard: Tier progress, streak tracking, proof generation
---
📊 Technical Evolution
| Metric | Wave 1 | Wave 2 | |-------------|--------------|-------------| | Leo Code | 313 lines | 1,300 lines | | Constraints | ~400K | 1.43M | | Privacy | Public leaks | Full ZK | | Bugs | 7 critical | 0 |
---
🔗 Resources
- Program: https://testnet.explorer.provable.com/program/zkpredict_v6.aleo
- Frontend: https://zkpredict.lat
- GitHub: https://github.com/carlos-israelj/zkPredict
Achievement: Addressed privacy critique, eliminated all critical bugs, added reputation system + parlays + time-weights.
From the public Akindo product page. Votes, swipes and the judge score are hackfeed's own.





