Skip to content

Jayant818/Arbitron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

88 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Arbitron โšก

The Fantasy Trading Arena on Solana

Arbitron transforms crypto trading into a fun, fair, and skill-based competition. Join fast-paced 10-minute contests, strategically draft your virtual portfolio, and compete for prizesโ€”all without liquidation risks.

Built on Solana Powered by Bonsol License: MIT

๐ŸŽฏ What is Arbitron?

Crypto trading can feel intimidating, risky, and driven by emotion, leading many potential users to stay away. Arbitron solves this by:

  • ๐ŸŽฎ Gamifying Trading: Turn crypto speculation into a competitive, strategic game
  • ๐Ÿ›ก๏ธ Eliminating Risk: No liquidations, no real tradesโ€”pure skill-based competition
  • โšก Lightning Fast: 10-minute rounds keep the action intense
  • ๐Ÿ”’ Provably Fair: Zero-knowledge proofs ensure transparent, tamper-proof results
  • ๐Ÿ† Skill-Based Rewards: Winners determined purely by strategy and market insight

๐Ÿš€ How It Works

1. Join a Contest

  • Browse active contests and pay the entry fee (e.g., 10 USDC)
  • Each contest has a fixed duration (typically 10 minutes)

2. Draft Your Portfolio

  • Select crypto tokens under budget and category constraints
  • Choose one "Power Token" for 2x leverage
  • Strategic token selection is key to winning

3. Compete Live

  • Watch real-time market prices via Pyth oracles
  • Track your P&L and ranking on the live leaderboard
  • See how your portfolio performs against competitors

4. Win Prizes

  • Highest P&L at contest end wins the prize pool
  • Results verified via zero-knowledge proofs for fairness
  • Prizes distributed automatically via Solana smart contracts
  • Winners earn unique NFT badges as proof of skill

๐Ÿ—๏ธ Architecture

Tech Stack

Blockchain Layer

  • Solana: Fast, low-cost transactions for seamless gameplay
  • Anchor Framework: Type-safe Solana program development
  • Bonsol ZK: Zero-knowledge proof verification for fair outcomes
  • Pyth Network: Real-time price feeds

Backend Services

  • PostgreSQL + Prisma: Contest and user data management
  • Redis: Real-time price updates and pub/sub messaging
  • WebSocket Server: Live leaderboard updates
  • Aggregator Service: P&L calculation engine
  • Crank Service: Automated contest lifecycle management
  • ZK Data Prep: Proof generation and verification

Frontend

  • Next.js 15: React framework with App Router
  • TypeScript: Type-safe development
  • TailwindCSS + shadcn/ui: Modern, accessible UI components
  • Solana Web3.js 2.0: Blockchain integration
  • TanStack Query: Data fetching and caching

System Flow

graph TB
    User[User] --> Frontend[Next.js Frontend]
    Frontend --> API[Express API]
    Frontend --> Solana[Solana Program]
    
    API --> DB[(PostgreSQL)]
    API --> Redis[(Redis)]
    
    Solana --> Contest[Contest Program]
    Contest --> Pyth[Pyth Oracles]
    Contest --> Bonsol[Bonsol ZK]
    
    Crank[Crank Service] --> Contest
    Poller[Price Poller] --> Redis
    Aggregator[Aggregator] --> Redis
    ZK[ZK Data Prep] --> Bonsol
    
    WS[WebSocket Server] --> Frontend
    Redis --> WS
Loading

๐Ÿ“ฆ Project Structure

arbitron/
โ”œโ”€โ”€ programs/                    # Solana programs (Anchor)
โ”‚   โ””โ”€โ”€ arbitron/               # Main contest program
โ”‚       โ”œโ”€โ”€ src/
โ”‚       โ”‚   โ”œโ”€โ”€ handlers/       # Instruction handlers
โ”‚       โ”‚   โ”œโ”€โ”€ state/          # Account structures
โ”‚       โ”‚   โ””โ”€โ”€ lib.rs          # Program entry point
โ”‚       โ””โ”€โ”€ Cargo.toml
โ”‚
โ”œโ”€โ”€ app/                         # Monorepo applications
โ”‚   โ”œโ”€โ”€ arbriton-frontend/      # Next.js web app
โ”‚   โ”‚   โ”œโ”€โ”€ app/                # Next.js app router
โ”‚   โ”‚   โ”œโ”€โ”€ components/         # React components
โ”‚   โ”‚   โ””โ”€โ”€ lib/                # Utilities
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ api/                    # Express.js backend
โ”‚   โ”œโ”€โ”€ aggregator/             # P&L calculation service
โ”‚   โ”œโ”€โ”€ crank-service/          # Contest automation
โ”‚   โ”œโ”€โ”€ poller/                 # Price polling service
โ”‚   โ”œโ”€โ”€ ws-server/              # WebSocket server
โ”‚   โ”œโ”€โ”€ zk-data-prep/           # ZK proof preparation
โ”‚   โ””โ”€โ”€ zk-tx-submitter/        # ZK result submission
โ”‚
โ”œโ”€โ”€ arbitron-pnl-guest/         # Risc0 ZK guest program
โ”‚   โ””โ”€โ”€ src/main.rs             # P&L calculation logic
โ”‚
โ”œโ”€โ”€ packages/                    # Shared packages
โ”‚   โ”œโ”€โ”€ db/                     # Prisma database client
โ”‚   โ””โ”€โ”€ shared-redis/           # Redis utilities
โ”‚
โ”œโ”€โ”€ dist/                       # Generated Solana client
โ”‚   โ””โ”€โ”€ js-client/              # TypeScript bindings
โ”‚
โ””โ”€โ”€ Bonsol-node/                # Bonsol ZK integration

๐Ÿ› ๏ธ Setup & Installation

Prerequisites

  • Node.js 22+ and npm
  • Rust 1.75+ with Solana toolchain
  • Anchor CLI 0.31+
  • Docker (for Redis & PostgreSQL)
  • Solana CLI configured for devnet

Quick Start

  1. Clone the repository

    git clone https://github.com/yourusername/arbitron.git
    cd arbitron
  2. Install dependencies

    npm install
  3. Set up environment variables

    # Copy example env files
    cp .env.example .env
    cp app/arbriton-frontend/.env.example app/arbriton-frontend/.env.local
    
    # Edit with your configuration
    # - Database URLs
    # - Solana RPC endpoints
    # - Redis connection
    # - Pyth price feed addresses
  4. Start infrastructure services

    docker-compose up -d
  5. Generate Prisma client

    cd packages/db
    npx prisma generate
    npx prisma migrate dev
  6. Build Solana programs

    anchor build
    npm run regenerate-client
  7. Deploy to Solana devnet

    anchor deploy --provider.cluster devnet
  8. Start development servers

    npm run dev

    This starts all services concurrently:

๐ŸŽฎ Usage

Creating a Contest

# Use the web UI or run the CLI
npm run create-contest --name "Lightning Round" --duration 600 --entry-fee 10

Joining a Contest

  1. Navigate to /contests on the web app
  2. Connect your Solana wallet
  3. Select tokens within budget constraints
  4. Choose one Power Token for 2x leverage
  5. Confirm transaction to join

Monitoring Live Contests

  • Real-time leaderboard updates via WebSocket
  • Live P&L calculations based on Pyth price feeds
  • Track your ranking as the contest progresses

๐Ÿงช Testing

# Run Anchor tests
anchor test

# Run TypeScript tests
npm test

# Run specific service tests
npm --workspace=@arbitron/api test

๐Ÿ” Security

  • Smart Contract Audits: Pending (pre-mainnet)
  • Zero-Knowledge Proofs: All contest results verified via Bonsol ZK
  • Oracle Security: Pyth Network for tamper-proof price data
  • Access Control: Role-based permissions on Solana programs

๐Ÿ—บ๏ธ Roadmap

Phase 1: MVP (Current)

  • โœ… Core contest mechanics
  • โœ… Token selection with Power Tokens
  • โœ… Real-time leaderboards
  • โœ… ZK proof integration
  • โœ… NFT winner badges

Phase 2: Enhanced Features

  • โณ Tournament brackets
  • โณ Seasonal leagues
  • โณ Team competitions
  • โณ Advanced analytics dashboard
  • โณ Mobile app

Phase 3: Ecosystem Expansion

  • ๐Ÿ”ฎ Cross-chain support
  • ๐Ÿ”ฎ DAO governance
  • ๐Ÿ”ฎ Creator tools for custom contests
  • ๐Ÿ”ฎ Integration with DeFi protocols
  • ๐Ÿ”ฎ Sponsorship & advertising platform

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ™ Acknowledgments

  • Solana Foundation - For the lightning-fast blockchain
  • Bonsol - For zero-knowledge proof infrastructure
  • Pyth Network - For reliable price oracles
  • Anchor Lang - For the amazing Solana framework

๐Ÿ“ž Contact & Community

Transform your trading skills into victory. Join the arena today! โšก๐Ÿ†

About

A Time bound, Competitive Trading Tournament DApp

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published