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
๐Ÿ“šGlossary
Docs powered byย archbeeย 
8min

Keeper Bots

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?
Yes
No
UP NEXT
Tutorial: Order Matching Bot
Docs powered byย archbeeย 
TABLE OF CONTENTS
Introduction
Preparing Environment
Required Environment Variables
Initialise User
Depositing Collateral