Betflix

Fast, YES/NO bets on real-time prices with ENS winner badges, powered by Pyth and The Graph.

Betflix

Created At

ETHGlobal New Delhi

Project Description

This project provides head-to-head betting on crypto price movements with instant settlement.

On prediction markets it always takes a long time for the market to settle and sometimes all you want is to use the same core tech for silly head to head bets.

Betflix is based exactly on this.

Users can create bets on price movements and lock in their predictions on-chain. Besides the prices, they also can set three key parameters: how long the bet runs, the window to join, and most importantly - the custom ENS subdomain name the winner will receive as a trophy. The created bets and the predictions are associated on chain.

Other users browsing the app can instantly join any pending bet, automatically taking the opposite position. Just pure disagreement settled by code

The winner takes the entire pot powered by Pyth Network and also gets their custom ENS subdomain minted as an NFT trophy.

All active bets are visible through The Graph Protocol's lightning-fast queries, creating a live feed of ongoing battles. Users can track their wins, see who's on a hot streak, and jump into the action within seconds. The ENS trophies create a permanent stamp of the win.

How it's Made

The core architecture project is build with Scaffold-ETH 2 framework. I have used the NextJJS, Hardhat and the subgraph extensions to setup the project structure.

The core components included are as below -

  1. Smart Contracts
  • Core betting logic with configurable parameters for creation, cancellation and bet resolution.
  • Integrates Pyth Contract for price fetching and price feed updates.
  • Integrates ENS Resolver and Registry for ENS updates..
  • Emergency functions for admin intervention
  • Comprehensive error handling and fund protection
  1. Pyth Network
  • On-demand price feed updates fetched from the UI which is passed and updated on-chain. The core concept of price updates is just wonderful
  • Creator pays update fee upfront, resolver gets refunded
  • Validates price freshness and exponent consistency
  1. ENS Integration
  • Winners receive unique ENS subdomains as permanent trophies
  • Subdomains are pre-selected during bet creation
  • Automatic transfer via NameWrapper on bet resolution
  1. The Graph Protocol
  • Real-time indexing of bet lifecycle events
  • Tracks pending/active/resolved bets and user statistics
  • Reduces RPC calls and improves UI responsiveness

Worth Mentioning and Notable -

  • Built it solo even after having a huge UI development PTSD.
background image mobile

Join the mailing list

Get the latest news and updates