audit-infra
Infrastructure-first security audit โ secrets, supply chain, CI/CD, LLM/skill security, OWASP, STRIDE. Complements /audit-solana (program-level)
Deploy Solana program (devnet first, then mainnet)
> /plugin marketplace add solanabr/solana-ai-kit > /plugin install solana-ai-kit@stbr
How it fires
How this command gets triggered: by you, by Claude, or both.
/deployContext preview
What this command does when you run it.
Deploy Solana program (devnet first, then mainnet)
description: "Deploy Solana program (devnet first, then mainnet)"
You are deploying a Solana program. **ALWAYS test on devnet before mainnet.**
echo "๐ฏ Deployment Target Selection"
echo ""
echo "Choose deployment target:"
echo " 1. devnet (testing - safe, free SOL)"
echo " 2. mainnet (production - REAL SOL, IRREVERSIBLE)"
echo ""
# Check current config
CURRENT_NETWORK=$(solana config get | grep "RPC URL" | awk '{print $3}')
echo "Current network: $CURRENT_NETWORK"**IMPORTANT**: If this is a new program, **ALWAYS deploy to devnet first**.
---
echo "๐ Configuring for devnet..." solana config set --url devnet # Verify solana config get # Should show: RPC URL: https://api.devnet.solana.com
echo "๐จ Building program..."
# Build
if [ -f "Anchor.toml" ]; then
anchor build
else
cargo build-sbf
fi
# Check program exists
ls -lh target/deploy/*.soecho "๐ฐ Checking wallet balance..." solana address solana balance # If balance is low, airdrop (devnet only!) solana airdrop 2 solana balance
echo "๐ Deploying to devnet..."
if [ -f "Anchor.toml" ]; then
anchor deploy --provider.cluster devnet
else
solana program deploy target/deploy/program.so
fi
# Get program ID
PROGRAM_ID=$(solana address -k target/deploy/program-keypair.json)
echo "โ
Program deployed: $PROGRAM_ID"
# Save program ID
echo $PROGRAM_ID > .program-id-devnetecho "๐ Verifying deployment..." solana program show $PROGRAM_ID # Explorer link echo "" echo "๐ก Explorer: https://explorer.solana.com/address/$PROGRAM_ID?cluster=devnet"
echo "๐งช Running devnet tests..."
if [ -f "Anchor.toml" ]; then
anchor test --skip-build --skip-deploy
fi
# Or run custom integration tests**Next step**: Test thoroughly on devnet for multiple days before mainnet.
---
**STOP: Do NOT proceed to mainnet without ALL items checked:**
๐จ MAINNET DEPLOYMENT CONFIRMATION REQUIRED ๐จ Network: Solana Mainnet-Beta Program: [program name] Estimated Cost: [X SOL for deployment + buffer] This action will: - Deploy program to MAINNET (IRREVERSIBLE) - Spend REAL SOL - Make program publicly accessible - Potentially handle user funds โ ๏ธ HAVE YOU COMPLETED: - [ ] Security audit - [ ] Professional code review - [ ] Extensive devnet testing (multiple days) - [ ] Emergency procedures Type 'DEPLOY TO MAINNET' to confirm:
**DO NOT PROCEED WITHOUT USER CONFIRMATION**
echo "๐ Configuring for mainnet..." solana config set --url mainnet-beta # VERIFY solana config get # Must show: RPC URL: https://api.mainnet-beta.solana.com # Check wallet and balance solana address solana balance # Need ~3-5 SOL for deployment
echo "๐จ Final build verification..." # Clean build anchor clean anchor build --verifiable # Verify program size ls -lh target/deploy/*.so # Run all tests one more time anchor test # Security checks cargo clippy -- -W clippy::all cargo audit
# Estimate deployment cost solana program deploy target/deploy/program.so --dry-run # Ensure you have 2x this amount for safety
echo "โ ๏ธ FINAL CONFIRMATION" echo "Network: $(solana config get | grep 'RPC URL')" echo "Deployer: $(solana address)" echo "Balance: $(solana balance)" # Deploy anchor deploy --provider.cluster mainnet-beta # SAVE PROGRAM ID IMMEDIATELY PROGRAM_ID=$(solana address -k target/deploy/program-keypair.json) echo "๐ฏ DEPLOYED PROGRAM ID: $PROGRAM_ID" # Save to file echo $PROGRAM_ID > .program-id-mainnet
# Verify program is on mainnet
solana program show $PROGRAM_ID
# Check upgrade authority
UPGRADE_AUTH=$(solana program show $PROGRAM_ID | grep "Upgrade Authority" | awk '{print $3}')
echo "Upgrade Authority: $UPGRADE_AUTH"
# Explorer
echo "Explorer: https://explorer.solana.com/address/$PROGRAM_ID"
# Verify program binary
solana program dump $PROGRAM_ID program-dump.so
diff target/deploy/program.so program-dump.so**Test with SMALL amounts first!**
# Test read-only operations first # Test write operations with MINIMAL amounts (0.01 SOL) # Monitor for any issues
# Save deployment info
cat > deployment-mainnet.json <<EOF
{
"programId": "$PROGRAM_ID",
"deployedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"deployer": "$(solana address)",
"network": "mainnet-beta",
"upgradeAuthority": "$UPGRADE_AUTH"
}
EOF
# Update frontend
echo "NEXT_PUBLIC_PROGRAM_ID=$PROGRAM_ID" >> .env.production<!-- Adapted from sendaifun/solana-new (deploy-to-mainnet), MIT --> Don't free
Production-ready Claude Code configuration for full-stack Solana development. Combines best practices from multiple sources into an agent-optimized, token-efficient config you can install and adapt to your specific project.
Repo: solanabr/solana-ai-kit
Infrastructure-first security audit โ secrets, supply chain, CI/CD, LLM/skill security, OWASP, STRIDE. Complements /audit-solana (program-level)
Benchmark CU usage and compare against baseline for regression detection