Deployment Guide
This guide covers the deployment process for the Optimus Protocol on Solana's devnet and mainnet.
Prerequisites
Before deploying, ensure you have:
-
Solana Tool Suite
sh -c "$(curl -sSfL https://release.solana.com/v1.17.0/install)" -
Anchor Framework
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force avm install latest avm use latest -
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 -
Solana Wallet
- Create a new wallet:
solana-keygen new - Configure for devnet:
solana config set --url devnet - Get devnet SOL:
solana airdrop 2
- Create a new wallet:
Deployment Steps
1. Build the Program
# Build the program
anchor build
# Verify the build artifacts
ls target/deploy/
2. Configure Deployment
-
Update
Anchor.tomlwith your program ID:[programs.devnet] optimus = "YOUR_PROGRAM_ID" -
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
-
Check program status:
solana program show YOUR_PROGRAM_ID -
Verify program logs:
solana logs YOUR_PROGRAM_ID
Deployment Configuration
Environment Variables
The following environment variables can be configured:
ANCHOR_PROVIDER_URL: Custom RPC endpointANCHOR_WALLET: Custom wallet pathANCHOR_PROGRAM_ID: Custom program ID
Network Configuration
-
Devnet
- URL: https://api.devnet.solana.com
- Minimum SOL: 2 SOL for deployment
-
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
- Verify program permissions
- Check initial state setup
- Validate authority configuration
- Test emergency controls
3. Monitoring Setup
- Set up program monitoring
- Configure alert systems
- Set up logging infrastructure
Troubleshooting
Common Issues
-
Insufficient SOL
- Solution: Request more devnet SOL or fund mainnet wallet
-
Build Failures
- Solution: Clean build with
anchor cleanand rebuild
- Solution: Clean build with
-
Deployment Timeouts
- Solution: Increase RPC timeout or use different RPC endpoint
-
Program ID Mismatch
- Solution: Verify program ID in Anchor.toml matches deployed program
Recovery Procedures
-
Failed Deployment
# Clean and rebuild anchor clean anchor build anchor deploy -
Program Update
# Deploy new version anchor deploy --program-id YOUR_PROGRAM_ID
Security Considerations
-
Key Management
- Secure your deployment wallet
- Use hardware wallets for mainnet
- Implement multi-sig for critical operations
-
Access Control
- Verify authority configurations
- Implement proper access controls
- Set up emergency controls
-
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