Skip to content

itublockchain/Gambit-ETHGlobal-Cannes-2026

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gambit

How It Works β€’ Architecture β€’ Features β€’ Contracts β€’ Quick Start


Gambit is a native iOS + Apple Watch app for trading 5-minute crypto prediction markets. Swipe right for UP, swipe left for DOWN β€” trade executes in ~3 seconds. No seed phrases, no browser extensions, no complex DeFi interfaces. Just your watch and a market opinion.


⌚ GAMBIT β€” Prediction Markets on Your Wrist

πŸ”΄ The Problem

Prediction markets are powerful tools for price discovery and hedging, but they're trapped behind desktop-only interfaces that require technical crypto knowledge. Polymarket β€” the largest prediction market β€” has no mobile trading, no watch app, and requires manual wallet management.

Meanwhile, millions of people check their Apple Watch dozens of times a day. What if they could act on a market view in 2 seconds?

πŸ’‘ The Solution

Gambit brings prediction markets to the most personal device you own. Real-time crypto charts on your wrist, instant swipe-to-trade, and automatic settlement β€” all powered by an embedded MPC wallet that requires zero crypto knowledge from the user.


⚑ How It Works

  1. πŸ“± Open iPhone app β†’ tap "Get Started" β†’ sign in with email (no seed phrase)
  2. πŸ” Wallet is created automatically and configured for trading (one-time, ~10 seconds)
  3. πŸ’° Deposit USDC to your wallet address
  4. ⌚ Open Apple Watch β†’ see live crypto charts β†’ swipe to trade
  5. πŸ† Watch positions resolve β†’ claim winnings from iPhone

πŸ”§ Under the Hood (~3 seconds)

Watch swipe
  β†’ WatchConnectivity message to iPhone
  β†’ iPhone asks backend to prepare EIP-712 order data
  β†’ Dynamic embedded wallet silently signs (no user prompt)
  β†’ Backend submits signed order to Polymarket CLOB
  β†’ Polymarket matches the order (Fill-or-Kill)
  β†’ Result flows back to Watch with haptic feedback

The user never sees a transaction, never approves a popup, never deals with gas.


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     WatchConnectivity     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Apple Watch β”‚ ◄──────────────────────► β”‚   iPhone    β”‚
β”‚  SwiftUI    β”‚    price data + trades    β”‚  SwiftUI    β”‚
β”‚  Charts     β”‚                           β”‚  Dynamic SDKβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                           β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                                                  β”‚ HTTPS
                                                  β–Ό
                                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                          β”‚   Backend    β”‚
                                          β”‚  Fastify+TS  β”‚
                                          β”‚  PostgreSQL  β”‚
                                          β”‚    Redis     β”‚
                                          β””β”€β”€β”¬β”€β”€β”€β”¬β”€β”€β”€β”¬β”€β”€β”˜
                                             β”‚   β”‚   β”‚
                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   └──────────────┐
                              β–Ό                  β–Ό                  β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚  Polymarket  β”‚  β”‚   Binance    β”‚  β”‚   Polygon    β”‚
                      β”‚  CLOB API   β”‚  β”‚  WebSocket   β”‚  β”‚     RPC      β”‚
                      β”‚  Orders     β”‚  β”‚  BTC/ETH/XRP β”‚  β”‚   USDC/CT    β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Layer Technology Purpose
πŸ“± iOS App SwiftUI, Combine, Dynamic SDK Native UI + embedded MPC wallet
⌚ watchOS App SwiftUI, WatchConnectivity Swipe-to-bet + live charts
βš™οΈ Backend Node.js, TypeScript, Fastify Order orchestration + market discovery
πŸ—„οΈ Database PostgreSQL + Drizzle ORM Users, wallets, orders, audit log
⚑ Cache Redis Market data, L2 creds, price history
⛓️ Blockchain Polygon PoS, Arc Testnet Polymarket settlement + custom markets
πŸ“ˆ Market Data Binance WebSocket, Polymarket CLOB Real-time spot prices + odds
πŸ”— Oracle Chainlink CRE Decentralized market settlement
πŸ” Wallet Dynamic.xyz Embedded MPC wallet, no seed phrases
🌐 Deployment Hetzner Helsinki, Caddy Auto SSL, no VPN needed

✨ Key Features

⌚ Swipe-to-Bet on Apple Watch β€” See a 60-second live price chart, swipe right for UP or left for DOWN. Digital Crown selects bet amount. Trade executes in ~3 seconds with haptic feedback.

πŸ” Zero-Friction Onboarding β€” Sign in with email, wallet is created automatically. No seed phrases, no browser extensions, no MetaMask popups. Dynamic's MPC wallet handles everything.

✍️ Client-Side Signing β€” All blockchain transactions are signed on the iPhone using Dynamic's embedded wallet SDK. The backend never has access to private keys. Custodial-level UX with self-custodial security.

πŸ”„ Dual Settlement Layer β€” Trade on Polymarket (Polygon) for deep liquidity, or switch to Arc Testnet for custom prediction markets with Chainlink CRE settlement. Toggle between networks from settings.

πŸ“‘ Real-Time Price Pipeline β€” Binance WebSocket β†’ Redis β†’ SSE β†’ iPhone β†’ WatchConnectivity β†’ Watch. Sub-second price updates across the entire stack.

πŸ€– Automatic Settlement β€” 5-minute markets resolve automatically. Chainlink CRE fetches final price, achieves DON consensus, and calls settleMarket() on-chain. Winners receive USDC automatically.


πŸ“œ Smart Contracts

GambitMarket.sol β€” Arc Testnet

Deployed at 0xfE3dd8F80051B2F3da054F8657BaF016478697bD

Function Description
createMarket(asset, strikePrice, duration) Creates a new 5-min prediction market
placeBet(marketId, direction, amount) Places a USDC bet on UP or DOWN
settleMarket(marketId, finalPrice) Resolves market with final price (CRE or operator)
claim(marketId) Winners withdraw proportional USDC payout
requestSettlement(marketId) Emits SettlementRequested event for CRE

Polymarket Contracts β€” Polygon

Contract Address Usage
CTF Exchange 0x4bFb41d5...982E Order matching engine
Neg Risk Exchange 0xC5d563A3...f80a Negative risk markets
Conditional Tokens 0x4D97DCd9...0045 ERC-1155 outcome tokens
USDC.e 0x2791Bca1...4174 Settlement token

πŸ”— Chainlink CRE Integration

The CRE workflow provides decentralized, trustless market settlement:

1. πŸ“‹ Contract emits SettlementRequested(marketId, asset, strikePrice, endTime)
2. πŸ‘οΈ CRE DON nodes detect the event via LogTrigger
3. 🌐 Each node fetches price from Binance API via HTTPClient
4. 🀝 Nodes reach consensus on the price (identical aggregation)
5. πŸ“ Workflow generates a signed report with encoded settlement data
6. ⛓️ Report is written on-chain β†’ settleMarket() executes
7. πŸ’Έ Winners receive proportional USDC payout

Compiled to WASM. Backend provides an operator fallback for demo.


πŸ›‘οΈ Security Model

Layer Approach
πŸ”‘ Key Management Dynamic MPC β€” key shares split between infra and device
✍️ Signing Client-side EIP-712 on iPhone β€” backend never touches keys
🎫 Sessions JWT tokens stored in iOS Keychain
πŸ”’ API Auth HMAC L2 signatures on every Polymarket call
🌐 RPC Custom Polygon endpoint β€” no rate-limited defaults

πŸ“ Project Structure

gambit/
β”œβ”€β”€ backend/                    # βš™οΈ Node.js Fastify server (Polymarket)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ modules/            # auth, orders, markets, wallet, prices
β”‚   β”‚   β”œβ”€β”€ lib/                # polymarket client, dynamic SDK, errors
β”‚   β”‚   β”œβ”€β”€ plugins/            # postgres, redis, auth, websocket
β”‚   β”‚   └── db/                 # schema + migrations (Drizzle)
β”‚   └── package.json
β”œβ”€β”€ ios/
β”‚   β”œβ”€β”€ Gambit/                 # πŸ“± iPhone app (SwiftUI)
β”‚   β”‚   β”œβ”€β”€ Auth/               # AuthManager, DelegationManager, Keychain
β”‚   β”‚   β”œβ”€β”€ Views/              # LoginView, DashboardView, OnboardingView
β”‚   β”‚   β”œβ”€β”€ Networking/         # APIClient, WebSocketManager
β”‚   β”‚   └── WatchBridge/        # WatchSessionManager
β”‚   β”œβ”€β”€ GambitWatch/            # ⌚ Apple Watch app (SwiftUI)
β”‚   β”‚   β”œβ”€β”€ Views/              # MarketView, ActivePositionView, Charts
β”‚   β”‚   └── Connectivity/       # PhoneConnector, HTTPFallback
β”‚   └── Shared/                 # SharedModels, MessageKeys
β”œβ”€β”€ arc/
β”‚   β”œβ”€β”€ contracts/              # πŸ“œ GambitMarket.sol (Foundry)
β”‚   β”œβ”€β”€ cre-workflow/           # πŸ”— Chainlink CRE TypeScript workflow
β”‚   └── backend/                # βš™οΈ Arc-specific Fastify server
└── README.md

πŸš€ Quick Start

Prerequisites

  • Node.js v22+, npm
  • PostgreSQL, Redis
  • Xcode 16+ (for iOS/watchOS)
  • Foundry (for smart contracts)

Backend

cd backend
cp .env.example .env  # fill in credentials
npm install
npx drizzle-kit migrate
npm run dev

iOS App

cd ios
open Gambit.xcodeproj
# Select Gambit scheme β†’ Build & Run on iPhone
# Select GambitWatch scheme β†’ Build & Run on Watch

Arc Contracts

cd arc/contracts
forge build
forge script script/Deploy.s.sol --rpc-url https://rpc.testnet.arc.network --broadcast

CRE Workflow

cd arc/cre-workflow
bun install
bunx cre-compile main.ts gambit-workflow.wasm --skip-type-checks

πŸ‘₯ Team

Built by ITU Blockchain at ETHGlobal Cannes 2026.


πŸ† Bounty Submissions

πŸ” Dynamic β€” Embedded Wallet SDK

Native iOS embedded MPC wallet with client-side EIP-712 signing. Zero seed phrases, silent transaction signing, custom Polygon RPC configuration via evmNetworks.

🌐 Arc/Circle β€” Best Prediction Markets on Arc

GambitMarket.sol deployed on Arc Testnet. USDC-native settlement, 5-minute binary options on BTC/ETH/XRP. Stablecoin gas model.

πŸ”— Chainlink β€” Best CRE Workflow

TypeScript CRE workflow for decentralized market settlement. Fetches price from Binance via HTTPClient, DON consensus, signed report settles markets on-chain. Compiled to WASM.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors