Skip to main content

Installation

npm install -g @crunchdao/coordinator-cli

Usage

crunch-coordinator <command> [options] [arguments]
crunch-coordinator crunch <subcommand> [options] [arguments]

Coordinator Management Commands

register

Register a new Coordinator with the protocol. Usage:
crunch-coordinator register <name>
Arguments:
  • name - Unique name for the coordinator
Example:
crunch-coordinator register "AI Research Lab"
Description: Registers the wallet as a Coordinator with the given name. The Coordinator must later be approved by protocol admins before they can create competitions. Requirements:
  • Coordinator name must be unique
  • Wallet must have sufficient SOL for account creation
  • Name should be descriptive and professional

get

Get Coordinator details by owner address. Usage:
crunch-coordinator get [owner]
Arguments:
  • owner - Owner address of the Coordinator (optional, defaults to current wallet)
Examples:
# Get Coordinator details for a specific address
crunch-coordinator get "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"

# Get Coordinator details for current wallet
crunch-coordinator get
Description: Retrieves detailed information about a Coordinator including registration status and metadata.

get-config

Get Coordinator configuration from the protocol. Usage:
crunch-coordinator get-config
Example:
crunch-coordinator get-config
Description: Displays the current Coordinator configuration including protocol parameters and settings.

Competition Lifecycle Management

create

Create a new competition (crunch). Usage:
crunch-coordinator crunch create <name> [payoutAmount] [maxModelsPerCruncher]
Arguments:
  • name - Name of the crunch
  • payoutAmount - Payout amount in USDC (default: 10)
  • maxModelsPerCruncher - Maximum models per Cruncher (default: 2)
Example:
crunch-coordinator crunch create "iris_classifier" 10000 5
Description: Creates a new competition with the specified parameters. The creator must be an approved coordinator. Requirements:
  • Must be an approved coordinator
  • Competition name must be unique
  • Must have sufficient SOL for account creation

start

Start a competition. Usage:
crunch-coordinator crunch start <crunchName>
Arguments:
  • crunchName - Name of the crunch to start
Example:
crunch-coordinator crunch start "iris_classifier"
Description: Transitions a competition from created state to active state, allowing crunchers to register and submit models. Requirements:
  • Competition must be in created state
  • Must be the Coordinator who created the competition

address

Get the account address for a competition. Usage:
crunch-coordinator crunch address <crunchName>
Arguments:
  • crunchName - Name of the crunch
Example:
crunch-coordinator crunch address "iris_classifier"
Description: Returns the Solana public key address of the specified competition account.

get

Get detailed information about a competition. Usage:
crunch-coordinator crunch get <name>
Arguments:
  • name - Name of the crunch
Example:
crunch-coordinator crunch get "iris_classifier"
Description: Retrieves comprehensive information about a competition including its state, configuration, participants, and financial details.

end

End a competition. Usage:
crunch-coordinator crunch end <crunchName>
Arguments:
  • crunchName - Name of the crunch to end
Example:
crunch-coordinator crunch end "iris_classifier"
Description: Transitions a competition to ended state, preventing new registrations and model submissions. Requirements:
  • Competition must be in active state
  • Must be the Coordinator who created the competition

Reward and Financial Management

deposit-reward

Deposit reward USDC to a competition. Usage:
crunch-coordinator crunch deposit-reward <crunchName> <amount>
Arguments:
  • crunchName - Name of the crunch
  • amount - Amount in USDC to deposit
Example:
crunch-coordinator crunch deposit-reward "iris_classifier" 5000
Description: Deposits USDC tokens to fund the reward pool for the specified competition. Requirements:
  • Must have sufficient USDC balance
  • Competition must exist

margin

Execute margin payout for a competition. Usage:
crunch-coordinator crunch margin <crunchName>
Arguments:
  • crunchName - Name of the crunch
Example:
crunch-coordinator crunch margin "iris_classifier"
Description: Processes margin-based payouts for competition participants based on their performance.

drain

Drain USDC from a competition. Usage:
crunch-coordinator crunch drain <crunchName> [--show-solscan]
Arguments:
  • crunchName - Name of the crunch
Options:
  • --show-solscan - Show Solscan links for transactions
Example:
crunch-coordinator crunch drain "iris_classifier" --show-solscan
Description: Withdraws remaining USDC from a competition’s reward pool back to the coordinator.

Checkpoint Management

checkpoint-create

Creates a checkpoint for payout distribution. Usage:
crunch-coordinator crunch checkpoint-create <crunchName> <prizeFileName> [--dryrun]
Arguments:
  • crunchName - Name of the crunch
  • prizeFileName - Path to prize JSON file containing payout distribution
Options:
  • --dryrun - Perform a dry run without executing transactions
Example:
crunch-coordinator crunch checkpoint-create "iris_classifier" "./prizes.json"
Prize File Format:
{"timestamp": 1840417288969, "model": "model_3", "prize": 130870000}
Prize File Fields:
  • timestamp - Unix timestamp in milliseconds (required)
  • model - Model identifier receiving the prize (required)
  • prize - Prize amount in micro USDC (amount to transfer * (10^6)) (required)
  • prizeId - Unique identifier for the prize (optional)
Description: Creates a new checkpoint with specified prize distribution, enabling participants to claim their rewards.

checkpoint-get-current

Get the current checkpoint information. Usage:
crunch-coordinator crunch checkpoint-get-current <crunchName>
Arguments:
  • crunchName - Name of the crunch
Example:
crunch-coordinator crunch checkpoint-get-current "iris_classifier"
Description: Retrieves information about the current active checkpoint including total amount and distribution details.

checkpoint-get-address

Get the address of a specific checkpoint. Usage:
crunch-coordinator crunch checkpoint-get-address <crunchName> <checkpointIndex>
Arguments:
  • crunchName - Name of the crunch
  • checkpointIndex - Index of the checkpoint
Example:
crunch-coordinator crunch checkpoint-get-address "iris_classifier" 1
Description: Returns the Solana public key address of the specified checkpoint account.

Configuration

The CLI uses a configuration system for managing settings. Use the config commands to manage your configuration:
# Set configuration values
crunch-coordinator config set <key> <value>

# Show current configuration
crunch-coordinator config show

# Use a specific profile
crunch-coordinator config use-profile <profile>

Configuration Options

  • network (string) - Solana network (localnet, devnet, mainnet)
  • wallet (string) - Path to wallet keypair file
  • loglevel (string) - Log level (debug, info, warn, error)

Default Configuration

{
  "network": "localnet",
  "wallet": "./accounts/coordinator.json",
  "loglevel": "info"
}

Command Reference Summary

CategoryCommandDescription
Coordinator ManagementregisterRegister as a Coordinator
getGet Coordinator details
get-configGet Coordinator configuration
Competition Lifecyclecrunch createCreate a new competition
crunch startStart a competition
crunch addressGet competition address
crunch getGet competition details
crunch endEnd a competition
Financial Managementcrunch deposit-rewardDeposit USDC rewards
crunch marginExecute margin payout
crunch drainWithdraw remaining USDC
Checkpoint Managementcrunch checkpoint-createCreate reward checkpoint
crunch checkpoint-get-currentGet current checkpoint
crunch checkpoint-get-addressGet checkpoint address
ConfigurationconfigConfiguration management

Competition Workflow

  1. Setup: Register as Coordinator using register
  2. Create: Create competition using crunch create
  3. Fund: Deposit rewards using crunch deposit-reward
  4. Launch: Start competition using crunch start
  5. Monitor: Check status using crunch get
  6. Distribute: Create checkpoints using crunch checkpoint-create
  7. Complete: End competition using crunch end
  8. Cleanup: Drain remaining funds using crunch drain

Best Practices

  1. Secure Wallets: Keep Coordinator wallet keys secure
  2. Documentation: Keep track of checkpoint indices and prize distributions