Keeper Bots
Keeper bots keep Drift operational by performing automated actions as off-chain agents. Keepers are rewarded depending on the duties they perform.
| Bot Type | Difficulty | Capital Required | Rewards | Link |
|---|---|---|---|---|
| Matching Bot | Basic | No | TBD | Tutorial: Order Matching Bot |
| Order Trigger | Basic | No | TBD | Tutorial: Order Trigger Bot |
| Liquidator | Advanced | Yes | TBD | Tutorial: Liquidation Bot |
| JIT Maker Bot | Advanced | Yes | TBD | Tutorial: JIT Maker Bot |
Note: all bots require some SOL for rent and transaction fees.
Reference implementations live in keeper-bots-v2 .
Clone the repo and choose a branch
Pick a branch that matches your cluster. Note: in this repo, master tracks devnet (not mainnet-beta).
| Branch Name | Cluster |
|---|---|
| master | devnet |
| mainnet-beta | mainnet-beta |
git clone https://github.com/drift-labs/keeper-bots-v2 -b mainnet-betaConfigure environment + YAML config
Copy the env template and set required values:
cp .env.example .envRequired env vars:
KEEPER_PRIVATE_KEY: keypair array or path tokeypair.jsonENDPOINT: RPC endpointENV:devnetormainnet-beta
The repo uses a YAML config for bot selection and per-bot settings. Start from example.config.yaml and set:
global.endpointglobal.keeperPrivateKey(or env var)enabledBots+botConfigs
Initialize a Drift user (if needed)
Bots that place orders or manage positions require a Drift user account. The repo provides a helper flag:
yarn run dev --init-userif (!(await driftClient.getUser().exists())) {
logger.info(`Creating DriftClient for ${wallet.publicKey}`);
const [txSig] = await driftClient.initializeUserAccount();
logger.info(`Initialized user account in transaction: ${txSig}`);
}Deposit collateral (if needed)
Required for liquidators and JIT makers that keep open positions:
# deposit 10,000 USDC from account
yarn run dev --force-deposit 10000Run the bots
yarn run dev --config-file=example.config.yamlLast updated on