The doctor command performs automated environment checks to help developers quickly identify and resolve setup issues.
anchorkit doctor- Verifies that
rustcis installed and accessible - Fix: Install from https://rustup.rs
- Checks if
wasm32-unknown-unknowntarget is installed - Fix: Run
rustup target add wasm32-unknown-unknown
- Looks for wallet/keypair configuration in:
- Environment variables:
STELLAR_SECRET_KEY,SOROBAN_SECRET_KEY,ANCHORKIT_SECRET_KEY - Soroban CLI identity directory:
~/.config/soroban/identity
- Environment variables:
- Fix: Set one of the environment variables or configure soroban identity
- Checks if RPC endpoint is configured via environment variables:
ANCHORKIT_RPC_URLSOROBAN_RPC_URLSTELLAR_RPC_URL
- Validates URL format and tests connectivity
- Fix: Set one of the environment variables with a valid RPC URL
- Verifies that
configs/directory exists - Checks for at least one
.jsonor.tomlconfig file - Validates that config files are readable
- Fix: Create
configs/directory and add anchor configuration files
- Tests connectivity to known Stellar endpoints
- Fix: Check internet connection and firewall settings
🔍 Running AnchorKit diagnostics...
✔ Rust toolchain detected
✔ WASM target installed
✔ Wallet configured
✔ RPC endpoint reachable
✔ Config files valid (6 found)
✔ Network responding
⏱ Completed in 0.01s
✅ All checks passed! Your environment is ready.
🔍 Running AnchorKit diagnostics...
✔ Rust toolchain detected
✔ WASM target installed
✖ Wallet not configured → set STELLAR_SECRET_KEY or configure soroban identity
✖ RPC endpoint not configured → set ANCHORKIT_RPC_URL, SOROBAN_RPC_URL, or STELLAR_RPC_URL
✔ Config files valid (6 found)
✔ Network responding
⏱ Completed in 0.01s
⚠️ Some checks failed. Please address the issues above.
0: All checks passed1: One or more checks failed
This makes the command useful in CI/CD pipelines and automation scripts.
The doctor command is designed to complete in under 2 seconds, making it suitable for:
- Pre-deployment validation
- CI/CD health checks
- Quick environment verification
- Troubleshooting setup issues
The doctor command is completely non-destructive:
- No files are modified
- No network state is changed
- No credentials are stored or transmitted
- Safe to run at any time
Example GitHub Actions workflow:
- name: Verify environment
run: |
cd AnchorKit
cargo run --bin anchorkit -- doctorExample pre-deployment script:
#!/bin/bash
set -e
echo "Checking environment..."
anchorkit doctor
echo "Environment OK, proceeding with deployment..."
anchorkit deploy --network mainnet