One platform, two ways to live the 2026 World Cup — simulated fantasy duels and a live 2D match arena, both driven by the same real-time data source: the TxLINE feed on Solana.
View Design System
·
Report Bug
·
Request Feature
Important
Hackathon entry for the TxODDS World Cup 2026 → Consumer & Fan Experiences track. Devnet only, fictitious tokens — no real money moves. Not affiliated with FIFA; no official marks are used.
104 matches · 1 TxLINE feed · 2 modes · 2 states per event (during / after)
Hatrick is designed to read as more than a demo: it is a consumer product loop where real-time sports data becomes play, social viewing, and settlement. The judging shortcut is simple:
- Unique concept: one TxLINE-powered engine drives both a live match arena and fantasy duels, instead of shipping another leaderboard, prediction widget, or chatbot.
- Clear TxLINE dependency: scores, events, odds, snapshots, replay, settlement, and fantasy progression all flow from the same provider-shaped pipeline.
- Consumer-first UX: email sign-in creates a Solana wallet invisibly, so a non-crypto fan can enter, get test funds, open packs, and place devnet bets without wallet setup friction.
- Real-time credibility: every event has a fast
duringstate for animation and a confirmedafterstate for settlement, making responsiveness and trust visible in the product. - Business path: Live betting margin, fantasy packs, market fees, and wallet retention form one economy instead of disconnected features.
Table of Contents
Hatrick turns the World Cup feed into a consumer game loop. Fans normally split their attention across score apps, fantasy tools, odds screens, and social feeds; Hatrick puts the core actions in one place: watch the match, bet the live market, collect cards, and play a squad duel.
- 🎮 Fantasy — open player packs, build your XI, and enter simulated 1v1 arena duels. Base cards are collectibles; live form and squad strength are informed by real player and team performance.
- 📺 Live — follow real matches as a 2D arena with play-by-play, odds, and in-match betting on one screen.
The defining mechanic: every event is emitted in two states —
during(optimistic, animates instantly) andafter(confirmed by TxLINE, authoritative). See Architecture.
TxLINE is the engine behind both modes, not just a logo in the footer.
| Mode | What TxLINE provides | What Hatrick turns it into |
|---|---|---|
| Fantasy | Player stats, lineups, goals, cards, shots, corners, final results, and confirmed after events |
Card form, squad strength, duel inputs, player context, and replayable fantasy moments |
| Live | Real-time score events, match clock, play-by-play actions, odds updates, snapshots, and confirmed results | 2D arena motion, event feed, odds board, bet slip, settlement, and late-join state recovery |
The value is the same signed feed creating two products: Live makes the match watchable and bettable now; Fantasy keeps the fan economy active before, during, and after the match.
- API: NestJS ·
@nestjs/event-emitter(event-driven) · Socket.IO · Axios - Front: Next.js (App Router) · shadcn/ui · Zustand · React Query · Solana Wallet Adapter · custom canvas game engine (framework-free TS)
- Data: TxLINE (SSE scores + odds, REST snapshots, oracle-signed settlement inputs) — see Data & Architecture
- Chain: Solana (devnet) · Anchor programs for betting, fantasy duels, packs, and provably-fair seeds
- Infra: Docker (Postgres + Redis) · GitHub Actions CI
|
Invite-only rooms to watch a match with friends — shared chat, social picks, and a match backdrop driven by the same feed. |
|
A polyglot monorepo of independent apps — nothing shared, no cross-app imports. Run each app on its own.
- Node.js 20+
- Docker (for Postgres + Redis)
- (optional) A Solana wallet such as Phantom — email sign-in works without one
- Rust, Solana CLI 2.2.16, and Anchor 0.31.1 when building or deploying
contracts/
# 1) API + infra (run from project/)
cd api
docker compose up -d # postgres :5432 + redis :6379
npm install # postinstall runs `prisma generate`
cp .env.example .env # set TXLINE_* to ingest live data
npm run prisma:deploy # apply migrations to a fresh DB
npm run start:dev # http://localhost:3001/health
# 2) Front (separate terminal)
cd front
npm install
cp .env.example .env.local
npm run dev # http://localhost:3000
# 3) Contracts (only when deploying or testing on-chain mode)
cd ../contracts
yarn install
anchor build --release
yarn test # local validator-backed Anchor testsThe API boots cleanly with
TXLINE_ENABLED=falseandSOLANA_ENABLED=false(no credentials needed). Seeapi/README.mdfor TxLINE and chain setup, andcontracts/README.mdfor Anchor build/deploy instructions.
Everything you see in Hatrick originates from TxLINE, TxODDS' real-time World Cup data product. There is no scraped or invented match data: one feed, one ingest path, many consumers.
| Source | What it carries | How we use it |
|---|---|---|
| TxLINE SSE — scores | Live match events (goals, cards, corners, possession…) with a confirmed flag |
The heartbeat of the whole app |
| TxLINE SSE — odds | Real-time market prices | Odds boards + in-match betting markets |
| TxLINE REST snapshots | Fixtures, lineups, current state | Fixture pages, initial state on connect |
| Solana devnet | TxLINE token activation plus Hatrick Anchor programs for betting, fantasy duels, card packs, and provably-fair seeds | Access to the feed is provisioned on-chain; app flows can run in play-money mode or chain-authoritative mode |
TxLINE SSE (scores + odds)
▼
[api] ingest → normalizer ──emits──► *.during (confirmed=false → optimistic, animate now)
│ in-memory state *.after (confirmed=true → authoritative, settle & recompute)
▼
EventEmitter2 ─► listeners (fantasy attributes · live markets · settlement)
▼
[api] WebSocket gateway ──► [front] one WS → Zustand stores → surfaces
The core contract: every domain event fires twice. *.during is the optimistic read (TxLINE confirmed=false) — it drives instant animation. *.after is the authoritative read (confirmed=true) — it settles bets, recomputes fantasy attributes, and locks the score. The UI feels instant and trustworthy because those are two different events, not one guess.
- Live: score events animate the arena; odds updates price the board; confirmed results settle bets.
- Fantasy: player/team performance updates card form and squad strength after confirmed events.
- Replay: finished matches run through the same pipeline, so demos show real TxLINE behavior without waiting for kickoff.
How Hatrick answers each judging criterion of the track:
| Criterion | How Hatrick answers it |
|---|---|
| Fan Accessibility & UX | One platform instead of three tabs: watch, play, and bet share one profile, wallet, and design system. Two clear modes from a single home; built for a non-technical fan. |
| Real-Time Responsiveness | The during/after contract makes latency a feature: the arena animates the instant an event arrives (*.during) and reconciles when TxLINE confirms it (*.after). One SSE ingest → WebSocket fan-out to every surface. |
| Originality & Value Creation | Not another picks leaderboard or pundit bot — a playable match simulation driven by real data. Live matches become a 2D arena; fantasy cards get stronger from real performances; both are the same engine fed by the same feed. |
| Commercial & Monetization Path | A closed economy with real monetization hooks: betting margin (Live), pack sales and market fees (Fantasy), and a wallet ledger connecting them. Responsible gaming built in (18+ gate, self-exclusion, stake limits) — table stakes for anything odds-adjacent. |
| Completeness & Execution | Functional end-to-end today: on-chain TxLINE token activation, four Anchor programs, live ingest, betting with settlement, pack → XI → 1v1 duels, replay for demos. Devnet, no real money. |
And the hard requirements: TxLINE as live input ✅ · Solana sign-up ✅ (wallet = Competitor account) · functional product, not a mockup ✅ · public repo + ≤5-min demo video with the submission.
🔗 Proof it's on-chain: program ids, deploy commands, and verification steps live in
contracts/README.md— and every pack buy, bet, and settlement in the app links straight to Solscan (devnet).
| App | Stack | Port | Status |
|---|---|---|---|
api/ |
NestJS, event-driven (TxLINE → DURING/AFTER → WebSocket) | 3001 | active |
front/ |
Next.js (App Router) + shadcn/ui + Zustand + React Query | 3000 | active |
contracts/ |
Anchor / Solana (devnet): betting, fantasy, packs, provably-fair seeds | — | active |
project/
├─ api/ # NestJS — event-driven, TxLINE ingest, WS gateway (+ docker-compose)
├─ front/ # Next.js — shadcn, Zustand, React Query, services/
└─ contracts/ # Anchor / Solana — betting, fantasy duels, packs, provably-fair seeds
- Monorepo scaffold (api + front), governance docs, CI, Docker infra
- Event-driven core with the
during/aftercontract - TxLINE integration — on-chain token activation, SSE ingest, snapshots, match replay through the live pipeline
- Live Mode — feed-driven 2D arena, live odds board, markets, in-match betting + settlement
- Fantasy Mode — packs, XI builder, dynamic attributes, 1v1 arena duels
- Responsible gaming — 18+ age gate, self-exclusion, stake limits
- Geo-blocking on betting surfaces (
proxy.ts,?geo=demobypass) - Contracts — Anchor programs for betting escrow, fantasy duel escrow, card packs, and provably-fair seeds
- Public deploy — live at hatrick.xyz + demo video with the submission
- On-chain proof — Solscan receipts for pack buys, bets, and settlements (devnet)
- Live social feed — real-time Events play-by-play with player names, HatBot reactions on the big beats, and live viewer picks across Live and Fantasy
- More matches & leagues — grow past the World Cup into TxODDS' wider catalog (350+ leagues, 30+ sports); ingest is league-agnostic, so activating a competition is config (
POST /token/activate {leagues}), not a rewrite - Crowd at scale — multi-user chat with moderation & ranking, plus X-style social balloons
- No FIFA IP — no official branding, logos, marks, or implied affiliation.
- Devnet only — fictitious tokens; no real-money movement during the hackathon.
- Geo-blocking — betting surfaces restrict regulated jurisdictions.
- Natural-person authorship — AI used as a tool; a human team owns the submission.
Distributed under the MIT License. See LICENSE.txt for details once the license file is added to the repository.
![]() Kauã Miguel Owner · @Kc1t |
![]() Deborah Pavanelli Colicchio Member · @eudehh |
![]() Pedro Henrique Member · @opedrooz |
Team Hatrick · X: @playhatrick · Repository: https://github.com/project-hattrick/hat-trick









