Decentralized prediction markets for weather and natural disaster events, built on Linera blockchain microchains.
StormCast enables users to create and bet on outcomes of real-world environmental events like hurricanes, earthquakes, tornadoes, floods, and more.
๐ lineramicrobets.vercel.app
Note: The Vercel deployment runs in Demo Mode (localStorage) since the Linera service requires a backend server. For full on-chain functionality, run locally with
linera service --port 8080.
We're planning to deploy the Linera service to a VPS, enabling real on-chain betting directly from the Vercel frontend for all users!
- Create Markets - Anyone can create a prediction market for an upcoming weather event with a specific question and deadline
- Place Bets - Users bet YES or NO on outcomes, with funds pooled together
- Resolution & Payout - When the event concludes, the market resolves and winners split the pool proportionally
- Sub-second Finality - Linera's microchain architecture enables instant transaction confirmation
| Component | Technology |
|---|---|
| Smart Contract | Rust with Linera SDK, MapView for bet storage, RegisterView for market state |
| Security | Creator verification via authenticated_signer() ensures only authorized resolution |
| Token Integration | Uses Linera's fungible token standard for seamless deposits and payouts |
| Frontend | Next.js 14 with TypeScript, real-time market updates, responsive design |
linera-micro-bets/
โโโ frontend/ # Next.js web application
โ โโโ app/ # App router pages
โ โ โโโ page.tsx # Markets listing
โ โ โโโ create/ # Create market page
โ โ โโโ bet/[id]/ # Market details & betting
โ โ โโโ my-bets/ # User's betting history
โ โโโ lib/ # Linera client & hooks
โ
โโโ examples/micro-bet/ # Linera smart contract
โ โโโ src/
โ โโโ lib.rs # Contract ABI & operations
โ โโโ state.rs # Bet & market data structures
โ โโโ contract.rs # Core betting logic
โ โโโ service.rs # GraphQL query endpoints
โ
โโโ [linera-*]/ # Linera protocol (dependency)
Simply visit: lineramicrobets.vercel.app
- Rust (for building Linera)
- Node.js 18+
- WSL2 (if on Windows)
cargo build -p linera-storage-service -p linera-service --bins
export PATH="$PWD/target/debug:$PATH"linera wallet init --faucet https://faucet.testnet-conway.linera.netlinera service --port 8080cd frontend
npm install
npm run devCreate frontend/.env.local:
NEXT_PUBLIC_LINERA_SERVICE_URL=http://localhost:8080
NEXT_PUBLIC_CHAIN_ID=your_chain_id
NEXT_PUBLIC_MICRO_BET_APP_ID=your_app_idVisit http://localhost:3000 - you should see "๐ Linera: Connected" indicating on-chain mode!
- Navigate to "Create Market"
- Enter the event question (e.g., "Will Hurricane X make landfall in Florida?")
- Set the betting deadline
- Submit - market is created on-chain
- Browse active markets on the home page
- Click on a market to view details
- Choose YES or NO
- Enter your bet amount
- Confirm - funds are locked in the pool
- After the event deadline, the market creator can resolve the outcome
- Winners receive proportional payouts from the losing pool
- All transactions are recorded on Linera microchains
Important: Never commit
wallet.json,keystore.json, orclient.db/to version control. These files contain sensitive cryptographic keys.
- Linera's microchain architecture enables sub-second transaction finality, perfect for time-sensitive betting
- The View model requires careful async handling
- Rust's type system caught many potential bugs at compile time
- GraphQL provides a flexible API for frontend integration
- VPS Deployment - Public Linera service for on-chain betting from Vercel
- Oracle Integration - Automated weather data resolution
- Multi-chain Support - Cross-region betting pools
- Mobile PWA - Progressive web app for mobile users
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- Linera - For the revolutionary microchain infrastructure
- Linera Conway Testnet - For providing testnet resources
Built with โค๏ธ for the Linera Builderthon