https://github.com/yllvar/bitvm-prediction
BitVM Prediction Market is a decentralized prediction market built on Bitcoin using Taproot and MAST. It allows two parties to bet on a binary outcome (e.g., "BTC > $200K by 2026") with disputes settled trustlessly on Bitcoin.
https://github.com/yllvar/bitvm-prediction
bitcoin bitvm defi prediction-markets
Last synced: 4 months ago
JSON representation
BitVM Prediction Market is a decentralized prediction market built on Bitcoin using Taproot and MAST. It allows two parties to bet on a binary outcome (e.g., "BTC > $200K by 2026") with disputes settled trustlessly on Bitcoin.
- Host: GitHub
- URL: https://github.com/yllvar/bitvm-prediction
- Owner: yllvar
- Created: 2025-06-09T17:49:27.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-06-09T18:10:57.000Z (4 months ago)
- Last Synced: 2025-06-09T19:20:46.869Z (4 months ago)
- Topics: bitcoin, bitvm, defi, prediction-markets
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ BitVM Prediction Market
## ๐ฏ What Is This?
You can bet with a friend on whether Bitcoin will hit $200K by 2026. Normally, Bitcoin can't do complex logic like this. But with **BitVM**, we made it possible while keeping Bitcoinโs secure blockchain as the final judge.## ๐ Why This Matters
Bitcoin is amazing at security and decentralization but not great at running smart contracts. With BitVM, we unlock **Turing-complete logic** โ all without changing Bitcoin itself.
### ๐ก Use Case
- Bet on real-world outcomes (e.g., "BTC > $100K?")
- No trust needed โ Bitcoin enforces the rules
- Only disputes go on-chain โ saves fees!## ๐ ๏ธ How It Works
Here's the magic:
```mermaid
graph TD
A[Alice Bets 'YES'] -->|Locks Funds| C(๐ Smart Contract)
B[Bob Bets 'NO'] -->|Locks Funds| C
O[๐ฎ CoinGecko Oracle] -->|Reports Price| C
C -->|If Both Agree| D[๐ฐ Automatic Settlement]
C -->|If Dispute| E[โ๏ธ Bitcoin Decides]
```### โจ Core Components
- **๐ Key Management:** Alice, Bob, and an Oracle each have keys.
- **๐ Contracts:** Built using Taproot + MAST to hide complexity until needed.
- **๐ฐ Transactions:** PSBT-based funding and settlement.
- **๐ Oracle:** Gets Bitcoin price from CoinGecko.
- **โ๏ธ Disputes:** If someone cheats, BitVM runs fraud proofs on Bitcoin.## ๐ฆ Files Overview
```
/bitvm-prediction-market
โโโ .env # Configuration values
โโโ keys.js # Generate participant keys
โโโ oracle.js # Fetch BTC price
โโโ contract.js # Build BitVM scripts & Taproot address
โโโ wallet.js # Create funding/settlement transactions
โโโ dispute.js # Handle disputes via Bitcoin Script
โโโ test.js # Run full workflow simulation
โโโ cli.js # User-friendly CLI interface
```## ๐ Quick Start
### Prerequisites
- Node.js installed
- `.env` file configured (see below)### Setup Instructions
```bash
# Clone the repo
git clone https://github.com/yllvar/BitVM-Prediction.git
cd BitVM-Prediction# Install dependencies
npm install# Run tests
node test.js# Or use the CLI
node cli.js
```### Example `.env` File
```env
NETWORK=testnet
ORACLE_PRIVATE_KEY=cQqV9FJ2GzvXHwv5yXr2YRYC5xHk2Z4XH6oRjv8J4HJ9Xu3GfZ8
COINGECKO_API_URL=https://api.coingecko.com/api/v3/simple/price
```## โ๏ธ Features
- **๐ Bitcoin Security**: Even if someone tries to cheat, Bitcoin ensures fairness.
- **๐ธ Cheap & Efficient**: Only disputed bets touch the blockchain.
- **๐ค No Trust Needed**: Rules are enforced by code and Bitcoin.
- **๐ต๏ธ Hidden Complexity**: Dispute logic stays off-chain until needed.## ๐งช Test Results
When we tested it:
| Action | Result | Time |
|--------|--------|------|
| Created Bet | Alice and Bob locked funds | 2 sec |
| Checked Price | Got $104,327 from CoinGecko | 1 sec |
| Settled Bet | Alice won automatically | 5 sec |
| Simulated Dispute | Bitcoin enforced the rules | ~30 min (on testnet) |## ๐ Technologies Used
- **BitVM**: Off-chain computation with on-chain verification
- **Taproot & MAST**: Hide complex scripts until needed
- **PSBT**: Safe transaction building
- **Schnorr Signatures**: Compact, efficient signatures
- **CoinGecko API**: Real-time price data## ๐ Future Roadmap
- ๐ฅ Add multi-party support (N-of-N multisig)
- ๐ Integrate decentralized oracles (like Chainlink)
- ๐ป Build a web UI for non-technical users
- ๐ต๏ธ Implement watchtowers to prevent cheating## ๐ Want More?
Check out the [**ABSTRACT.md**](ABSTRACT.md) file for deeper technical insights, architecture diagrams, and how BitVM opens the door to DeFi, NFTs, and more on Bitcoin.
---
**๐ก The Big Idea**: We proved that **Bitcoin can run complex apps** without compromising its core values โ security, simplicity, and decentralization.