project screenshot 1
project screenshot 2
project screenshot 3

#PredictAI

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

#PredictAI

Created At

ETHGlobal Singapore

Winner of

Morph - Best Consumer Applications build on Morph

Project Description

#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.

How it's Made

How We Built #predictAI: The Nitty-Gritty Details

Our 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:

  1. Frontend: Next.js with TypeScript

    • Chose for its server-side rendering capabilities and TypeScript support
    • Used Tailwind CSS for responsive design
  2. Smart Contracts: Solidity

    • Deployed on Morph's Holesky testnet
    • Handles bet creation, participation, and settlement logic
  3. Backend AI: Phala Network's Agent Contract plus OpenAI for backup

    • Implemented in TypeScript
    • Runs in Phala's TEE (Trusted Execution Environment) for secure, tamper-proof execution
  4. Authentication: Dynamic SDK

    • Integrated for email,wallet and Telegram logins
    • Leveraged Dynamic's Telegram Auto Wallets for seamless crypto onboarding
  5. Oracle Integration: Pyth Network

    • Used for real-time cryptocurrency price data
    • Implemented Pyth's pull oracle pattern for on-chain data updates

Integration and Challenges:

  1. AI-Agent Contract by Phala : The gas kept running out,had to use multiple apis

  2. UX - Challenge: Simplifying the testnet fund acquisition process

    • Hacky 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 :

  1. Phala Network:

    • Used for both bet generation and outcome determination
    • Leveraged Phala's secure environment to ensure fairness in AI decision-making
  2. Dynamic:

    • Integrated Telegram login for one-click crypto account creation
    • Used Dynamic's EventEmitter to handle wallet connection states across the app
  3. Pyth Network:

    • Implemented a custom caching layer to optimize Pyth data fetches
    • Used Pyth's confidence intervals to adjust bet parameters dynamically
  4. Morph:

    • Deployed our main contract on Morph's Holesky testnet
    • Utilized Morph's faster block times for a more responsive betting experience

The 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.

background image mobile

Join the mailing list

Get the latest news and updates