Real-time prediction markets for hackathon projects
π www.livestakes.fun
π ETHGlobal Cannes Finalist π A real-time π prediction market π° & livestream dashboard engagement π₯ for hackathons. View live project demos, place on-chain predictions, & earn crypto rewards for accurate forecasts. All interactions are powered by smart contracts & decentralized video infrastructure. Created by Molly Beach, Ziz Khu, Joao Santos. LiveStakes is an open source platform that lets viewers watch every ETHGlobal hackathon project in real time and place on-chain predictions on which ones will win prizes. Teams broadcast live demos through WebRTC while the Hedera Agent Kit analyzes livestream environment and voice data to automatically create betting markets and predict winners using an automated market maker. When the AI makes final decisions, the Flow blockchain contracts settle and payout bettors instantly.
It contains the Next.js frontend, Flow smart contracts, Hedera Agent Kit integration, WebRTC streaming server, and infrastructure as code required to deploy the complete system.
- π₯ Live project video streaming powered by WebRTC and Express server
- π€ AI-powered betting market creation using Hedera Agent Kit analysis
- ποΈ Voice and environment data processing for automated winner prediction
- π Dynamic prediction markets with CPMM pricing on Flow blockchain
- πΉ Real-time odds adjustment based on AI insights
- π Re-allocation of positions before AI makes final decisions
- π Privy wallet authentication for seamless Web3 onboarding
- π Real-time stats (bet volume, price movement, AI confidence scores) via PostgreSQL
Layer | Technology |
---|---|
π» Frontend | Next.js 14, React 18, TailwindCSS, shadcn/ui, Flow Client Library |
π Smart contracts | Cadence (Flow), Flow CLI, Flow Emulator |
π€ AI Decision Engine | Hedera Agent Kit, Voice Analysis, Environment Processing |
π₯ Live Streaming | WebRTC, Express.js, Socket.io |
ποΈ Database | PostgreSQL, Prisma ORM |
π Off-chain API | Node 18 (Express), WebRTC signaling server |
π Auth | Privy (Wallet Connection), GitHub OAuth |
π DevOps | Turborepo, GitHub Actions, Vercel, Flow Testnet |
flowchart TD
FE[Next.js Frontend] <--> API[Express API]
FE <--> WS[WebRTC Streaming]
FE --> PV[Privy Auth]
API --> DB[(PostgreSQL)]
API --> FC[Flow Contracts]
HAK[Hedera Agent Kit] --> API
HAK --> WS
WS --> VA[Voice Analysis]
WS --> ED[Environment Detection]
VA --> HAK
ED --> HAK
HAK --> BM[Bet Market Creation]
HAK --> WP[Winner Prediction]
livestakes/
ββ apps/
β ββ web/ # Next.js frontend (App Router)
β ββ streaming-server/ # Express WebRTC signaling server
ββ packages/
β ββ contracts/ # Flow Cadence contracts and tests
β ββ hedera-agent/ # Hedera Agent Kit integration and AI logic
β ββ ui/ # Shared React component library (shadcn/ui wrappers)
ββ infra/
β ββ terraform/ # Vercel, PostgreSQL, Flow network resources
β ββ gh-actions/ # Reusable workflow templates
ββ scripts/ # Helper scripts (deploy, seed, data-export)
ββ docs/ # Additional specs, diagrams, decision logs
ββ .github/
β ββ workflows/ # CI pipelines: lint, test, contract size, AI model validation
ββ turbo.json # Turborepo pipeline config
ββ flow.json # Flow network configuration
ββ README.md # You are here
Path | Purpose |
---|---|
apps/web | π Public site and dashboard. Contains pages, components, hooks, and Flow blockchain integration. |
apps/streaming-server | π‘ Express server handling WebRTC signaling, Socket.io connections, and livestream management. |
packages/contracts | π Flow Cadence smart contracts, Flow CLI tests, and deployment scripts for prediction markets. |
packages/hedera-agent | π€ Hedera Agent Kit integration for AI analysis, voice processing, and automated betting decisions. |
packages/ui | π¨ Design-system primitives wrapped around shadcn/ui for consistent styling. |
infra/terraform | ποΈ Infrastructure definitions for Vercel projects, PostgreSQL database, and Flow network endpoints. |
scripts | βοΈ Type-scripted CLI utilities for project onboarding, market creation, and database seeding. |
- Node β₯ 18
- pnpm β₯ 9
- Flow CLI
- Docker (for PostgreSQL)
- PostgreSQL β₯ 14
Standard installation process for Node.js monorepo with workspace dependencies, environment configuration, and Flow blockchain setup.
The project includes a comprehensive Makefile with colored output and organized commands for all development tasks.
make setup # Install dependencies and start database
make dev # Start all services in development mode
make help # Show all available commands
make frontend-install # Install frontend dependencies
make frontend-dev # Start Next.js development server
make frontend-build # Build frontend for production
make frontend-start # Start frontend production server
make frontend-lint # Lint frontend code
make blockchain-compile # Compile smart contracts
make blockchain-test # Run blockchain tests
make blockchain-test-coverage # Run tests with coverage
make blockchain-node # Start local Hardhat node
make blockchain-clean # Clean blockchain artifacts
# Deployment Commands
make deploy-local # Deploy to local network
make deploy-sepolia # Deploy to Sepolia testnet
make deploy-mainnet # Deploy to Ethereum mainnet
make deploy-flow-testnet # Deploy to Flow testnet
make deploy-flow-mainnet # Deploy to Flow mainnet
make server-install # Install server dependencies
make server-dev # Start server in development mode
make server-dev-debug # Start server in debug mode
make server-build # Build server for production
make server-start # Start server in production mode
make server-migrate # Run database migrations
make docker-dev # Start development environment with Docker
make docker-prod # Start production environment with Docker
make docker-build # Build Docker images
make docker-clean # Clean Docker containers and images
make db-start # Start database container
make db-stop # Stop database container
make db-reset # Reset database (stop, remove volumes, start)
make test # Run all tests
make test-frontend # Run frontend tests
make test-server # Run server tests
make clean # Clean all build artifacts
make clean-all # Clean everything including Docker
make all-dev # Start all services in development mode
make all-build # Build all services for production
make all-start # Start all services in production mode
Development environment includes PostgreSQL database, Flow emulator, Hedera Agent Kit AI service, WebRTC streaming server, and Next.js frontend all running concurrently through Turborepo.
Navigate to http://localhost:3000
to see LiveStakes in action.
- Frontend β pushed to
main
automatically deploys to Vercel preview.production
branch triggers production promotion. - Streaming Server β deployed to Vercel as serverless functions with WebRTC support.
- Contracts β tagged releases deploy against Flow Testnet, then Mainnet on manual approval.
- Hedera Agent β AI service deployed to cloud infrastructure with voice processing capabilities.
- Unit β Flow testing for Cadence contracts, Vitest for TypeScript.
- Integration β WebRTC streaming tests and AI prediction accuracy validation.
- End-to-end β Playwright scripts simulating complete bettor and streaming flow.
Comprehensive testing suite covers all components from smart contracts to AI models.
- Create a feature branch
- Commit using Conventional Commits (
feat(ui): add project card
) - Open a PR; templates auto-label scope
- CI must pass lint, tests, and contract size
MIT Β© 2025 LiveStakes Contributors
livestakes/
βββ .git/
βββ common/
β βββ ecosystem.config.js
β βββ nginx.conf
β βββ supervisord.conf
β βββ supervisord.conf.dev
β βββ uwsgi_params
β βββ wsgi.ini
βββ pipeline/
β βββ .dockerignore
β βββ ansible.cfg
β βββ check.sh
β βββ deploy_buildx.sh
β βββ deploy_home.sh
β βββ deploy_ubuntu.sh
β βββ deploy.sh
β βββ Dockerfile
β βββ main.yaml
β βββ stack.yml
βββ scripts/
β βββ generate-flow-json.js
βββ src/
β βββ .next/
β βββ app/
β β βββ about/
β β β βββ page.tsx
β β βββ api/
β β β βββ livestreams/
β β β β βββ route.ts
β β β βββ markets/
β β β β βββ route.ts
β β βββ chart/
β β β βββ page.tsx
β β βββ chat/
β β β βββ page.tsx
β β βββ components/
β β β βββ clientwrapper/
β β β β βββ index.tsx
β β β βββ ui/
β β β β βββ button.tsx
β β β β βββ card.tsx
β β β βββ BettingIndicator.tsx
β β β βββ BettingModal.tsx
β β β βββ CardContent.tsx
β β β βββ Chat.tsx
β β β βββ ConnectWallet.tsx
β β β βββ CTA.tsx
β β β βββ DashboardHeader.tsx
β β β βββ FeatureCard.tsx
β β β βββ Features.tsx
β β β βββ Footer.tsx
β β β βββ Header.tsx
β β β βββ Hero.tsx
β β β βββ HowItWorks.tsx
β β β βββ Leaderboard.tsx
β β β βββ LiveBadge.tsx
β β β βββ LivestreamCard.tsx
β β β βββ LivestreamSection.tsx
β β β βββ MarketAssociationModal.tsx
β β β βββ MarketCreationModal.tsx
β β β βββ MarketFilter.tsx
β β β βββ MarketHeader.tsx
β β β βββ Markets.tsx
β β β βββ Marquee.tsx
β β β βββ Navigation.tsx
β β β βββ NavItem.tsx
β β β βββ OutcomeTable.tsx
β β β βββ PageLayout.tsx
β β β βββ PixelWindow.tsx
β β β βββ PredictionGraph.tsx
β β β βββ Profile.tsx
β β β βββ PWAProvider.tsx
β β β βββ SearchBar.tsx
β β β βββ SideNav.tsx
β β β βββ SocialIcon.tsx
β β β βββ StreamCard.tsx
β β β βββ Support.tsx
β β β βββ TradePanel.tsx
β β βββ context/
β β β βββ AuthContext.tsx
β β βββ data/
β β β βββ features.ts
β β β βββ howItWorks.ts
β β β βββ livestreams.ts
β β β βββ markets.ts
β β β βββ marquee.ts
β β β βββ profile.ts
β β β βββ support.ts
β β βββ features/
β β β βββ page.tsx
β β βββ howitworks/
β β β βββ page.tsx
β β βββ leaderboard/
β β β βββ page.tsx
β β βββ lib/
β β β βββ cloudinary.ts
β β β βββ contractsApi.ts
β β β βββ livestreamsApi.ts
β β βββ livestreams/
β β β βββ page.tsx
β β βββ markets/
β β β βββ page.tsx
β β βββ profile/
β β β βββ page.tsx
β β βββ support/
β β β βββ page.tsx
β β βββ globals.css
β β βββ layout.tsx
β β βββ not-found.tsx
β β βββ page.tsx
β βββ blockchain/
β β βββ artifacts/
β β β βββ build-info/
β β β β βββ e7b1899348a83502b2f4db86ca36448e.json
β β β βββ contracts/
β β β β βββ MarketFactory.sol/
β β β β β βββ MarketFactory.dbg.json
β β β β β βββ MarketFactory.json
β β β β βββ PredictionMarket.sol/
β β β β β βββ IMarketFactory.dbg.json
β β β β β βββ IMarketFactory.json
β β β β β βββ PredictionMarket.dbg.json
β β β β β βββ PredictionMarket.json
β β βββ cache/
β β β βββ solidity-files-cache.json
β β βββ contracts/
β β β βββ .DS_Store
β β β βββ MarketFactory.sol
β β β βββ PredictionMarket.sol
β β βββ node_modules/
β β βββ scripts/
β β β βββ deploy-testnet.js
β β β βββ deploy.js
β β β βββ getMarket.js
β β β βββ getProject.js
β β β βββ setup-testnet.js
β β βββ test/
β β β βββ MarketFactory.test.js
β β β βββ PredictionMarket.test.js
β β βββ transactions/
β β β βββ claimPayout.js
β β β βββ createMarket.js
β β β βββ placeBet.js
β β β βββ resolveMarket.js
β β βββ .DS_Store
β β βββ .env
β β βββ .gitignore
β β βββ deployment-flow-testnet.json
β β βββ deployment-localhost.json
β β βββ FLOW_EVM_SETUP.md
β β βββ hardhat.config.js
β β βββ package.json
β β βββ pnpm-lock.yaml
β β βββ README.md
β βββ howitworks/
β β βββ page.tsx
β βββ node_modules/
β βββ public/
β βββ server/
β β βββ node_modules/
β β βββ src/
β β β βββ database/
β β β β βββ db.ts
β β β β βββ dbInitialization.ts
β β β β βββ migrations.ts
β β β β βββ transactions.ts
β β β βββ routes/
β β β β βββ markets.ts
β β β β βββ marketsMetadata.ts
β β β β βββ videoUpload.ts
β β β βββ scripts/
β β β β βββ cleanBucket.ts
β β β β βββ importVideos.ts
β β β βββ services/
β β β β βββ videoAnalysis.ts
β β β βββ index.ts
β β β βββ migrate.ts
β β βββ temp/
β β βββ .env
β β βββ EXAMPLE_USAGE.md
β β βββ LIVESTREAMS_API.md
β β βββ MIGRATION.md
β β βββ package-lock.json
β β βββ package.json
β β βββ README.md
β β βββ tsconfig.json
β β βββ VIDEO_IMPORT_SETUP.md
β βββ .DS_Store
β βββ .env
β βββ .env.example
β βββ .gitignore
β βββ eslint.config.mjs
β βββ next-env.d.ts
β βββ next.config.js
β βββ package.json
β βββ pnpm-lock.yaml
β βββ postcss.config.js
β βββ README.md
β βββ tailwind.config.js
β βββ tsconfig.json
βββ .dockerignore
βββ DATA_REQUIREMENTS.md
βββ deploy.sh
βββ docker-compose-local.yml
βββ docker-compose.yml
βββ docker-entrypoint.sh
βββ Dockerfile
βββ Dockerfile.dev
βββ dump-livestakes.sql
βββ Makefile
βββ README.md