Deployment Guide

This guide covers the deployment process for the Optimus Protocol on Solana's devnet and mainnet.

Prerequisites

Before deploying, ensure you have:

  1. Solana Tool Suite

    sh -c "$(curl -sSfL https://release.solana.com/v1.17.0/install)"
    
  2. Anchor Framework

    cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
    avm install latest
    avm use latest
    
  3. Node.js and Yarn

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
    nvm install node
    npm install -g yarn
    
  4. Solana Wallet

    • Create a new wallet: solana-keygen new
    • Configure for devnet: solana config set --url devnet
    • Get devnet SOL: solana airdrop 2

Deployment Steps

1. Build the Program

# Build the program
anchor build

# Verify the build artifacts
ls target/deploy/

2. Configure Deployment

  1. Update Anchor.toml with your program ID:

    [programs.devnet]
    optimus = "YOUR_PROGRAM_ID"
    
  2. Ensure your wallet path is correct:

    [provider]
    wallet = "~/.config/solana/id.json"
    

3. Deploy to Devnet

# Deploy the program
anchor deploy

# Verify deployment
solana program show YOUR_PROGRAM_ID

4. Initialize the Program

The deployment script (migrations/deploy.ts) will automatically:

  • Deploy the program
  • Initialize the program state
  • Set up the initial authority

5. Verify Deployment

  1. Check program status:

    solana program show YOUR_PROGRAM_ID
    
  2. Verify program logs:

    solana logs YOUR_PROGRAM_ID
    

Deployment Configuration

Environment Variables

The following environment variables can be configured:

  • ANCHOR_PROVIDER_URL: Custom RPC endpoint
  • ANCHOR_WALLET: Custom wallet path
  • ANCHOR_PROGRAM_ID: Custom program ID

Network Configuration

  1. Devnet

    • URL: https://api.devnet.solana.com
    • Minimum SOL: 2 SOL for deployment
  2. Mainnet

    • URL: https://api.mainnet-beta.solana.com
    • Minimum SOL: 5 SOL for deployment

Post-Deployment

1. Program Verification

After deployment, verify:

  • Program is deployed to the correct address
  • Program is owned by the BPF Loader
  • Program data is properly initialized

2. Security Checks

  1. Verify program permissions
  2. Check initial state setup
  3. Validate authority configuration
  4. Test emergency controls

3. Monitoring Setup

  1. Set up program monitoring
  2. Configure alert systems
  3. Set up logging infrastructure

Troubleshooting

Common Issues

  1. Insufficient SOL

    • Solution: Request more devnet SOL or fund mainnet wallet
  2. Build Failures

    • Solution: Clean build with anchor clean and rebuild
  3. Deployment Timeouts

    • Solution: Increase RPC timeout or use different RPC endpoint
  4. Program ID Mismatch

    • Solution: Verify program ID in Anchor.toml matches deployed program

Recovery Procedures

  1. Failed Deployment

    # Clean and rebuild
    anchor clean
    anchor build
    anchor deploy
    
  2. Program Update

    # Deploy new version
    anchor deploy --program-id YOUR_PROGRAM_ID
    

Security Considerations

  1. Key Management

    • Secure your deployment wallet
    • Use hardware wallets for mainnet
    • Implement multi-sig for critical operations
  2. Access Control

    • Verify authority configurations
    • Implement proper access controls
    • Set up emergency controls
  3. Monitoring

    • Set up program monitoring
    • Configure alert systems
    • Monitor program state

Support

For deployment support:

  • Open an issue on GitHub
  • Join our Discord community
  • Contact the development team

Additional Resources

© 2025 PRIM3.AI. All rights reserved.