Skip to content

How to Run Keeper Jobs

De Clercq Wentzel edited this page Apr 27, 2022 · 9 revisions

Running Keeper Jobs

Prerequisites

chainlink installation

First, you must have the latest version of the chainlink node installed and configured using the instructions above.

Env Vars

The following environment variables configure keeper jobs. They are all optional.

  • KEEPER_DEFAULT_TRANSACTION_QUEUE_DEPTH - the number of keeper transactions of the same variety to keep in the queue at once - default 1
  • KEEPER_REGISTRY_SYNC_INTERVAL - interval in which to perform a full sync of the keeper registry - default 30 min
  • KEEPER_MINIMUM_REQUIRED_CONFIRMATIONS - minimum number of confirmations before processing keeper logs - default 12
  • KEEPER_MAXIMUM_GRACE_PERIOD - maximum number of blocks to wait after performing upkeep before resuming regular checks - default 100
  • KEEPER_REGISTRY_CHECK_GAS_OVERHEAD - the amount of extra gas to send for checkUpkeep calls - default 200000
  • KEEPER_REGISTRY_PERFORM_GAS_OVERHEAD - the amount of extra gas to send for performUpkeep transactions - default 300000
  • KEEPER_REGISTRY_SYNC_UPKEEP_QUEUE_SIZE - the maximum number of upkeeps that can be synced in parallel - default 10

Start the node

Start the node using chainlink local node

Determine node's ethereum address

If you already know your node's eth address, you can skip this step.

  1. remotely login to your node using chainlink admin login
  2. observe the keys using chainlink keys eth list
  3. Copy the eth address of the key your node will be using for keeper jobs
  4. Make sure your account is funded!

You can also retrieve this information from the operator UI.

Ensure your node is on the keeper registry

Your node's address must have already been added to the keeper registry contract.

Creating a keeper job

Keeper jobs have the following spec format (v1.3.0):

type            = "keeper"
schemaVersion   = 3
name            = "example keeper spec"
contractAddress = "0x0000000000000000000000000000000000000000"
fromAddress     = "0x0000000000000000000000000000000000000000"
evmChainID      = 4

observationSource = """
encode_check_upkeep_tx   [type=ethabiencode
                          abi="checkUpkeep(uint256 id, address from)"
                          data="{\\"id\\":$(jobSpec.upkeepID),\\"from\\":$(jobSpec.fromAddress)}"]
check_upkeep_tx          [type=ethcall
                          failEarly=true
                          extractRevertReason=true
                          evmChainID="$(jobSpec.evmChainID)"
                          contract="$(jobSpec.contractAddress)"
                          gas="$(jobSpec.checkUpkeepGasLimit)"
                          gasPrice="$(jobSpec.gasPrice)"
                          gasTipCap="$(jobSpec.gasTipCap)"
                          gasFeeCap="$(jobSpec.gasFeeCap)"
                          data="$(encode_check_upkeep_tx)"]
decode_check_upkeep_tx   [type=ethabidecode
                          abi="bytes memory performData, uint256 maxLinkPayment, uint256 gasLimit, uint256 adjustedGasWei, uint256 linkEth"]
encode_perform_upkeep_tx [type=ethabiencode
                          abi="performUpkeep(uint256 id, bytes calldata performData)"
                          data="{\\"id\\": $(jobSpec.upkeepID),\\"performData\\":$(decode_check_upkeep_tx.performData)}"]
perform_upkeep_tx        [type=ethtx
                          minConfirmations=0
                          to="$(jobSpec.contractAddress)"
                          from="[$(jobSpec.fromAddress)]"
                          evmChainID="$(jobSpec.evmChainID)"
                          data="$(encode_perform_upkeep_tx)"
                          gasLimit="$(jobSpec.performUpkeepGasLimit)"
                          txMeta="{\\"jobID\\":$(jobSpec.jobID)}"]
encode_check_upkeep_tx -> check_upkeep_tx -> decode_check_upkeep_tx -> encode_perform_upkeep_tx -> perform_upkeep_tx
"""

Call the name whatever you want; contractAddress is the address of the keeper registry; and fromAddress is your node's eth address.

Clone this wiki locally