PredictX - Eth Global Bangkok 24

You need to login in order to like this zkApp. Click Here

PredictX - Eth Global Bangkok 24

You need to login in order to like this zkApp. Click Here

Project Overview

A binary prediction market zkApp was developed using ProtoKit on the Mina Protocol. The application includes the following core functionalities:

  • Create Bets: Users can create bets with a specified minimum stake, description, unique betId, and time constraints based on block height.
  • Place Bets: Participants stake on binary outcomes (yes/no), ensuring the amount meets the minimum stake. The contract tracks stakes using state maps tied to user keys.
  • Close Market: After the bet’s expiration, the market can be closed, setting the result (currently hardcoded, pending oracle integration).
  • Claim Winnings: Users claim winnings based on their stake and the final outcome through an integrated Balances module.

Development Details

The project leveraged the ProtoKit starter template, streamlining zkApp development for Mina. Key tools and technologies included:

  • Backend: o1.js and ProtoKit for efficient smart contract development and Mina Protocol integration.
  • Frontend: Next.js for a modern, server-rendered React framework supporting advanced routing and rendering.
  • Development Environment: Node.js v18.18 managed via NVM and pnpm v9.8.0 for optimized dependency management.

Challenges and Solutions

  • Module Integration: Adjusted tsconfig.json and webpack settings to resolve dependency conflicts and ensure compatibility.
  • Async Operations: Developed custom hooks and middleware to handle contract state and ensure frontend responsiveness.
  • State Management: Adopted Zustand for lightweight and efficient state handling.

The seamless synergy of ProtoKit and o1.js, combined with creative solutions to technical hurdles, enabled the creation of a robust zkApp for binary prediction markets.