Ever wondered if you'd survive a crypto flash crash? What if you could practice trading with real market data without risking actual money?
That's why I built Oracle Gym - a gamified trading platform powered by Pyth Network that lets you replay actual market conditions.
The Problem
Most paper trading platforms use fake data. When you practice on simulated prices, you're not learning how real markets behave.
Oracle Gym solves this by using real Pyth Network price feeds to create authentic training scenarios.
What is Oracle Gym?
Oracle Gym is a gamified crypto trading trainer where you:
- Replay real markets - Choose from 13 crypto assets with actual Pyth price data
- Face random shocks - Powered by Pyth Entropy V2 smart contract
- Make decisions - Buy, sell, hold, reduce, wait, or hedge at checkpoints
- Get scored - AI coaching analyzes your performance
- Level up - Earn XP, build streaks, compete on leaderboards
Think of it as a flight simulator for crypto traders.
Tech Stack
Built with:
- Frontend: Next.js 15, TypeScript, Tailwind CSS v4
- Blockchain: Wagmi v3, Viem v2, Base Sepolia
- Pyth: Hermes API (real-time + historical), Entropy V2 (on-chain randomness)
- Wallets: 300+ supported (MetaMask, WalletConnect, Coinbase Wallet)
How It Works
1. Price Feed Integration
Oracle Gym uses Pyth's Hermes API for real-time and historical price data. Each feed includes:
-
price- The actual price value -
expo- Exponent for decimal handling -
publish_time- Timestamp verification -
conf- Confidence intervals
2. Entropy V2 for Random Shocks
The "boss fight" feature uses Pyth Entropy V2 to generate verifiable on-chain randomness. This creates unpredictable market shocks that are:
- Unpredictable - No one can predict the outcome
- Verifiable - Anyone can verify on-chain
- Fair - Cannot be manipulated
Smart contract deployed at: 0x148123bc5b719a7e169ee652a72be387c964b6f4 on Base Sepolia
3. Scenario Types
Six different scenarios using real Pyth historical data:
- Breakout - Trend compression snaps into expansion
- Crash - Violent downside unwind
- Chop - Whipsaw price action
- Fakeout - Momentum looks clean until the floor disappears
- Slow Bleed - Long, draining descent
- Volatility Spike - Wide candles and sharp reversals
The Gamification System
XP & Leveling
Players earn 500 XP per level with unlimited progression.
7-Day Streak System
Build streaks by claiming daily rewards with multipliers from ×2 to ×14:
| Day | Base Reward | Multiplier | Total Potential |
|---|---|---|---|
| 1 | 100 coins | ×2 | 200 coins |
| 2 | 150 coins | ×4 | 600 coins |
| 3 | 200 coins | ×6 | 1,200 coins |
| 4 | 250 coins | ×8 | 2,000 coins |
| 5 | 300 coins | ×10 | 3,000 coins |
| 6 | 350 coins | ×12 | 4,200 coins |
| 7 | 500 coins | ×14 | 7,000 coins |
The multiplier also applies to session earnings.
Supported Assets
13 major cryptocurrencies using official Pyth price feeds:
BTC, ETH, SOL, BNB, XRP, ADA, DOGE, AVAX, POL, LINK, UNI, ATOM, PYTH
Key Challenges Solved
Challenge 1: Hydration Errors
Problem: Server-rendered HTML didn't match client-rendered HTML for wallet-dependent UI.
Solution: Added mounted state to only render wallet UI after client-side hydration.
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true);
}, []);
// Only render wallet-dependent UI after mount
{mounted && isConnected && (
<div suppressHydrationWarning>
{balance} coins
</div>
)}
Challenge 2: Entropy Callback Timing
Problem: Entropy V2 callbacks take 1-2 blocks, creating UX uncertainty.
Solution: Implemented polling with status tracking to show real-time progress.
Challenge 3: Rate Limiting
Problem: Free Pyth API has rate limits.
Solution: Upgraded to Pyth Pro for 1,000+ requests per minute.
What I Learned
Pyth Network is Production-Ready
The Hermes API is fast, reliable, and well-documented. Pyth Pro's enhanced rate limits made development smooth.
Entropy V2 is a Game-Changer
Having verifiable on-chain randomness opens up possibilities for fair gameplay mechanics that weren't possible before.
Gamification Works
Adding XP, levels, and streaks transformed a simple replay tool into an engaging training platform.
Results
After building Oracle Gym:
- ✅ 13 Pyth price feeds integrated
- ✅ Entropy V2 smart contract deployed and working
- ✅ 300+ wallet support via Wagmi v3
- ✅ Sub-second page loads with Next.js 15
- 🎮 Average session: 8-12 minutes
- 📈 Most popular assets: BTC (45%), ETH (30%), SOL (15%)
Try It Yourself
Want to test your trading skills?
Connect your wallet, get 1,000 free coins, and start training!
What's Next
Future improvements planned:
- Multiplayer mode - Compete against other traders in real-time
- More assets - Add forex, commodities, and stocks
- Custom scenarios - Let users create and share scenarios
- Mobile app - React Native version
- Tournament system - Weekly competitions with prizes
Conclusion
Building Oracle Gym taught me that real data makes all the difference. When you practice with actual market conditions, you learn patterns that matter.
Pyth Network's price feeds and Entropy V2 made it possible to create a training platform that feels authentic. The combination of real data, verifiable randomness, and gamification creates an engaging learning experience.
If you're building anything that needs reliable oracle data or on-chain randomness, check out Pyth Network.
Built for the Pyth Community Hackathon 2026
What would you build with Pyth Network? Drop a comment below! 👇
Top comments (0)