Skip to content

Team Cliley - 5-Minute Prediction Market for Any Token on Cardano#123

Open
Mercurial wants to merge 2 commits intopyth-network:mainfrom
Mercurial:team-cliley-cardano-prediction-market
Open

Team Cliley - 5-Minute Prediction Market for Any Token on Cardano#123
Mercurial wants to merge 2 commits intopyth-network:mainfrom
Mercurial:team-cliley-cardano-prediction-market

Conversation

@Mercurial
Copy link

@Mercurial Mercurial commented Mar 22, 2026

Summary

  • 5-minute prediction market on Cardano using Pyth Lazer oracle for real-time price feeds
  • Works with any Pyth-supported feed (BTC/USD, ETH/USD, ADA/USD, etc.)
  • Constant-product AMM for price discovery between YES/NO outcomes
  • Full lifecycle: create → bet → resolve → claim
  • Market-maker bot that continuously creates and resolves markets
  • Live frontend with real-time Pyth price streaming and CIP-30 wallet betting

How Pyth Is Used

  1. On-chain (Aiken): pyth.get_updates() from pyth-network/pyth-lazer-cardano — reads verified price from withdraw-0 redeemer
  2. Off-chain (resolve): POST /v1/latest_price — fetches signed price update for tx inclusion
  3. Frontend (streaming): @pythnetwork/pyth-lazer-sdk WebSocket — real-time BTC price display via wss://pyth-lazer-0.dourolabs.app/v1/stream

Live Demo

Bot creates 5-min markets, frontend shows live price + countdown + wallet betting:

cd offchain && cp .env.example .env && bun install && bun --hot server.ts
# → http://localhost:4000

Verified on Preprod

Step Tx Hash
Create 9d840a12...
Bet YES 3c5d2bf0...
Resolve (Pyth) 88f97270...
Claim 7d691f3c...

Stack

  • On-chain: Aiken (Plutus V3) + pyth-network/pyth-lazer-cardano
  • Off-chain: TypeScript + Bun + blaze-cardano + Blockfrost
  • Frontend: React + Tailwind + CIP-30 wallet (Bifrost)
  • Streaming: @pythnetwork/pyth-lazer-sdk WebSocket

Team Cliley

Files

Creates lazer/cardano/prediction-market/ containing:

  • contracts/ — Aiken smart contracts with Pyth integration
  • offchain/lib/ — Shared modules (cardano, pyth, market, bifrost, types)
  • offchain/bot.ts — Market-maker bot
  • offchain/server.ts — Bun.serve() API + WebSocket + frontend
  • offchain/frontend.tsx — React app with live price + wallet + betting
  • offchain/cli.ts — CLI for manual operations

Team Cliley submission for Pythathon 2026. Constant-product AMM
prediction market with Pyth Lazer oracle integration for real-time
price feeds on Cardano (Plutus V3).

Full end-to-end flow verified on Preprod: create, bet, resolve, claim.
- Bot: creates 5-min BTC/USD markets, auto-resolves via Pyth Lazer
- Frontend: real-time price streaming, countdown timer, YES/NO betting
- Wallet: CIP-30 via Bifrost (Nami/Eternl/Lace), real tx signing
- Server: Bun.serve() with API routes, WebSocket pub/sub, Pyth streaming
- Refactored CLI into shared lib/ modules (cardano, pyth, market, types)

Bet flow: wallet UTxOs → server builds unsigned tx → wallet signs → finalize → submit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant