← Back to home

#PredictAI

#PredictAI is the AI-powered Prediction Marketplace on Morph which uses AI to generate and/or settle the predictions.

Screenshots

#PredictAI screenshot 1
#PredictAI screenshot 2
#PredictAI screenshot 3

Problem Statement

#predictAI is the platform that combines AI with prediction marketplace to make it super scalble with decentralized event (bet) creation.How It Works:Users log in via Dynamic's simple authentication. They choose a topic or use AI to generate interesting bets. Participants place bets using testnet funds (easily obtained through our integrated faucet). For crypto-related bets, Pyth Network provides accurate, real-time price data. When a bet concludes, our AI (powered by Phala Network) analyzes the latest information to determine the winner.

Solution

How We Built #predictAI: The Nitty-Gritty DetailsOur goal with #predictAI was to create a seamless, AI-powered prediction marketplace. Here's a deep dive into our tech stack and build process:Core Technologies:Frontend: Next.js with TypeScriptChose for its server-side rendering capabilities and TypeScript supportUsed Tailwind CSS for responsive designSmart Contracts: SolidityDeployed on Morph's Holesky testnetHandles bet creation, participation, and settlement logicBackend AI: Phala Network's Agent Contract plus OpenAI for backupImplemented in TypeScriptRuns in Phala's TEE (Trusted Execution Environment) for secure, tamper-proof executionAuthentication: Dynamic SDKIntegrated for email,wallet and Telegram loginsLeveraged Dynamic's Telegram Auto Wallets for seamless crypto onboardingOracle Integration: Pyth NetworkUsed for real-time cryptocurrency price dataImplemented Pyth's pull oracle pattern for on-chain data updatesIntegration and Challenges:AI-Agent Contract by Phala : The gas kept running out,had to use multiple apisUX - Challenge: Simplifying the testnet fund acquisition processHacky Solution: Created a "Request Funds" button that interacts with a custom faucet contract. This contract checks for cooldowns and distributes a fixed amount of testnet tokens, all in one transaction.Partner Integrations :Phala Network:Used for both bet generation and outcome determinationLeveraged Phala's secure environment to ensure fairness in AI decision-makingDynamic:Integrated Telegram login for one-click crypto account creationUsed Dynamic's EventEmitter to handle wallet connection states across the appPyth Network:Implemented a custom caching layer to optimize Pyth data fetchesUsed Pyth's confidence intervals to adjust bet parameters dynamicallyMorph:Deployed our main contract on Morph's Holesky testnetUtilized Morph's faster block times for a more responsive betting experienceThe most challenging (and rewarding) part was orchestrating these diverse technologies into a cohesive, user-friendly platform. Our "Request Funds" feature, while simple on the surface, required careful integration with Dynamic's wallet creation process and our custom faucet contract.

Hackathon

ETHGlobal Singapore

2024

Prizes

  • 🏆

    Best Consumer Applications build on Morph

    Morph

Contributors