Skip to main content

Platform Architecture

Hunch employs a hybrid architecture that combines blockchain’s trust guarantees with traditional infrastructure’s performance characteristics.

System Components

LayerTechnologyPurpose
BlockchainBase (Coinbase L2)Settlement, token transfers, bet execution
Smart ContractsSolidity / EVMToken logic, betting pools, payouts
WalletsPrivy + ZeroDevAuthentication, smart accounts, session keys
BackendNode.js on RailwayAPI, market sync, settlement automation
DatabaseSupabase (PostgreSQL)User data, market cache, analytics
FrontendReact NativeiOS, Android, and web from single codebase
Data SourcePolymarket APIMarket questions, odds, resolution data

Why This Stack

Base (Coinbase L2)

Sub-cent Fees

Transaction fees enable micro-bets

2-Second Finality

Responsive user experience

Coinbase Ecosystem

Credibility and on-ramp integration

EVM Compatible

Proven Solidity patterns

Privy + ZeroDev

Privy

Industry-leading auth with 10M+ users across clients

ZeroDev

Best-in-class ERC-4337 implementation

Combined

Social login → Smart account in one flow

Session Keys

Eliminate transaction popups entirely

React Native

  • Single codebase for iOS, Android, and web
  • Near-native performance for swipe interactions
  • Large talent pool and ecosystem
  • Proven at scale (Instagram, Coinbase, Discord)

Data Flow

┌─────────────────────────────────────────────────────────────────┐
│                        FRONTEND                                  │
│                                                                  │
│  1. User logs in via Privy                                      │
│  2. ZeroDev creates smart account                               │
│  3. User approves session key (one-time)                        │
│  4. User swipes YES on a market                                 │
│  5. Frontend calls HunchManager.placeBet()                      │
│  6. Session key signs (no popup)                                │
│  7. Frontend calls POST /api/bets to record                     │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│                        BACKEND                                   │
│                                                                  │
│  - Records bet in Supabase                                      │
│  - Every 15 min: checks Polymarket for resolved markets         │
│  - When resolved: calls HunchManager.settleBet()                │
│  - Updates bet status in database                               │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│                     SMART CONTRACTS                              │
│                                                                  │
│  HunchToken: Holds user balances                                │
│  HunchManager: Holds betting pools, pays winners                │
└─────────────────────────────────────────────────────────────────┘

Scalability

The architecture is designed to scale to millions of users:
ComponentCapability
Horizontal ScalingStateless API servers behind load balancer
DatabaseSupabase handles 10,000+ concurrent connections
BlockchainBase processes 1M+ daily transactions
CachingRedis layer planned for high-frequency data
Current infrastructure supports ~100K monthly active users. Scale upgrades are straightforward and budgeted in growth plans.