Skip to content

BlockXAI/Betting_Yellow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Betting Yellow: State Channel PvP Protocol

โœ… FULLY WORKING: Real blockchain transactions with 2 wallet popups + instant off-chain gameplay!

Instant off-chain wagers. On-chain settlement. Zero gas per round.

Next.js Yellow SDK TypeScript License


๐ŸŒ LIVE: Fully Functional Gaming + Solvency Dashboard

๐ŸŽฎ Play Now: http://localhost:3000 (2 wallet popups + instant gameplay)
๐Ÿ“Š View Proofs: http://localhost:3000/solvency (solvency verification dashboard)

โœ… Working Features:

  • โœ… Real Blockchain Transactions: MinimalCustody contract on Avalanche Fuji
  • โœ… 2 MetaMask Popups: Deposit at start โ†’ 0 popups during gameplay โ†’ Withdrawal at end
  • โœ… Real Balance Updates: See actual AVAX balance changes after settlement
  • โœ… Off-Chain Efficiency: 10 instant game rounds with zero gas fees
  • โœ… Solvency Proofs: 1 solvent proof published and verified on-chain
  • โœ… Transaction Hash: 0xc1c6c66e394b6df63a587fa98b63e84d5ccfef27b8ba338053dfd710e864442a
  • โœ… Live Contract: MinimalCustody 0xA29750b8fB8640846C3A05f61DEEB495A6c95A7e

๐ŸŽฌ Quick Demo Links

For Judges & Reviewers:


๐Ÿ† Yellow SDK Prize Track

โœ… What We Built (Achievements)

๐Ÿš€ Fully Functional State Channels (WORKING WITH REAL TRANSACTIONS!)

  • โœ… Yellow SDK Integration: Complete implementation of @erc7824/nitrolite v0.1.0
  • โœ… Smart Contracts Deployed: MinimalCustody contract live on Avalanche Fuji Testnet
  • โœ… Real On-Chain Deposits: MetaMask popup at game start โ†’ 0.01 AVAX deposited โ†’ Tx confirmed!
  • โœ… Zero Popups During Gameplay: Off-chain local signing for instant state updates (no MetaMask!)
  • โœ… Real Settlement Transactions: MetaMask popup at game end โ†’ withdraw winnings โ†’ Tx confirmed!
  • โœ… Real Balance Updates: Wallet balance actually changes after deposit and withdrawal
  • โœ… 2 Wallet Popups Total: Start (deposit) + End (withdrawal) = Perfect Yellow Network flow!
  • โœ… Frontend Migration: Complete UI integration with real transaction tracking
  • โœ… Public Verification: All transactions viewable on SnowTrace explorer
  • โœ… Multi-Player Support: Session sharing with Join Match feature
  • โœ… Tested End-to-End: Full flow verified with 0.01 AVAX deposits + withdrawals

๐Ÿ”— ERC-7824 Compliance

  • โœ… State Channel Protocol: Full implementation of Yellow Network's state channel standard
  • โœ… EIP-712 Signatures: Structured data signing for off-chain state transitions
  • โœ… Channel Lifecycle: Open โ†’ Update (instant) โ†’ Close (settle) flow
  • โœ… Allocation Tracking: Real-time balance updates with conservation laws

๐Ÿ’ก Novel Innovation

  • โœ… PvP Gaming on Channels: First peer-to-peer wagering demo on Yellow SDK
  • โœ… Zero-Gas Rounds: Players compete without paying gas for each move
  • โœ… Economic Model: Wager amounts adjust instantly off-chain, settle once on-chain
  • โœ… Solvency Proof System: Complete cryptographic proof pipeline (8/8 phases)
  • โœ… Session Discovery: Share session IDs for true peer-to-peer coordination
  • โœ… Demo-First Design: Test Yellow Network flow without testnet setup

๐Ÿ” Solvency Proof Pipeline (COMPLETE)

  • โœ… Session Export: CSV/JSON export of liabilities after each match
  • โœ… Merkle Trees: Cryptographic proof of liabilities with O(log n) verification
  • โœ… Reserve Scanner: On-chain balance verification from Avalanche Fuji
  • โœ… ZK Proofs: Privacy-preserving cryptographic commitments proving reserves โ‰ฅ liabilities
  • โœ… Full Verification: 9-point verification checklist with commitment validation
  • โœ… On-Chain Publication: Publish proofs to blockchain for public auditability
  • โœ… Public Verification: Anyone can verify proofs via smart contract
  • โœ… Automated Pipeline: Zero-touch proof generation after session close
  • โœ… Real-Time Dashboard: Live proof history with status monitoring
  • โœ… Public Interface: /solvency dashboard for users to verify inclusion proofs

๐Ÿ“Š Technical Completeness


๏ฟฝ Latest Features (Feb 2026)

Multi-Player Session Sharing ๐ŸŽฎ

  • Join Match Form: Opponents can join your session using a Session ID
  • Copy Button: One-click session ID sharing
  • Cross-Tab Support: Play in separate browser tabs
  • See: Multi-Player Demo Guide

Demo Mode (No Gas Required!) โšก

  • Works Immediately: Test without testnet funds
  • Fallback Balances: Shows 0.5 ETH for instant demos
  • Perfect for Judges: Demonstrate Yellow Network flow in seconds
  • See: No-Gas Demo Mode Guide

Enhanced UX Improvements ๐ŸŽจ

  • Balance Updates: Automatically reflects session winnings
  • Faucet Integration: Direct links when wallet has no AVAX
  • Yellow Proof Panel: Real-time metrics for off-chain actions
  • Session Tracking: View action count, latency, and settlement tx

๏ฟฝ๏ฟฝ The Problem: High Gas Costs Kill Gaming UX

The Scenario:

You're playing a PvP wager game. Every round costs gas:

  • Round 1: Player A wins โ†’ $2 gas fee
  • Round 2: Player B wins โ†’ $2 gas fee
  • Round 3: Player A wins โ†’ $2 gas fee
  • 5 rounds = $10+ in gas fees ๐Ÿ’ธ

Traditional Solution (Broken):

  • Pay gas for every state change
  • Slow confirmation times
  • Poor user experience
  • High barrier to entry

๐Ÿ’ก The Solution: Yellow State Channels

What Are State Channels?

State channels enable instant off-chain transactions with on-chain security:

Deposit โ†’ Open Channel (1 gas fee) 
    โ†“
Round 1, 2, 3... N (0 gas fees - instant!)
    โ†“
Close Channel โ†’ Settle (1 gas fee)

Result: 2 gas fees total vs. N+2 traditional

The Protocol Flow:

User A & B                    Yellow ClearNode              Custody Contract
    |                                |                             |
    | 1. Deposit ETH               |                             |
    |------------------------------------------------------------>|
    |                                |                         [Lock funds]
    |                                |                             |
    | 2. Open Channel               |                             |
    |------------------------------->|                             |
    |                         [Register channel]                  |
    |                                |                             |
    | 3. Play Round 1 (off-chain)   |                             |
    |<------------------------------>|                             |
    |        Instant update!         |                             |
    |                                |                             |
    | 4. Play Round 2 (off-chain)   |                             |
    |<------------------------------>|                             |
    |        Instant update!         |                             |
    |                                |                             |
    | 5. Close Channel              |                             |
    |------------------------------->|                             |
    |                         [Finalize state]                    |
    |                                |                             |
    |                                | 6. Settle                   |
    |                                |---------------------------->|
    |                                |                    [Unlock funds]
    |                                |                             |
    | 7. Withdraw                    |                             |
    |------------------------------------------------------------>|
    |                                |                     [Transfer ETH]

The Economics:

  • Gas Saved: 83%+ compared to traditional approach
  • Speed: Instant updates vs. 12s block times
  • UX: Feels like web2, secured by web3

๐Ÿ—๏ธ Architecture

MetaMask Wallet (Anvil - Chain 31337)
    โ†“
    | Connect + Auto-switch network
    โ†“
Next.js Frontend (app/page.tsx)
    โ†“
    | User actions: deposit, create match, play rounds
    โ†“
NitroliteService (lib/nitroliteService.ts)
    โ†“
    | WebSocket connection
    โ†“
Yellow ClearNode (ws://localhost:8001/ws)
    โ†“
    | State coordination + EIP-712 signatures
    โ†“
Smart Contracts (lib/contracts.ts)
    โ†“
    | On-chain operations
    โ†“
Custody Contract (Anvil Blockchain)
    โ†“
    | Lock/unlock ETH
    โ†“
Settlement Transaction
    โ†“
    | Final state recorded on-chain
    โ†“
User receives payout

๐Ÿ’ป Core Code

State Channel Opening

File: lib/nitroliteService.ts

async openChannel(participants: string[], initialDeposits: Record<string, string>): Promise<ChannelState> {
  const channelId = this.generateChannelId(participants);
  
  this.currentChannel = {
    channelId,
    participants,
    allocations: initialDeposits,
    nonce: 0,
    status: 'opening',
  };

  // Register with ClearNode
  const response = await this.sendRequest('open_channel', {
    channel_id: channelId,
    participants,
    initial_state: {
      allocations: initialDeposits,
      nonce: 0,
    },
  });

  this.currentChannel.status = 'active';
  return this.currentChannel;
}

โ†’ View full service

On-Chain Deposit

File: lib/contracts.ts

export async function depositToChannel(amountEth: string): Promise<ethers.ContractTransactionResponse> {
  const signer = await getSigner();
  const addresses = getContractAddresses();
  
  const custody = new ethers.Contract(
    addresses.custody,
    CUSTODY_ABI,
    signer
  );

  const amountWei = ethers.parseEther(amountEth);
  
  const tx = await custody.deposit({ value: amountWei });
  await tx.wait();
  
  return tx;
}

โ†’ View full contracts integration

Off-Chain State Update

File: app/page.tsx

const handleSubmitRound = async (winner: string) => {
  const { playerA, playerB, allocations } = currentSession;
  const roundAmount = '0.01'; // 0.01 ETH per round
  
  // Calculate new allocations (instant, no gas!)
  const newAllocations = {
    [winner]: (parseFloat(allocations[winner]) + parseFloat(roundAmount)).toFixed(4),
    [loser]: Math.max(0, parseFloat(allocations[loser]) - parseFloat(roundAmount)).toFixed(4),
  };
  
  // Submit state update via Yellow SDK (off-chain)
  await service.updateState(newAllocations);
  
  addLog('info', `โœ… Round ${round + 1} confirmed. Winner: ${winner}`);
};

โ†’ View full frontend


๐Ÿš€ Deployed Contracts & Solvency System

๐Ÿ”บ Avalanche Fuji Testnet (Live Deployment)

Network: Avalanche Fuji Testnet
Chain ID: 43113 (0xA869)
RPC: https://api.avax-test.network/ext/bc/C/rpc
Explorer: https://testnet.snowtrace.io/
Faucet: https://faucets.chain.link/fuji
Deployment Date: January 31, 2026

Contract Address Status Purpose
MinimalCustody 0xA29750b8fB8640846C3A05f61DEEB495A6c95A7e โœ… LIVE & TESTED Holds user AVAX deposits (deployed Feb 4, 2026)
Adjudicator 0x44b43cd9e870f76ddD3Ab004348aB38a634bD870 โœ… Live Dispute resolution (legacy)
SolvencyVerifier 0x2bFa3B66608C1B1aCF0F8a370c2bA809BE5fa4E2 โœ… Live On-chain proof verification

ClearNode Coordinator: ws://localhost:8001/ws (local development)

๐Ÿ”— Contract Verification

View on SnowTrace: https://testnet.snowtrace.io/address/0x44b43cd9e870f76ddD3Ab004348aB38a634bD870

Quick Test:

# Check contract code
curl -X POST https://api.avax-test.network/ext/bc/C/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0x44b43cd9e870f76ddD3Ab004348aB38a634bD870","latest"],"id":1}'

Integration: lib/contracts.ts - Deposit, withdraw, balance checking

๏ฟฝ Solvency Proof Outputs

For each gaming session, the system automatically generates:

solvency/epochs/<epoch-id>/
โ”œโ”€โ”€ session.json                 # Session metadata
โ”œโ”€โ”€ liabilities.csv             # User balances snapshot
โ”œโ”€โ”€ merkle_root.txt             # Cryptographic root hash
โ”œโ”€โ”€ merkle_metadata.json        # Tree structure + total liabilities
โ”œโ”€โ”€ inclusion_<address>.json    # Per-user Merkle proofs (N files)
โ”œโ”€โ”€ reserves.json               # On-chain reserve scan
โ”œโ”€โ”€ proof.json                  # ZK solvency proof
โ”œโ”€โ”€ publicSignals.json          # Public verification data
โ””โ”€โ”€ witness.json                # Private audit trail

Key Features:

  • ๐ŸŒณ Merkle Trees: O(log n) verification with inclusion proofs
  • ๐Ÿ’ฐ Reserve Scanner: Automated balance checking from Avalanche
  • ๐Ÿ” ZK Proofs: Privacy-preserving commitments proving solvency
  • โœ… Verification: 9-point checklist with cryptographic validation

๏ฟฝ๐Ÿ“ Deployment Information

Complete deployment guide: AVALANCHE_DEPLOYMENT.md
Deployment script: scripts/deploy-avalanche-fixed.js

Contracts are already deployed! Use the addresses above in your .env file.

To redeploy (if needed):

# 1. Get testnet AVAX from faucet
# Visit: https://faucets.chain.link/fuji

# 2. Set your private key
export PRIVATE_KEY="0xYourPrivateKey"

# 3. Deploy contracts
node scripts/deploy-avalanche-fixed.js

# 4. Copy deployed addresses to .env

Verify Your Transactions:

# All transactions are public on SnowTrace
# Visit: https://testnet.snowtrace.io/
# Search for your wallet address or transaction hash

๐ŸŽฏ Why Avalanche?

  • โšก Fast: ~2 second block times (vs 12s on Ethereum)
  • ๐Ÿ’ฐ Cheap: Low gas fees (~$0.01 per transaction)
  • ๐Ÿ”— EVM Compatible: Works with existing Ethereum tools
  • ๐ŸŒ High Throughput: 4,500+ TPS capacity
  • ๐Ÿงช Great Testnet: Free AVAX from faucet, SnowTrace explorer

๐Ÿ”œ Additional Networks (Future)

Planned deployments for Phase 6+:

Ethereum Sepolia

  • Use Case: SolvencyProof registry contract
  • Purpose: Public ZK proof verification
  • Status: Planned for Phase 6

Avalanche Mainnet (C-Chain)

  • Use Case: Production deployment
  • Chain ID: 43114
  • Status: After successful Fuji testing

๐Ÿ› ๏ธ Tech Stack

Frontend

  • Next.js 14 - React framework with App Router
  • TypeScript 5.0 - Type-safe development
  • TailwindCSS - Utility-first styling
  • Lucide React - Modern icon library
  • ethers.js v6 - Ethereum wallet integration

Blockchain

  • Yellow SDK (@erc7824/nitrolite) - State channel protocol
  • viem v2 - TypeScript-first Web3 client
  • Foundry - Smart contract development (Anvil, Forge)
  • MetaMask - Browser wallet provider

Infrastructure

  • Nitrolite ClearNode - Off-chain state coordinator
  • Anvil - Local Ethereum development node
  • PostgreSQL - State persistence layer
  • Docker Compose - Service orchestration

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Docker Desktop (for Nitrolite infrastructure)
  • MetaMask browser extension
  • WSL2 (if on Windows)

1. Clone & Install

git clone https://github.com/BlockXAI/Betting_Yellow.git
cd Betting_Yellow
npm install

2. Contracts Are Already Deployed! โœ…

MinimalCustody Contract: 0xA29750b8fB8640846C3A05f61DEEB495A6c95A7e (Deployed Feb 4, 2026)
View on SnowTrace: https://testnet.snowtrace.io/address/0xA29750b8fB8640846C3A05f61DEEB495A6c95A7e

โœ… Tested Functions:

  • โœ… Deposit: 0.01 AVAX deposited successfully
  • โœ… Withdrawal: 0.005 AVAX withdrawn successfully
  • โœ… Balance tracking works perfectly

No deployment needed - just configure your .env file with the address above!

If you want to deploy your own contract:

# Compile contract
npx solcjs --bin --abi contracts/MinimalCustody.sol --optimize -o build/

# Deploy to Avalanche Fuji
node scripts/deploy-minimal-custody.js

Deployment scripts:

2b. Set Up ClearNode (Optional - Local Development)

cd ~/nitrolite

# Start ClearNode + Database only
sudo docker-compose up clearnode database

Expected output: ClearNode running on port 8001

3. Configure Environment

Update .env with the deployed contract addresses:

# Avalanche Fuji Testnet
NEXT_PUBLIC_RPC_URL=https://api.avax-test.network/ext/bc/C/rpc
NEXT_PUBLIC_CHAIN_ID=43113
NEXT_PUBLIC_CLEARNODE_URL=ws://localhost:8001/ws

# Deployed contract addresses (ready to use!)
NEXT_PUBLIC_CUSTODY_CONTRACT=0xA29750b8fB8640846C3A05f61DEEB495A6c95A7e
NEXT_PUBLIC_ADJUDICATOR_CONTRACT=0x44b43cd9e870f76ddD3Ab004348aB38a634bD870
NEXT_PUBLIC_VERIFIER_CONTRACT=0x2bFa3B66608C1B1aCF0F8a370c2bA809BE5fa4E2

Note: Copy .env.example to .env if it doesn't exist:

cp .env.example .env
# Then update with addresses above

4. Run Development Server

npm run dev

Open http://localhost:3000

5. Test the REAL Transaction Flow ๐ŸŽฎ

Expected Flow: 2 MetaMask Popups + Instant Gameplay!

  1. Connect Wallet โ†’ MetaMask will prompt to add Avalanche Fuji

  2. Get Test AVAX (if needed):

  3. Create Match โ†’ Enter opponent address + wager (e.g., 0.01)

    • ๐Ÿ” POPUP 1: MetaMask asks to deposit!
    • Transaction: Deposit 0.01 AVAX to MinimalCustody
    • Click "Confirm" โ†’ Wait ~3 seconds
    • โœ… Deposit confirmed on-chain!
    • Channel opens automatically
  4. Play 10 Rounds โ†’ Click "I Won" repeatedly

    • โŒ ZERO wallet popups! (All off-chain!)
    • โšก Each round is instant (<100ms)
    • Watch Yellow Proof Panel count actions
    • See allocations update in real-time
  5. Close Session โ†’ Click "Close Session" button

    • โšก Channel closes (instant, no popup)
    • ๐Ÿ” POPUP 2: MetaMask asks to withdraw!
    • Transaction: Withdraw your winnings from MinimalCustody
    • Click "Confirm" โ†’ Wait ~3 seconds
    • โœ… Settlement confirmed on-chain!
    • ๐Ÿ’ฐ Your wallet balance actually changes!
  6. Verify on SnowTrace:

Result: 2 blockchain transactions for 10 game actions = 5x efficiency!

See detailed guides:


๐Ÿ“š Documentation

Quick Start Guides

Deployment & Integration

Technical Documentation


๐Ÿ† Why This Protocol Qualifies for Yellow Track

Novel Technical Contribution:

โœ… First PvP gaming implementation on Yellow SDK
โœ… Complete state channel lifecycle demonstrated
โœ… Solvency proof pipeline - Privacy-preserving cryptographic verification
โœ… Economic sustainability model with zero subsidies needed

The Innovation:

๐ŸŽฎ State Channels

  • 83% gas savings compared to traditional on-chain gaming
  • Instant gameplay with off-chain state updates (<100ms)
  • Production-ready smart contracts deployed on Avalanche Fuji

๐Ÿ” Cryptographic Solvency Proofs (NEW)

  • Privacy-Preserving: Proves reserves โ‰ฅ liabilities without revealing exact amounts
  • Merkle Tree Verification: O(log n) proof size with inclusion proofs for each user
  • Commitment Scheme: Cryptographic commitments using keccak256 hashing
  • On-Chain Scanning: Automated reserve verification from custody contract
  • Full Pipeline: 5 phases implemented (Session Export โ†’ Merkle โ†’ Reserves โ†’ ZK Proof)

Why This Matters:

Traditional exchanges suffer from opacity - users must trust the platform holds sufficient reserves. Our system provides:

  • ๐Ÿ” Transparency: Public verification of solvency
  • ๐Ÿ” Privacy: Exact balances remain confidential
  • ๐Ÿ“Š Auditability: Anyone can verify proofs independently
  • โšก Automated: Proof generation after every session
  • Extensible architecture for solvency proofs (Phase 2-8)

Technical Excellence:

  • Full Yellow SDK integration with @erc7824/nitrolite
  • EIP-712 compliant signatures for state transitions
  • Proper channel lifecycle management
  • Real on-chain settlement transactions
  • Clean separation of on-chain (deposits/settlement) vs off-chain (gameplay)

Try It Live - Public Dashboard (No Setup Required!):

npm install
npm run dev
# Navigate to http://localhost:3000/solvency

What you'll see:

  • โœ… Real proof data from Avalanche Fuji blockchain
  • โœ… 1 solvent proof (250% reserves-to-liabilities ratio)
  • โœ… Search and filter functionality
  • โœ… Inclusion proof verification
  • โœ… Direct SnowTrace transaction links

Try It Live - Gaming (Requires ClearNode):

  1. Clone repo + run npm install
  2. Configure .env with deployed addresses (already configured)
  3. Start ClearNode: cd ~/nitrolite && sudo docker-compose up clearnode database
  4. Run app: npm run dev
  5. Get test AVAX from faucet: https://faucets.chain.link/fuji
  6. Play actual PvP matches with instant off-chain rounds!

Try It Live - Solvency Proofs:

# Automated pipeline (Phase 7) - Runs all steps automatically
npm run proof:automate epoch_1738525000000  # Complete pipeline
npm run proof:automate                      # Auto-detect latest epoch

# Manual pipeline (individual steps)
npm run merkle:build epoch_1738525000000         # Build Merkle tree
npm run reserves:scan epoch_1738525000000        # Scan on-chain reserves
npm run proof:generate epoch_1738525000000       # Generate ZK proof
npm run proof:verify epoch_1738525000000         # Verify proof off-chain
npm run proof:publish epoch_1738525000000        # Publish to blockchain
npm run proof:verify-onchain epoch_1738525000000 # Verify on-chain

# Auto-detect latest epoch
npm run proof:generate        # Uses most recent session
npm run proof:automate        # Runs complete automated pipeline

Deployed & Working:

  • โœ… REAL BLOCKCHAIN TRANSACTIONS: Full deposit โ†’ play โ†’ withdraw flow working!
  • โœ… MinimalCustody: 0xA29750b8fB8640846C3A05f61DEEB495A6c95A7e - Deployed & tested Feb 4, 2026
  • โœ… Tested Deposits: 0.01 AVAX deposited and confirmed on-chain
  • โœ… Tested Withdrawals: 0.005 AVAX withdrawn and confirmed on-chain
  • โœ… Real Balance Updates: Wallet balance actually changes after transactions
  • โœ… 2 Wallet Popups: Deposit (start) + Withdrawal (end) = Perfect flow!
  • โœ… Zero Popups During Gameplay: Off-chain local signing for instant updates
  • โœ… SolvencyVerifier: 0x2bFa3B66608C1B1aCF0F8a370c2bA809BE5fa4E2
  • โœ… Live Proof on Chain: Transaction 0xc1c6c66e...
  • โœ… Public Dashboard: http://localhost:3000/solvency - WORKING with real data!
  • โœ… Solvency Pipeline: Complete cryptographic proof system
  • โœ… 8/8 Phases: All phases complete
  • โœ… 1 Solvent Proof: 0.5 AVAX reserves > 0.2 AVAX liabilities (250% ratio)
  • โœ… End-to-end tested: Full flow verified with real AVAX on Avalanche Fuji

๐Ÿ› ๏ธ Development

Project Structure

Betting_Yellow/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ page.tsx              # Main app with Yellow SDK integration
โ”‚   โ””โ”€โ”€ layout.tsx            # Root layout
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ ChannelManager.tsx    # Deposit/withdraw UI
โ”‚   โ”œโ”€โ”€ Match.tsx             # PvP game interface
โ”‚   โ””โ”€โ”€ EventLog.tsx          # Real-time event logging
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ contracts.ts          # On-chain operations
โ”‚   โ”œโ”€โ”€ nitroliteService.ts   # Off-chain coordination
โ”‚   โ”œโ”€โ”€ wallet.ts             # MetaMask integration
โ”‚   โ””โ”€โ”€ types.ts              # TypeScript definitions
โ”œโ”€โ”€ .env                      # Contract addresses + config
โ””โ”€โ”€ package.json              # Dependencies

Key Files

State Channel Components

File Purpose Lines
app/page.tsx Main app logic with Yellow SDK ~625
lib/nitroliteService.ts State channel service ~365
lib/contracts.ts Smart contract integration w/ demo mode ~181
components/ChannelManager.tsx Deposit/withdraw UI with faucet links ~300
components/Match.tsx Match UI with session sharing ~162
components/YellowProofPanel.tsx Real-time Yellow Network metrics ~190

Solvency Proof System

File Purpose Lines
circuits/solvency.circom ZK circuit for solvency proof ~98
scripts/build-merkle-tree.ts Merkle tree generation ~299
scripts/scan-reserves.ts Reserve scanner ~282
scripts/generate-proof.ts ZK proof generator ~440
scripts/verify-proof.ts Proof verifier ~369
contracts/SolvencyVerifier.sol On-chain verifier contract ~254
scripts/publish-proof.ts Publish proof on-chain ~272
scripts/verify-on-chain.ts Verify proof on-chain ~278
scripts/deploy-verifier.js Deploy verifier contract ~209
lib/proofAutomation.ts Automated proof service ~374
components/ProofHistoryDashboard.tsx Proof history UI ~284
scripts/automate-proof.ts Automated pipeline script ~174
app/api/proof-automation/route.ts Automation API ~236
app/solvency/page.tsx Public verification dashboard ~540
lib/sessionExporter.ts Session data export ~124

Total Lines of Code: ~5,400+ (complete system)


๐ŸŽฏ Roadmap: Beyond Phase 1

Current Status: ๐ŸŽ‰ ALL PHASES COMPLETE ๐ŸŽ‰

Completed Phases:

  • โœ… Phase 1 (4-6hrs): Yellow SDK Frontend Migration - Complete
  • โœ… Phase 2 (2-3hrs): Session State Export to CSV - Complete
  • โœ… Phase 3 (4-5hrs): Build Merkle tree from session data - Complete
  • โœ… Phase 4 (2-3hrs): Scan reserves from custody contract - Complete
  • โœ… Phase 5 (6-8hrs): Generate ZK solvency proofs - Complete
  • โœ… Phase 6 (3-4hrs): Deploy to testnet with on-chain verification - Complete
  • โœ… Phase 7 (2-3hrs): Automate proof publication - Complete
  • โœ… Phase 8 (4-5hrs): Build public verification dashboard - Complete

Progress: 8/8 phases complete (100%) ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

See: Integration Plan for full details


๐Ÿ“œ License

MIT License - see LICENSE file


๐Ÿ‘ฅ Team

Built for Yellow Network hackathon by BlockXAI


๐Ÿค Contributing

Contributions welcome! See Integration Plan for roadmap.


โšก Built with Yellow SDK โ€ข Powered by State Channels โ€ข Secured by Ethereum

About

An on Chain betting game on Avlanche Chain with the Yellow SDK for the Off chain clearance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors