Skip to main content

Overview

This page covers the blockchain integration aspects of the Iris Classification coordinator, including CLI setup, Coordinator registration, and prize distribution through the Crunch Protocol on Solana.

Prerequisites

  • Solana wallet with SOL tokens for transaction fees
  • Crunch Protocol CLI tools installed:
    • @crunchdao/coordinator-cli
    • @crunchdao/cruncher-cli
  • Completed Coordinator implementation (see Coordinator Node)

CLI Installation

# Install both required CLI tools
npm install -g @crunchdao/coordinator-cli
npm install -g @crunchdao/cruncher-cli

CLI Setup

Coordinator Configuration

Configure your Coordinator wallet for blockchain transactions:
# Set network to devnet for testing
crunch-coordinator config set network devnet

# Set up Coordinator wallet
crunch-coordinator config set wallet ~/.config/solana/coordinator-keypair.json

# Verify configuration
crunch-coordinator config show

Coordinator Registration

Register as a Coordinator on the Crunch Protocol:
# Register as coordinator
crunch-coordinator register "Iris Competition Coordinator"

# Check registration status
crunch-coordinator get
Wait for admin approval before proceeding to create competitions.

Competition Management

Creating Competitions

# Create a new competition
crunch-coordinator crunch create "Iris Classification Challenge" 1000 5

# Deposit rewards into the competition (requires a USDC-token account owned by the coordinator with sufficient balance)
crunch-coordinator crunch deposit-reward "Iris Classification Challenge" 1200

Lifecycle Management

# Start the competition
crunch-coordinator crunch start "Iris Classification Challenge"

# Get competition address
crunch-coordinator crunch address "Iris Classification Challenge"

# End the competition when ready
crunch-coordinator crunch end "Iris Classification Challenge"

# Process margin payouts (required after ending)
crunch-coordinator crunch margin "Iris Classification Challenge"

# Drain remaining funds back to coordinator
crunch-coordinator crunch drain "Iris Classification Challenge"

Prize Distribution

Checkpoint Initialization

# Create checkpoint for prize distribution
crunch-coordinator crunch checkpoint-create "Iris Classification Challenge" prizes.json

# Check current checkpoint status
crunch-coordinator crunch checkpoint-get-current "Iris Classification Challenge"

# Get specific checkpoint address
crunch-coordinator crunch checkpoint-get-address "Iris Classification Challenge" 0

Prize File Format

The Coordinator must generate a JSON file with the following format:
{"timestamp": 1840417288969, "model": "model_1", "prize": 456000000}
{"timestamp": 1840417288969, "model": "model_2", "prize": 412000000}
{"timestamp": 1840417288969, "model": "model_3", "prize": 130000000}
Prize File Fields:
  • timestamp - Unix timestamp in milliseconds (required)
  • model - Model identifier receiving the prize (required)
  • prize - Prize amount in micro USDC (required)

Multiple Checkpoints

Checkpoints can be created throughout the competition lifecycle:
# Create interim checkpoint during active competition
crunch-coordinator crunch checkpoint-create "Iris Classification Challenge" week1_prizes.json

# Create another checkpoint later
crunch-coordinator crunch checkpoint-create "Iris Classification Challenge" week2_prizes.json

# Create final checkpoint after competition ends
crunch-coordinator crunch checkpoint-create "Iris Classification Challenge" final_prizes.json

Integration with Coordinator

Blockchain-Ready Output

Your Coordinator should generate coordinator cli compatible output files, or convert to the checkpoint create prize format before creating a checkpoint.

Security Considerations

Wallet Security

  • Store private keys securely
  • Use hardware wallets for mainnet deployments
  • Implement multi-signature for large prize pools

Troubleshooting

Common Issues

Insufficient SOL Balance
# Check wallet balance
solana balance ~/.config/solana/coordinator-keypair.json

# Request SOL from faucet (devnet only)
solana airdrop 2 ~/.config/solana/coordinator-keypair.json
Competition Management Failures
# Check if Coordinator is approved
crunch-coordinator get

# Validate competition exists
crunch-coordinator crunch get "Iris Classification Challenge"