IWasBored
I Was Bored is a prediction market. Users can bet on the future price of crypto assets in a fun way
Problem Statement
Code: https://github.com/xadahiya/iwasboredThis project, "I Was Bored," is a decentralized, gamified prediction market platform. It allows users to bet on the future price of crypto assets using a simple, Tinder-like swiping interface.The tech stack is designed for decentralization and user privacy:Core Logic: Built on the Gnosis Conditional Tokens Framework with a Fixed Product Market Maker (FPMM) for on-chain market operations and automated liquidity.Data Feeds: Uses the Pyth Network for real-time, high-fidelity price data to create and resolve markets fairly.Compliance: Implements Self.xyz for Zero-Knowledge (ZK) proof-based age and jurisdiction verification, ensuring user privacy.Backend Automation: The backend logic for market creation and resolution runs on the Fluence network, creating a serverless and censorship-resistant architecture.Collateral: Utilizes PayPal's PYUSD stablecoin as the betting currency.Frontend: A React application provides the user interface.User Experience: Integrates ENS for human-readable wallet addresses.
Solution
For my hackathon submission, I developed a decentralized prediction market focused on decentralization, compliance, and an intuitive user experience that avoids the complexity of traditional trading interfaces. Each technology was selected to support these objectives. The architecture is a multi-chain system that separates responsibilities: market logic on Sepolia, identity verification on Celo, and automation on Fluence.Here are the details and the technology stack:The On-Chain Market Engine (Gnosis & FPMM on Sepolia) The foundation is the Gnosis Conditional Tokens Framework (now integrated into Omen). This provides an audited and flexible standard for creating conditional tokens—assets that pay out based on specific outcomes.How it is implemented:ConditionalTokens.sol: This core contract handles market creation. For example, for a market like "Will ETH exceed $3000 by October 1?", it establishes a condition, enabling the minting of YES and NO outcome tokens.FixedProductMarketMaker.sol (FPMM): Each market uses an FPMM for trading. This automated market maker maintains a liquidity pool of collateral (PYUSD) and the outcome tokens, allowing users to buy and sell YES/NO tokens. Prices adjust dynamically based on demand, reflecting market sentiment.Factory.sol: I created a custom factory contract to simplify the process. The backend invokes a single function, which manages the condition creation, FPMM deployment, and initial liquidity provision.Privacy-Preserving Compliance (Self.xyz on Celo) To meet legal requirements for a betting platform, I integrated Self.xyz. This verifies users are over 18 and not in restricted jurisdictions (such as the USA) without accessing personal data, using zero-knowledge proofs for privacy.How it is implemented:The frontend queries the AgeVerification.sol contract on Celo to check if the user's wallet is verified.If not, it displays a QR code, which the user scans via the Self.xyz mobile app.The app verifies the government ID using the device's secure hardware and generates a ZK proof confirming age > 18 and country ≠ USA.The proof is submitted to AgeVerification.sol, which validates it against the Self Protocol's on-chain hub. If valid, the address is marked as compliant permanently—a one-time process.Real-Time Data (Pyth Network) Accurate, timely data is essential for a prediction market. I selected Pyth Network for its high-frequency updates, gas-efficient on-chain "pull" model, and confidence intervals that enhance market integrity.How it is implemented:On-chain (SimplePredictionsOracle.sol): The Sepolia market contract retrieves prices from Pyth. During market creation, it pulls the current asset price to define terms. At expiration, the backend calls resolveMarket, which pulls the final price to determine the outcome (YES or NO).Off-chain (Frontend): The React-based prediction cards use Pyth's API to show live price charts, providing users with real-time context for decisions.Decentralized Automation (Fluence) To achieve true decentralization, I avoided reliance on centralized servers. Fluence provides a peer-to-peer network for running backend code, eliminating single points of failure and censorship risks.How it is implemented:The Python backend directory, including a lightweight FastAPI server and scripts, is deployed as a service on Fluence.Market Creation: A scheduled script on Fluence calls Factory.sol to generate new markets for various crypto assets.Market Resolution: Another script monitors the blockchain for expired markets and triggers resolveMarket using Pyth data.API Layer: The FastAPI server on Fluence aggregates data for the frontend, minimizing direct blockchain calls from the browser.A Notable Hackathon Innovation The key innovation is combining these advanced protocols into a unified experience. Building a multi-chain application (Sepolia + Celo) with a decentralized backend (Fluence) was ambitious for a hackathon.In particular, the "Tinder-swipe" UI gamifies the interface, making it accessible. It hides the complexities of ZK proofs, oracle updates, and automated market makers behind a simple, smartphone-friendly interaction, bridging Web3 technology with everyday users.
Hackathon
ETHGlobal New Delhi
2025
Contributors
- xadahiya
38 contributions