Skip to content

project-hattrick/hatrick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

126 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Hatrick

Hatrick

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.
📄 Technical Documentation · 🎥 Demo Video

🌐 Live — hatrick.xyz » · Follow @playhatrick on X

CI License Solana Powered by TxLINE Hackathon

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.

Hatrick live arena demo

104 matches · 1 TxLINE feed · 2 modes · real-time arena + on-chain settlement

Tip

Try it in under a minute — no wallet, no gas. Open hatrick.xyz and sign in with an email — a Solana devnet wallet and test funds are set up for you automatically. Then open a pack or watch & bet the live match. Testing from a restricted region? Add ?geo=demo.  ·  🎥 Watch the 5-min demo

Evaluation Snapshot

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: the arena reacts to the feed live, and every bet settles from the authoritative TxLINE result — fast to watch, trustworthy to bet.
  • Business path: Live betting margin, fantasy packs, market fees, and wallet retention form one economy instead of disconnected features.
Table of Contents
  1. Evaluation Snapshot
  2. About the Project
  3. Features
  4. Built With
  5. Data & Architecture — powered by TxLINE
  6. Track Fit — Consumer & Fan Experiences
  7. Getting Started
  8. Apps
  9. Roadmap
  10. Compliance
  11. License
  12. Team & Contributors
  13. Contact

About the Project

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.

The Two Modes

  • 🎮 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: one authoritative feed drives everything on screen — the arena reacts to TxLINE in real time, and bets settle from its confirmed result. See Architecture.

How TxLINE feeds the modes

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, and confirmed final results 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 around the clock, match or no match.

(Back to top)

Features

📺 Live mode + in-match betting

Follow real matches as a 2D real-time arena shaped by the TxLINE feed, with live odds and in-match bets settled by the authoritative result.

Live 2D arena with odds and in-match betting

⚔️ Fantasy 1v1 duels

Build your XI from the cards you own and stake in a simulated 1v1 arena duel rendered by the custom canvas engine. Card ratings and TxLINE-informed form seed the simulation — challenge a friend or get matched; the wager settles to the winner and the result is provable.

Fantasy 1v1 duel — arena

🃏 Packs & cards · 🛒 store & wallet

Open packs to reveal player stickers — base rating, country, and rarity — each minted as a Metaplex Core NFT on Solana devnet (serial-numbered, capped supply, provably-fair pull), so your collection lives in your own wallet. A themed store and a single wallet tie both modes together: sign in with just an email and a Solana wallet is created invisibly (Privy), or connect Phantom.

Opening a sticker pack Team store & market
  • Base card identity stays fixed; live form is recomputed from TxLINE player and match stats.
  • Cards feed the Fantasy 1v1, where real performance influences squad strength.
  • Wager balance shows as a stablecoin ticker (devnet); betting is gated to wallet accounts, with compliance built in (18+, geo-block, self-exclusion).

🗣️ Live social — feed, chat, HatBot & 👥 watch-together rooms

Every live match and Fantasy duel carries a social panel — Stats, a real-time Events feed (the full play-by-play, with player names), and Chat. HatBot jumps in on the big beats — goals, reds, penalties, VAR — the instant they land, and crowd moments surface as comic-style speech balloons over the stands. Prefer to watch with friends? Spin up an invite-only room — shared chat, social picks, and a match backdrop driven by the same feed.

Live events feed, chat, and HatBot Watch-together room

HatBot is a nicely-formatted feed of real events — by design not AI.

(Back to top)

Built With

TypeScript NestJS Next.js React Tailwind Solana Docker

  • 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

(Back to top)

Data & Architecture — powered by TxLINE

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.

Where the data comes from

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

One feed, many consumers

TxLINE SSE (scores + odds)
        ▼
[api] ingest → normalizer → in-memory match state
        ▼
   EventEmitter2 ─► listeners (fantasy attributes · live markets · settlement)
        ▼
[api] WebSocket gateway ──► [front] one WS → Zustand stores → surfaces
        ▼
   arena animates in real time · bets settle on TxLINE's confirmed result

The core idea: one authoritative feed drives every surface. TxLINE events flow through a single normalizer into an in-memory match state, fan out to listeners (live markets, fantasy attributes, settlement), and reach the frontend over one WebSocket. The arena reacts the instant an event arrives; bets settle from TxLINE's confirmed result. One pipeline feeding every screen — instant to watch, authoritative when it counts.

What the feed drives on screen

  • 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 once events are confirmed.
  • Replay: finished matches run through the same pipeline, so demos show real TxLINE behavior without waiting for kickoff.

📄 Go deeper — full technical documentation. The complete writeup lives in docs/technical-documentation.md: the event-driven architecture, the full list of TxLINE endpoints we use, the wire-format gotchas we solved (score truth, regulation vs. extra time, naming events, gap-filling), and how the four Solana programs handle betting, duels, packs, and provably-fair seeds.

(Back to top)

Track Fit — Consumer & Fan Experiences

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 Real-time by design: the arena animates the instant an event arrives and settles from TxLINE's confirmed result. 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).

(Back to top)

Getting Started

A polyglot monorepo of independent apps — nothing shared, no cross-app imports. Run each app on its own.

Prerequisites

  • 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/

Installation

# 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 tests

The API boots cleanly with TXLINE_ENABLED=false and SOLANA_ENABLED=false (no credentials needed). See api/README.md for TxLINE and chain setup, and contracts/README.md for Anchor build/deploy instructions.

(Back to top)

Apps

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

(Back to top)

Roadmap

  • Monorepo scaffold (api + front), governance docs, CI, Docker infra
  • Event-driven core — real-time ingest, one WebSocket fan-out, authoritative settlement
  • 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=demo bypass)
  • 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

(Back to top)

Compliance

  • 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.

(Back to top)

License

Distributed under the MIT License. See LICENSE.txt for details once the license file is added to the repository.

(Back to top)

Team & Contributors

Kauã Miguel
Kauã Miguel

Owner · @Kc1t
Deborah Pavanelli Colicchio
Deborah Pavanelli Colicchio

Member · @eudehh
Pedro Henrique
Pedro Henrique

Member · @opedrooz

(Back to top)

Contact

Team Hatrick · X: @playhatrick · Repository: https://github.com/project-hattrick/hatrick

(Back to top)

About

One platform, two ways to live the 2026 World Cup - a 2.5D fantasy and a live 2D match view, both powered by the TxLINE real-time feed on Solana.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors