CLI Tools
Installation
npm install -g @glitch-gremlin/cli
Environment Setup
The CLI requires these environment variables:
SOLANA_KEYPAIR_PATH
: Path to your Solana keypair fileSOLANA_CLUSTER
: (Optional) Solana cluster to use (defaults to 'devnet')
Commands
Test Management
# Create a new chaos test
glitch test -p <program-id> -t FUZZ -d 300 -i 5
# Options:
# -p, --program <address> Target program address
# -t, --type <type> Test type (FUZZ, LOAD, EXPLOIT, CONCURRENCY)
# -d, --duration <seconds> Test duration in seconds (default: 300)
# -i, --intensity <level> Test intensity 1-10 (default: 5)
# View test results
glitch test results <test-id>
# Cancel a running test
glitch test cancel <test-id>
Governance
# Create a proposal
glitch governance propose \
-t "Test Title" \
-d "Description" \
-p <program-id> \
-s 1000
# Options:
# -t, --title <title> Proposal title
# -d, --description <desc> Proposal description
# -p, --program <address> Target program address
# -s, --stake <amount> Amount of GLITCH to stake
# Vote on a proposal
glitch governance vote -p <proposal-id> -v yes
# Execute a passed proposal
glitch governance execute <proposal-id>
Token Management
# Stake tokens
glitch stake <amount> --lockup 30d
# Unstake tokens
glitch unstake <stake-id>
# View staking info
glitch stake info <stake-id>
Examples
Basic Fuzz Test
# Run a 5-minute fuzz test with medium intensity
glitch test \
--program 11111111111111111111111111111111 \
--type FUZZ \
--duration 300 \
--intensity 5
Load Test
# Run a high-intensity load test
glitch test \
--program YOUR_PROGRAM_ID \
--type LOAD \
--duration 600 \
--intensity 8 \
--load-tps 5000
Create and Monitor Proposal
# Create proposal
PROPOSAL_ID=$(glitch governance propose \
-t "Test DEX Security" \
-d "Run exploit tests on XYZ DEX" \
-p DEX_PROGRAM_ID \
-s 1000)
# Monitor status
glitch governance status $PROPOSAL_ID
Error Handling
The CLI will display clear error messages for common issues:
Invalid parameters
Network connectivity problems
Insufficient token balance
Rate limiting
Permission denied
Example error output:
Error: Rate limit exceeded - Must wait 2s between requests
Error: Insufficient GLITCH balance - Required: 1000, Available: 500
Error: Invalid program address provided
Configuration
The CLI looks for configuration in this order:
Command line arguments
Environment variables
Configuration file (~/.config/glitch/config.json)
Example config file:
{
"cluster": "devnet",
"keypairPath": "~/.config/solana/id.json",
"defaultTestDuration": 300,
"defaultTestIntensity": 5
}
Best Practices
Start with short duration, low intensity tests
Use devnet for initial testing
Monitor test results in real-time
Save test IDs for future reference
Use appropriate test types for your use case
Next Steps
Read the SDK Reference
Learn about Test Types
Explore Governance
Last updated