Quick Start Guide
This guide will help you get a keeper bot running on Drift Protocol. We’ll start with a filler bot in dry-run mode, then move to production.Make sure you’ve completed the Installation guide before proceeding.
Configure Your Bot
Verify Wallet Funding
Make sure your bot wallet has sufficient SOL for transaction fees:Recommended minimums:
- Filler bot: 0.5 SOL
- Liquidator bot: 1-5 SOL (needs capital for taking positions)
Run the Filler Bot
The filler bot matches orders and provides liquidity to earn fees.- Production Mode
- Dry Run Mode
- Custom Markets
- Docker
Run the filler bot on mainnet with detailed logging:
What This Command Does
RUST_LOG=filler=info,dlob=info,swift=info- Enables info-level logs for filler, DLOB, and swift order modulescargo run --release- Runs the optimized release build--mainnet- Uses mainnet-beta Solana network--filler- Runs the perp filler bot
The bot will start filling orders immediately. Monitor the logs to see fills and transaction results.
Filler Bot Configuration Options
Customize the filler bot behavior with command-line flags:| Flag | Description | Default |
|---|---|---|
--market-ids | Comma-separated market indices to fill | "0,1,2" |
--all-markets | Fill for all available markets | false |
--priority-fee | Base priority fee in microlamports | 512 |
--swift-cu-limit | Compute units for swift fills | 364000 |
--fill-cu-limit | Compute units for regular fills | 256000 |
--dry | Simulate without sending transactions | false |
Run the Liquidator Bot
The liquidator bot protects the protocol by liquidating undercollateralized positions.- Perp + Spot Liquidations
- Perp Only
- Custom Threshold
- Docker
Run the full liquidator with both perp and spot liquidations:This is the recommended configuration. The bot will:
- Monitor all user accounts for margin violations
- Liquidate perp positions using the DLOB for fills
- Liquidate spot borrows using Jupiter swaps
- Track high-risk users for faster response
Liquidator Bot Configuration
| Flag | Description | Default |
|---|---|---|
--liquidator | Run in liquidator mode | false |
--min-collateral | Minimum collateral to liquidate (micro-units) | 1000000 |
--use-spot-liquidation | Enable spot liquidations | true |
--priority-fee | Base priority fee in microlamports | 512 |
--dry | Simulate without sending transactions | false |
Verify Your Bot is Working
Check Metrics Endpoint
Access the Prometheus metrics at Key metrics to watch:
http://localhost:9898/metrics:tx_sent_total- Total transactions senttx_confirmed_total- Total transactions confirmedtx_failed_total- Total failed transactionsfills_total- Total fills executed (filler only)liquidations_total- Total liquidations (liquidator only)
Check Health Endpoint
Verify the bot is healthy:A
200 OK response indicates the bot is running correctly.Monitor Performance
Using Prometheus & Grafana
The metrics endpoint exposes data in Prometheus format. You can scrape it with Prometheus and visualize in Grafana:Using curl
Quick checks from the command line:Log Levels
Adjust logging verbosity withRUST_LOG:
Transaction History Tool
Keep-rs includes a utility to analyze your bot’s transaction history:- Success rate
- Average priority fees paid
- Compute units used
- Total fees spent
Troubleshooting
Bot Not Sending Transactions
Check wallet balance
Check wallet balance
Verify RPC connection
Verify RPC connection
Check that your RPC endpoint is responding:
Check gRPC credentials
Check gRPC credentials
Ensure
GRPC_ENDPOINT and GRPC_X_TOKEN are correct. Look for connection errors in logs:Verify bot is finding opportunities
Verify bot is finding opportunities
Increase log level to see if crosses are being detected:Look for “found cross” or “attempting fill” messages.
High Transaction Failure Rate
- Increase priority fees: Use
--priority-fee=1000or higher - Adjust compute units: Increase
--fill-cu-limitif hitting CU limits - Check competition: Other bots may be faster - optimize your RPC latency
- Review logs: Look for specific error messages in transaction confirmations
No Liquidations Found
- This is normal during low volatility periods
- The liquidator runs continuously waiting for opportunities
- Check
http://localhost:9898/metrics-users_monitoredshould be > 0 - Use
RUST_LOG=liquidator=debugto see margin checks
Next Steps
Configuration Guide
Learn about all configuration options and optimization strategies
Monitoring & Metrics
Set up comprehensive monitoring with Prometheus and Grafana
Performance Optimization
Optimize your bot for maximum performance
Troubleshooting
Common issues and how to resolve them