Skip to Content
DevelopersTrading AutomationKeeper BotsKeeper Bots

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 TypeDifficultyCapital RequiredRewardsLink
Matching BotBasicNoTBDTutorial: Order Matching Bot
Order TriggerBasicNoTBDTutorial: Order Trigger Bot
LiquidatorAdvancedYesTBDTutorial: Liquidation Bot

Note: all bots require some SOL for rent and transaction fees.

Reference implementations live in keeper-bots-v2 .

Step 1: Clone the repo and choose a branch

Pick a branch that matches your cluster:

Branch NameCluster
masterdevnet
devnetdevnet
mainnet-betamainnet-beta
git clone https://github.com/drift-labs/keeper-bots-v2 -b devnet

Step 2: Configure environment + YAML config

Copy the env template and set required values:

cp .env.example .env

Required env vars:

  • KEEPER_PRIVATE_KEY: keypair array or path to keypair.json
  • ENDPOINT: RPC endpoint
  • ENV: devnet or mainnet-beta

The repo uses a YAML config for bot selection and per-bot settings. Start from example.config.yaml and set:

  • global.endpoint
  • global.keeperPrivateKey (or env var)
  • enabledBots + botConfigs

Step 3: 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-user
if (!(await driftClient.getUser().exists())) { logger.info(`Creating DriftClient for ${wallet.publicKey}`); const [txSig] = await driftClient.initializeUserAccount(); logger.info(`Initialized user account in transaction: ${txSig}`); }

Step 4: 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 10000

Step 5: Run the bots

yarn run dev --config-file=example.config.yaml
Last updated on