Drift Protocol v2

⌘K
👾Welcome to Drift Protocol
📺Drift DEX
👋Getting Started
📈Perpetual Futures
📊Spot Margin Trading
🏦Borrow & Lend
🏛️Staking
🏪Market Makers
🔬Technical Explanations
📏Accounting and Settlement
➗Borrow Interest Rate
📜Delisting Process
⛲Drift AMM
🏃Just-In-Time (JIT) Auctions
📚Keepers & Decentralised Orderbook
☠️Liquidators
💧Liquidity Providers (LPs)
📋Protocol Guard Rails
📝Risks
🖥️Developer Resources
📔Program/Vault Addresses
⌨️SDK Documentation
⌨️Tutorial: Bots
⚠️Troubleshooting
🛠️Keeper Bots
🛠️Trading Bots
⌨️Historical Data (v1)
⌨️API
🛡️Security
🛡️Audits
🛡️Bug Bounty
⚖️Legal and Regulations
📝Terms of Use
📝Disclaimer
📝Privacy Policy
📝Competition Terms and Conditions
Sweepstakes Details
📚Glossary
Docs powered by
Archbee
Developer Resources
Tutorial: Bots

Keeper Bots

8min

Introduction

Keeper Bots in the Drift Protocol keep the protocol operational by performing automated actions as autonomous off-chain agents. Keepers are rewarded depending on the duties that they perform.

The various types of keeper bots are:

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

Note: all bots require some amount of SOL for user account rent and to pay transaction fees.

The reference implementation for all Keeper bots mentioned in these docs is available here.

Preparing Environment

First clone the keeper-bots-v2 repo (make sure to check out the correct branch for the cluster you are targetting)

Branch Name

Cluster

master

devnet

devnet

devnet

mainnet-beta

mainnet-beta

Shell
|
git clone https://github.com/drift-labs/keeper-bots-v2 -b devnet


Prepare the required environment variables by copying over .env.example, modify .env with your preferred values

Shell
|
cp .env.example .env


Required Environment Variables

KEEPER_PRIVATE_KEY: the private key of the account to use for signing transactions. This account is the signing of authority of all accounts used by this bot. The value can be a number array (as in the example) or a path to a keypair.json file as generated by solana-keygen ENDPOINT: the JSON-RPC endpoint to use ENV: devnet



Initialise User

The signing account needs to have a User account before they are able to interact with the DriftClient program. We've included a --init-user flag on the Keeper Bot script to help with initializing new users.

Shell
TypeScript
|
yarn run start --init-user




Depositing Collateral

❗Only required if you are trading or your bot needs to maintain open positions (JIT makers and certain liquidators)

Trading, as well as some Keeper functions (Liquidators and JIT makers), require the account to maintain open positions, and so those accounts must hold collateral. The Keeper Bot script includes a --force-deposit flag to help with depositing collateral.

Shell
|
# deposit 10,000 USDC from account
yarn run start --force-deposit 10000




Updated 03 Mar 2023
Did this page help you?
PREVIOUS
Troubleshooting
NEXT
Tutorial: Order Matching Bot
Docs powered by
Archbee
TABLE OF CONTENTS
Introduction
Preparing Environment
Required Environment Variables
Initialise User
Depositing Collateral
Docs powered by
Archbee