KEEP — Random Beacon Node on VULTR

Chandru
7 min readAug 2, 2020

Here are the detailed steps from start to end on setting up KEEP Random Beacon Node on vultr.com VPS. It would take about ~1 hr from start to end. Potentially can take longer if you get stuck in any of the below steps.

If you already have a Ubuntu VPS(server) ready to go, skip section 1 and directly go to section 2.

Main sections of setup —

  1. Server setup on vultr.com setup
  2. MyEtherWallet setup for new ETH account
  3. KEEP Token Grant
  4. KEEP dashboard contracts
  5. Infura project
  6. Vultr.com Server setup for Random Beacon node

You would need to do all the steps to have the Random Beacon Node running.

1 —Server setup on vultr.com setup

Go to vultr.com and signup. They are offering 100$ credit for first 30 days. Signup process is pretty straightforward. Once signed into your account, follow the below steps.

1.a — After logging into account — you will be taken to the below main page. Click “Deploy Instance”.

1.b — You will be taken to Deploy Instance page. On this page, choose the below setup.

  • For “Choose Server” — Leave the Choose Server to “Cloud Compute”
  • For “Server Location” –Leave the Server Location to Default unless you want to be specific.
  • For “Server Type” — Select the server type to UBUNTU and select 18.04 as below.
  • For “Server Size” — I went with 10$ option. But you can also go with 5$ option to start with.
  • For “Additional Features” — Leave it to default — all unchecked.
  • For “Startup Script” — Not needed
  • For “SSH Keys” — Add public key if you like to login via SSH. For this guide, I will leave it blank i.e. not setup SSH login.
    Note: Vultr auto-generates the root password if you do not setup SSH.
  • For “Server Hostname & Label” — I enter “KEEP-ON-VULTR”, you can enter the desired name.
  • Click Deploy Now.

Give it few mints for the server to be setup.

1.c — Once the Server is deployed — go to “Products”, “Instances” tab as shown below. On Instances, click on “Server Details” as shown.

Copy the “IP address” and “Password”.

That’s the end of section 1.

2 — MyEtherWallet setup for new ETH account

Go to https://www.myetherwallet.com/

2.a — Create a new Wallet — Accept the defaults and click ‘Next’ few times — then you get to the below page.
2.b — Click “By Keystore File”, enter the password and click “Next”.

2.c — Give it few moments and once the keystore file is ready, download it locally to your computer. Once downloaded, rename it to keep_wallet.json (optional).

2.d — Now get some Ropsten ETH from ETH faucets.
https://faucet.ropsten.be/
https://teth.bitaps.com/
https://faucet.dimensions.network/

That’s the end of section 2.

3 — KEEP Token Grant

3.a — Open the keep_wallet.json file (from 2.c) and you will get the ETH address. Add 0x to this to get your complete address as “0x436c87808eda3f52cad17f7bcd70e78cd2fa86bd”
3.b — go to https://us-central1-keep-test-f3e0.cloudfunctions.net/keep-faucet-ropsten?account=0x436c87808eda3f52cad17f7bcd70e78cd2fa86bd and get token grant.
If you successfully get a 300k token grant, you will get the below screen. If you get a token grant failed, give it sometime and keep trying. This is mandatory to proceed to next steps.

That’s the end of section 3.

4 —KEEP dashboard contracts

4.a — Import the new ETH address using json file into metamask on chrome as below.

4.b — Go-to : https://dashboard.test.keep.network/tokens and connect the newly imported ETH account from Metamask.
4.c — Delegate the KEEP tokens as below with your ETH address. Accept/Confirm the Metamask Transaction.

4.d — Go to Applications sections and authorize Contracts for tBTC. Note: It takes a while to load this page. Hang on !
Click Authorize and Accept/Confirm the Metamask Transaction — repeat for all. Add some ETH for bonding. Once done, it should look like below.

4.e — Go to Applications sections and authorize Contracts for Random Beacon. Note: It takes a while to load this page. Hang on !
Click Authorize and Accept/Confirm the Metamask Transaction. Once authorized, it should look like below.

That’s the end of section 4.

5 — Infura Project

5.a —Register at https://infura.io/register. Create a project and you can name it whatever you want.
5.b —Switch to Ropsten and copy project ID and endpoints — you will need this later. Shown below.

That’s the end of section 5.

6 — Vultr.com Server setup for Random Beacon node

Here comes the exciting part of node setup.

6.a — Login to your server through putty using the IP address, user name = root and Password generated by VULTR (step 1.c). Or if you used SSH — login to server via SSH.
Note: If you do not have putty already installed, download from here https://www.putty.org/

6.b — One of the first command I always run on new server is

sudo apt-get update

6.c — I recommend changing the default password using the below command (optional).

passwd

6.d — Add Firewall rules.

sudo ufw allow 22/tcp
sudo ufw allow 3919/tcp
sudo ufw enable

6.e — Get the Docker for your server using below commands.

sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io curl -y
sudo systemctl start docker
sudo systemctl enable docker
sudo docker –version

6.f — Setup directory structure.

mkdir -p $HOME/keep-client/config
mkdir -p $HOME/keep-client/keystore
mkdir -p $HOME/keep-client/persistence

6.g — Export the below environment variables.

export SERVER_IP=$(curl ifconfig.me)
export INFURA_PROJECT_ID=”<your_infura_project_step_5.b>"
export ETH_WALLET=”<your_ETH_address_step_2.c>”
export KEEP_CLIENT_ETHEREUM_PASSWORD=”<your_ETH_password_step_2.b>

Echo the variables to see if they are correctly set —

echo $SERVER_IP
echo $INFURA_PROJECT_ID
echo $ETH_WALLET
echo $KEEP_CLIENT_ETHEREUM_PASSWORD

6.h — keystore file setup.

nano $HOME/keep-client/keystore/keep_wallet.json

Copy the keep_wallet.json file contents to newly created file on server keep_wallet.json
Save and exit.
To confirm if the file is correct check with cat command,

cat keep-client/keystore/keep_wallet.json

6.i — Config file setup.

nano $HOME/keep-client/config/config.toml

Update Infura End points (step 5.b) and ETH address (step 2.c). Rest of the things, you can copy as-is.

# Ethereum host connection info.
[ethereum]
URL = “wss://ropsten.infura.io/ws/v3/f5fbf14d4a494fc1bcd5b18ce48a1279”
URLRPC = “https://ropsten.infura.io/v3/f5fbf14d4a494fc1bcd5b18ce48a1279"
# Keep operator Ethereum account.
[ethereum.account]
Address = “0x436c87808eda3f52cad17f7bcd70e78cd2fa86bd”
KeyFile = “/mnt/keystore/keep_wallet.json”
# Keep contract addresses configuration.
[ethereum.ContractAddresses]
KeepRandomBeaconOperator = “0x9233Fd6C58e37dab223EF1dFD5e33eD69FD1f93b”
TokenStaking = “0x88B3D0Bfb8F207292Dc4Cee7C923d0E7C3078a18”
KeepRandomBeaconService = “0xa5018dbeB6920A04e0CFd3D8F0F45BC851838b0D”
# Keep network configuration.
[LibP2P]
Peers = [
“/dns4/bootstrap-2.core.keep.test.boar.network/tcp/3001/ipfs/16Uiu2HAmQirGruZBvtbLHr5SDebsYGcq6Djw7ijF3gnkqsdQs3wK”,
“/dns4/bootstrap-3.test.keep.network/tcp/3919/ipfs/16Uiu2HAm8KJX32kr3eYUhDuzwTucSfAfspnjnXNf9veVhB12t6Vf”,
“/dns4/bootstrap-2.test.keep.network/tcp/3919/ipfs/16Uiu2HAmNNuCp45z5bgB8KiTHv1vHTNAVbBgxxtTFGAndageo9Dp”
]
Port = 3919
# Override the node’s default addresses announced in the network
AnnouncedAddresses = [“/ip4/$SERVER_IP/tcp/3919”]
# Storage is encrypted
[Storage]
DataDir = “/mnt/persistence”

Note: Bootstrap peers keep changing and you might have to check in discord/github to get the latest.

6.j — Start docker using below command.

sudo docker run -dit \
--restart always \
--volume $HOME/keep-client:/mnt \
--env KEEP_ETHEREUM_PASSWORD=$KEEP_CLIENT_ETHEREUM_PASSWORD \
--env LOG_LEVEL=debug \
--name keep-client \
-p 3919:3919 \
keepnetwork/keep-client:latest --config /mnt/config/config.toml start

Note: Version v1.2.0-rc might get updated and you might have to check in discord/github to get the latest.
If something messed up during setup, you have to stop/remove and then recreate the docker.

6.k — Check if docker is running and check logs.

sudo docker ps -a
sudo docker logs keep-client -f

6.l — Check if you are connected to peers :

sudo docker logs keep-client -f | grep “peers”

If your count is more than 0, you are good and done. You have now successfully deployed your KEEP Random Beacon Node on Vultr.com, Congraultaions !!

If you get stuck with any steps, hop into discord and there are many folks who can help !

Additional resources :

--

--