How to run Node.js scripts for Keeper Networks

Lock3r Network
4 min readDec 10, 2020

If this doesn’t help you then nothing will…

In order to be a successful relayer on Keeper Networks such as Lock3r, Keep3r and Relay3r, you will most likely only succeed in execution of Job Contracts by running a script or the OpenZeppelin Defender.

In this article we will not be covering the latter, so if you want to learn about how to use the OpenZeppelin Defender for Keep3r then here is your link — https://openzeppelin.com/defender/.

Clone the Lock3r Jobs Repository

https clone — https://github.com/lock3r-network/lock3r-jobs.git

  • Open Terminal.
  • Change the current working directory to the location where you want the cloned directory.
  • Type git clone, and then paste the github URL you have copied from above.

$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

  • Press Enter to create your local clone.

$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY > Cloning into `Spoon-Knife`... > remote: Counting objects: 10, done. > remote: Compressing objects: 100% (8/8), done. > remove: Total 10 (delta 1), reused 10 (delta 1) > Unpacking objects: 100% (10/10), done.

How do I run a script with Docker (Dependencies and brief steps)

  • A directory with the job scripts configured — steps below.
  • A working machine — This could be a personal computer or even a Virtual Machine, which is a great inexpensive running option and Google Cloud Platform provide cheap instances for this.
  • Node.Js
  • TMUX — The provided link is a tutorial on how to setup TMUX for Mac OS users.
  • An Ethereum externally owned address (EOA) — You can also create one using the following steps
  • Some gwei (ETH Gas)
  • An Infura account so you can access a node — You can use any node provider of your choice, but the scripts will need to be re-configured to support this.
  • A validated Locker, Keeper or Relayer — Activated bonds and hold the minKeep requirement, in most cases this is ‘0’.

Steps to build the script

You will need to have Docker and Docker-Compose installed. Refer to the Docker installation guide. If you are running the relayer on a Linux server, you will have to install docker-compose separately. Refer to docker-compose installation guide

Steps to launch your relayer (lock3r script)

  • Rename the file env.example to .env

Default .env:

MNEMONIC=
INFURA_PROJECT_ID=
JOBS= Lock3rOracle,LK3RsExecutingOnUnitrade
  • Navigate in your terminal to the directory where you have the lock3r-jobs repository on your local ‘cd lock3r-jobs'
  • Run npm install
  • If you want to use an existing wallet set your MNEMONIC in the .env
  • Get an Infura Project Id from Infura and set it to INFURA_PROJECT_ID key
  • Set the jobs you want to work on in the .env, concat the names with a comma. Refer to the “Available Jobs” section for the names.
  • Run docker-compose up -d to start the container in the background.
  • If you did not supply a wallet, one will be created automatically. The mnemonic will be set in the .env file. Make sure to note it in case you loose the file. You will be able to see the address by looking at the log files with docker-compose logs

Your container is set to restart every time if it crashes or when Docker is launching. If you want to disable this behaviour change restart: always to restart: "no" in the docker-compose.yml file.

How do I run a script without Docker (Dependencies and brief steps).

Same applies to the above when working with Docker other than for a few changes, so to reiterate and inform — you will require:

  • A directory with the job scripts configured — steps below.
  • A working machine — This could be a personal computer or even a Virtual Machine, which is a great inexpensive running option and Google Cloud Platform provide cheap instances for this.
  • Node.Js
  • TMUX — The provided link is a tutorial on how to setup TMUX for Mac OS users.
  • An Ethereum externally owned address (EOA) — You can also create one using the following steps
  • Some gwei (ETH Gas)
  • An Infura account so you can access a node — You can use any node provider of your choice, but the scripts will need to be re-configured to support this.
  • A validated Locker, Keeper or Relayer — Activated bonds and hold the minKeep requirement, in most cases this is ‘0’.

Steps to launch without Docker

  • Navigate in your terminal to the directory where you have the lock3r-jobs repository on your local ‘cd lock3r-jobs'
  • Run npm install
  • Create a wallet by running node createwallet, this will give you the mnemonic, privatekey and public address of the newly created wallet.
  • Rename the file env.example to .env
  • Configure the .env file with the previously generated mnemonic and Infura Project Id from Infura.
  • Set the jobs you want to work on in the .env, concat the names with comma.
  • open a TMUX session with tmux
  • execute npm start.
  • Detach from TMUX and let the script run in the background.

It is worth mentioning that the steps to create a new wallet is not required and if this is to be followed, you will still require Keeper/Locker rights in order to be applicable to execute the job contracts. You can transfer rights to the newly created address directly through the UI at Lock3r.Network or by interacting directly with the smart contracts on Etherscan.

Follow our Twitter — twitter.com/lock3rnetwork and Telegram — T.me/lock3rnetworkchannel to stay informed on our latest updates and publications.

We also have our documentation posted here in the meantime — docs.lock3r.network

--

--

Lock3r Network

Lock3r - Andre's vision, with fairer ownership/distribution. Encouraging a community maintained ecosystem, by providing MaaS - Maintenance as a Service - $LK3R