Skip to content

Cassxbt/Arcadeonarc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

117 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ARCade on Arc

Provably Fair Onchain Gaming with Sub-350ms USDC Settlements

Live Demo Arc Testnet License


Problem

Traditional online gaming platforms suffer from three critical bottlenecks:

  1. Settlement Latency: 12-60 second transaction finality creates poor UX for real-time games
  2. Price Volatility: Gas tokens (ETH, MATIC) cause unpredictable transaction costs
  3. High Fees: $2-50 per bet on Ethereum makes microtransactions economically infeasible

These constraints limit blockchain gaming to slow-paced, high-stakes use cases, excluding the $127B casual gaming market.

Solution

ARCade leverages Arc blockchain's sub-350ms deterministic finality and USDC-native architecture to deliver:

  • Instant Settlements: <350ms bet-to-payout eliminates perceived latency
  • Stable Costs: USDC gas payments provide predictable $0.01 transaction fees
  • Real-Time Games: Crash, Tower, and Dice games feel like Web2 applications

By solving the finality-cost-volatility trilemma, ARCade demonstrates Arc's viability for consumer-facing DeFi applications requiring Web2-like responsiveness.


Product Overview

ARCade is a decentralized gaming protocol featuring five provably fair games deployed on Arc L1. The platform uses a central Vault contract for liquidity management, game-specific controllers for outcome verification, and a Next.js frontend with real-time balance synchronization.

Core Architecture

User Wallet (USDC)
    ↓ deposit
Vault Contract (liquidity pool)
    ↓ authorize
Game Controllers (Dice, Crash, Tower, Wheel, Laser)
    ↓ settle
Vault Contract (auto-payout)
    ↓ withdraw
User Wallet (USDC + winnings)

Technical Stack

Layer Technology Purpose
Frontend Next.js 16 (App Router) + React 19 Server-side rendering, API routes
Styling CSS Modules + Framer Motion Component isolation, animations
Blockchain Solidity 0.8.20 (Foundry) Smart contracts, deployment scripts
Network Arc Testnet (Reth-based) USDC-native L1 with <350ms finality
Authentication Dynamic SDK Multi-wallet support (MetaMask, WalletConnect, browser wallets)
Database Supabase (PostgreSQL) User stats, leaderboards, real-time subscriptions
State Management React Context + BroadcastChannel Cross-tab balance synchronization
Cross-Chain Circle CCTP v2 (Bridge Kit v1.5.0) USDC bridging from 8 chains
Faucet Circle Faucet API In-app testnet USDC distribution

Game Portfolio

Game Mechanic House Edge Max Multiplier Contract
Dice Roll target prediction 10% 99x 0xB91ddf...
Crash Cash out before crash 5% 100x 0x09e1bC...
Tower Climb without hitting mines 10% 100x 0x7d1F09...
Wheel Segment prediction 4% 3.5x 0x104Ac6...
Laser Grid target selection 4% 95x 0xcBdff4...

Market Analysis

Total Addressable Market (TAM)

The global online casino market is projected at $127.3B by 2027 (CAGR 11.7%). Blockchain-based platforms are capturing increasing share due to:

  • Provable fairness (verifiable RNG vs black-box odds)
  • Instant withdrawals (crypto vs 3-5 day bank transfers)
  • Regulatory arbitrage (permissionless access)

Serviceable Addressable Market (SAM)

Crypto gaming and betting generated $4.6B in 2023, with 15.3% projected CAGR through 2030. Key drivers:

  • Stablecoin adoption reducing volatility friction
  • High-throughput blockchains enabling sub-$1 transaction costs
  • Institutional custody solutions bringing regulated capital

Target Audience

  • Demographics: Crypto-native users aged 21-45
  • Psychographics: Value transparency, instant settlements, provably fair mechanics
  • Behavior: Currently use centralized casinos (Stake, Rollbit) but distrust house fairness
  • Pain Point: High Ethereum gas fees force $50+ minimum bets, excluding casual players

Beachhead Market: Ethereum-native gamblers priced out by gas fees who would switch for 10x lower costs and instant finality.


Competitive Positioning

Direct Competitors

Platform Blockchain Finality Tx Cost Gas Token Provably Fair
ARCade Arc L1 350ms $0.01 USDC On-chain
Rollbit Arbitrum 2s $0.42 ETH On-chain
Wolf.bet Multi-chain 2-15s $0.50-5 Multi Hash-based
Stake Multi-chain 2-15s $0.10-2 Multi Hash-based
Polymarket Polygon 2s $0.08 MATIC On-chain

Unique Selling Proposition

ARCade is the only gaming platform leveraging Arc's USDC-native architecture, eliminating:

  1. Gas Token Volatility: Competitors require users to hold ETH/MATIC, introducing 20-40% price swings that distort true costs
  2. Settlement Latency: 350ms finality is 6-40x faster than alternatives, enabling real-time game mechanics
  3. Wrapped Token Risk: Native USDC vs bridged variants removes smart contract exposure

Switching Cost Analysis: Users on Ethereum L1 pay $2-20/bet. At $5 average cost, a player making 100 bets/month spends $500 on gas. ARCade reduces this to $1/month, creating $499/month savings—sufficient incentive to overcome platform switching friction.


Revenue Model

Revenue Stream

House Edge (4-10% depending on game complexity)

  • Laser: 4% (grid-based selection)
  • Wheel: 4% (segment prediction)
  • Crash: 5% (cash-out timing)
  • Dice: 10% (roll prediction)
  • Tower: 10% (multi-step climbing)

House edge is enforced on-chain via multiplier calculations in each game contract. The Vault accumulates house balance from losing bets, withdrawable by the contract owner.


Circle Integration & Developer Feedback

USDC as Settlement Currency

Why We Chose USDC

  1. Arc's Native USDC: Using USDC for gas eliminates ETH/MATIC volatility that plagues competitors
  2. Regulatory Clarity: Circle's compliance (NYDFS BitLicense, EU MiCA) de-risks future expansion
  3. Liquidity: USDC's deep market liquidity ensures reliable user on/off ramps

What Worked Well

  • Circle's USDC contract on Arc Testnet had 100% uptime during development
  • ERC20 standard compliance made integration simpler using existing Viem patterns
  • Testnet faucet (faucet.circle.com) provided seamless USDC access for testing; our in-app faucet wraps this for a frictionless onboarding experience
  • Bridge Kit SDK's data-driven architecture makes adding new chains trivial — Monad Testnet was integrated in under an hour with zero changes to bridge logic or UI
  • Bridge Kit v1.5.0 auto-retry for expired attestations replaced our manual retry logic, improving reliability on testnets
  • CCTP attestation times were consistent (30-60 seconds on testnet)
  • Circle MCP tools accelerated development by providing accurate SDK documentation

Areas for Improvement

  • Bridge Kit's Circle Wallets adapter (added Nov 2025) supports developer-controlled wallets but is server-side only. Client-side support for passkey-based modular wallets combined with CCTP bridging would significantly improve onboarding for non-crypto users
  • No official documentation or example repos for embedded wallet providers (Dynamic Labs, Privy) with Bridge Kit. Developers must add chains to both Bridge Kit config and their wallet provider's network config — this is not covered in Circle docs
  • Gateway support for newer chains like Monad would be valuable for instant cross-chain transfers

Cross-Chain USDC Bridging (Circle CCTP v2)

Users holding USDC on external chains can bridge directly to Arc without leaving the app via Circle's Bridge Kit SDK with the Viem v2 adapter.

Supported Source Chains

Chain Domain Chain ID Status
Arbitrum Sepolia 3 421614 Live
Base Sepolia 6 84532 Live
OP Sepolia 2 11155420 Live
Ethereum Sepolia 0 11155111 Live
Avalanche Fuji 1 43113 Live
HyperEVM Testnet 19 998 Live
Monad Testnet 15 10143 Live
Sei Atlantic 16 1328 Live

Destination: Arc Testnet (Domain 26, Chain ID 5042002)

User Flow

User opens Deposit Modal
  → Picks source chain from dropdown
  → Enters USDC amount → Confirms
  → Bridge Kit burns USDC on source chain
  → Circle attestation service verifies (~30-60s)
  → Native USDC minted on Arc Testnet
  → Balance available to play

Both external wallets (MetaMask, Rabby, WalletConnect) and embedded wallets (Dynamic Labs email login) are supported. Adding a new source chain requires only a config entry in cctp-config.ts and a network entry in dynamic.tsx for embedded wallet support.

In-App Faucet

Integrated testnet faucet eliminates the need to visit external sites.

  • Multi-chain support (Arc, Ethereum, Base, Arbitrum, OP, Avalanche)
  • 10 USDC per request
  • 24-hour cooldown per chain
  • Explorer link on success

Technical Implementation

Architecture with Circle Infrastructure

┌─────────────────────────────────────────────────────────────┐
│                    User Entry Points                         │
├─────────────────────────────────────────────────────────────┤
│  Crypto User (ETH USDC)  │  Non-Crypto User (planned)      │
└──────────┬────────────────┴──────────────┬──────────────────┘
           │                               │
           │ Circle CCTP Bridge            │ Circle Gateway (planned)
           │                               │
           ▼                               ▼
    ┌──────────────────────────────────────────────┐
    │         Circle Infrastructure Layer          │
    │  - CCTP Attestation Service                  │
    │  - Gateway Payment Processing (planned)      │
    │  - USDC Minting on Arc L1                    │
    └──────────────────┬───────────────────────────┘
                       │
                       ▼
    ┌──────────────────────────────────────────────┐
    │            Arc L1 Blockchain                 │
    │  - User Wallet (USDC balance)                │
    │  - ARCade Vault Contract                     │
    │  - Game Controllers (Dice, Crash, etc.)      │
    └──────────────────────────────────────────────┘

Security Hardening

Access Control

  • Vault uses OpenZeppelin AccessControl for game authorization
  • Only whitelisted game controllers can debit user balances
  • Owner can pause all contracts via emergency stop

API Security

  • HMAC-SHA256 signatures required for all settlement API calls
  • Rate limiting: 20 requests/minute per IP (Upstash Redis)
  • Request replay protection via nonce tracking

Test Coverage

  • 51 unit tests covering Vault accounting, game logic, and access control
  • Foundry invariant testing for Vault balance integrity
  • Integration tests with forked Arc Testnet state

Performance Benchmarks (Arc Testnet)

Metric Value Context
Bet → Settlement 340ms Average across development testing
Gas Cost (avg) $0.009 Sample of 100+ transactions
Failed Txs/1000 0.2 Under sustained load testing

Quick Start

Prerequisites

Installation

# Clone repository
git clone https://github.com/Cassxbt/Arcadeonarc.git
cd Arcadeonarc

# Install frontend dependencies
cd arcade && npm install

# Install contract dependencies
cd ../contracts && forge install

Environment Setup

Create arcade/.env.local:

# Dynamic Wallet Auth
NEXT_PUBLIC_DYNAMIC_ENVIRONMENT_ID=your_dynamic_id

# API Security
API_SIGNING_SECRET=your_secret_key
SIGNER_PRIVATE_KEY=0x_your_private_key

# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

# Rate Limiting (Upstash Redis)
UPSTASH_REDIS_REST_URL=your_upstash_url
UPSTASH_REDIS_REST_TOKEN=your_upstash_token

# Circle API (for in-app faucet)
CIRCLE_API_KEY=your_circle_api_key

Run Development Server

cd arcade
npm run dev
# Navigate to http://localhost:3000

Deploy Contracts

cd contracts
forge script script/Deploy.s.sol --rpc-url $ARC_TESTNET_RPC --broadcast --verify

Performance Metrics

  • Transaction Finality: <350ms (Arc blockchain)
  • API Response Time: <50ms (P95)
  • Frontend Load Time: <1.2s (First Contentful Paint)
  • Realtime Sync Latency: <100ms (Supabase WebSocket)
  • Smart Contract Gas: 21,000 gas/bet ($0.01 at current Arc gas prices)

Acknowledgments

  • Arc Network: For providing the fastest USDC-native blockchain enabling real-time gaming
  • Circle: For USDC infrastructure, CCTP Bridge Kit SDK, Gateway, and Faucet API
  • Dynamic Labs: For seamless multi-wallet authentication
  • Supabase: For real-time database synchronization
  • Foundry: For best-in-class Solidity testing framework

License

This project is licensed under the MIT License - see LICENSE for details.


Links


Built with ❤️ by @Cassxbt

About

Provably fair onchain gaming. 5,000+ users, 5 contracts, cross-chain USDC bridging from 8 networks via Circle CCTP.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors