Real-time NBA micro-betting with on-chain USDC settlement via Tempo and MPP (Machine Payments Protocol)
nba-bets is an early-stage Python project in the AI payments / x402 ecosystem. It currently has 0 GitHub stars and 0 forks.
Real-time micro-betting on NBA plays, settled on-chain via Tempo and MPP (Machine Payments Protocol).
Watch a real NBA game and place Yes/No bets on what happens next — "Does Steph Curry score first?", "Next score a 3-pointer?", "LeBron with a dunk?" — with bets resolving in seconds and USDC payouts on-chain.
The POST /api/bet endpoint is an MPP-compatible service:
402 Payment Required with an MPP challengetempo wallet transfertempo request -t -X POST \
--json '{"bet_id":"b1","pick":"Yes","player":"you"}' \
http://localhost:8000/api/bet
git clone <this-repo>
cd nba-bets
uv venv && uv pip install -r requirements.txt
cp .env.example .env
# Edit .env with your Tempo wallet address and a secret key
Get your wallet address:
tempo wallet login
tempo wallet -t whoami # copy the wallet address
uvicorn server:app --reload
# Open http://localhost:8000
HOUSE_WALLET=0x... MPP_SECRET_KEY=test pytest
index.html Browser UI: YouTube player + bet cards + PBP feed
|
|--- WebSocket /ws/{name} Game feed, bet prompts, results
|--- POST /api/bet MPP-protected bet placement (402 flow)
v
server.py FastAPI backend: game engine, bet lifecycle, MPP, Tempo
|
|--- betting.py Core bet math (tested independently)
|--- game_data.json Real PBP data from NBA CDN
|--- tempo wallet transfer On-chain USDC payouts to winners
Uses real play-by-play from Lakers @ Warriors, Christmas Day 2024 (LAL 115 - GSW 113).
PBP data from cdn.nba.com, video from YouTube. 25 pre-seeded bets covering Q1.
Every bet open, pick, resolution, and Tempo transfer is logged:
GET /api/audit
TypeScript Interface for Machine Payments Protocol
Alephant is an open-source AI Agent Gateway for routing, tracking, and controlling LLM usage across AI agents, members, and workflows, and for publishing agent capabilities as paid endpoints with x402 and MPP payment rails.
Specifications for the Machine Payments Protocol - powered by the "Payment" HTTP authentication scheme
Rust SDK for the Machine Payments Protocol
Website for the Machine Payments Protocol
Building blocks for Agentic payments (x402, MPP, AP2) for TypeScript, Rust, Go, Python, Ruby, PHP, Lua, Kotlin and Swift.