Tutorial: Keep’s Random Beacon Client on Jetson Nano (ARM) — Parley Labs

Parley Labs, Inc.
Coinmonks
Published in
5 min readApr 27, 2020

--

If you’re not familiar with keep.network, you can read a few of these articles to fill yourself in, but if you stumbled upon this page, you probably already know, so lets get started:

Resources:
Introducing Keep
How to get KEEP — Stake ETH

This guide will walk you through setting up your NVIDIA Jetson Nano to run the Keep Random Beacon on the Ethereum’s Reposten testnet with a GETH light client running locally. We will build from source here as I had trouble building from Docker (I’ll explore that next). Some instructions are derived from https://www.notion.so/Keep-Testnet-User-Guide-3d67d4a185ac4e11be86b51a02256fab and https://medium.com/@novysf/run-a-keep-network-testnet-node-37096946af35, which helped me get started and figure out how to set things up on my device. Thanks for showing us the way!

*This should work for any ARM device such as Raspberry Pi, but I haven’t tested it out yet.

  1. Running Ubuntu 18.04 on ARM device.
  2. Running as root
  3. Go installed
  4. Geth + Developer tools (See Below)
  5. Solidity Compiler (See Below)
  6. Keep-Core (See Below)

Prepare System

  1. Setup your Jetson Nano on a fresh drive: https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit. This gets you setup with Ubuntu 18.04.
  2. Enable Root Login: As root, edit the sshd_config file in /etc/ssh/sshd_config:
nano /etc/ssh/sshd_config

Add a line in the Authentication section of the file that says PermitRootLogin yes. This line may already exist and be commented out with a "#". In this case, remove the "#".

# Authentication: #LoginGraceTime 2m PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10

Save the updated /etc/ssh/sshd_config file. Restart the SSH server:

service sshd restart

You can now connect to the conversion server as root over SSH.

Setting up GO

First to install GETH we’ll install GO, it’ll be needed for the other builds too. We’ll get the latest release (v1.14 as of this writing) for our board (ARMv8) https://golang.org/dl/. *Raspberry Pi 3 is also running an ARMv8.

tar -C /usr/local -xzf go1.14.2.linux-arm64.tar.gzexport PATH=$PATH:/usr/local/go/bin

Setting up GETH

UPDATE 4/28/2020:

Go to https://geth.ethereum.org/downloads/ and download the Geth & Tools archive for Linux Arm64 stable release. If you want to build from source, you can continue on below.

We’ll be building GETH from source, since we need some of the developer tools to build the project.

With Go installed, you can download the project into you GOPATH workspace via:

go get -d github.com/ethereum/go-ethereum

Change your directory to the go-ethereum folder:

cd /root/go/src/github.com/ethereum/go-ethereum/

Build the entire project and install geth along with all developer tools:

Build Solidity

Build Solidity Compiler (because solc is a required function to run the go build on the ARM)

https://solidity.readthedocs.io/en/v0.5.3/installing-solidity.html#clone-the-repository

To clone the source code, execute the following command:

git clone --recursive <https://github.com/ethereum/solidity.git> cd solidity

Make sure you checkout solidity version 0.5.17 (required by the keep-core repo)

git checkout tags/v0.5.17

The following script nstalls all required external dependencies on macOS, Windows and on numerous Linux distros.

./scripts/install_deps.sh

Build and install solc

#note: this will install binaries solc and soltest at usr/local/bin ./scripts/build.sh

Creating Ropsten Keystore

Here we will create a keystore to for a new wallet Operator address. You’ll need to open two terminals for this:

geth --ropsten --nousb --syncmode "light" -rpc --rpcapi="eth,net,web3,personal,web3" -wsgeth --ropsten attachpersonal.newAccount()
  • Now that we have created the operator account exit the geth console.
  • Make a note of the name the keystore file for this account:
ls ~/.ethereum/testnet/keystore

Copy your keystore file to /root/keepclient/

cd /root mkdir keepclient cp /root/.ethereum/testnet/keystore/<keystore file name> /root/keepclient/keystore

Get KEEP and ETH to run on testnet

  • Drip some testnet ETH to your operator account from the Ropsten faucet: https://faucet.ropsten.be/. The operator account needs some ETH to pay for gas for operations.
  • Using the address of your owner account request a Keep token grant by visiting the following URL: https://us-central1-keep-test-f3e0.cloudfunctions.net/keep-faucet-ropsten?account=OPERATOR_ACCOUNT_ADDRESS
  • Open the Keep Dashboard, connect your owner account with Metmask and delegate your token grant to the operator account. Use your owner account for both the beneficiary and authorizer addresses.
  • From the authorizer page of the Keep Dashboard, authorize the KeepRandomBeaconOperator address as specified in your config,toml.

Create Configuration For keep-core

Create a config.toml file, substituting your OPERATOR_ACCOUNT_ADDRESS and KEYSTORE_FILE_NAME with the values obtained in previous steps. You also need to replace VPS_IP_ADDRESS with the IP address of your system, I commented it out because I'm not announcing my module as it's behind a firewall.

Note the contract addresses and bootstrap peers are correct at the time of publishing but you should check for the latest values at https://docs.keep.network/run-random-beacon.html#_testnet.

# Ethereum host connection info. 
[ethereum]
URL = "ws://127.0.0.1:8546"
URLRPC = "http://172.0.0.1:8545"
# Keep operator Ethereum account.
[ethereum.account]
Address = "OPERATOR_ACCOUNT_ADDRESS"
KeyFile = "/root/keepclient/keystore"
# Keep contract addresses configuration.
[ethereum.ContractAddresses]
# Hex-encoded address of KeepRandomBeaconOperator contract
KeepRandomBeaconOperator = "0xe1f5c786e5958935878eacb844bbe74767e9c3e9"
# Hex-encoded address of TokenStaking contract
TokenStaking = "0x09b3B8370C2683c9eFC5be5A58643AdaFC412AaC"
# Hex-encoded address of KeepRandomBeaconService contract. Only needed
# in cases where the client's utility functions will be used (e.g., the
# relay subcommand).
KeepRandomBeaconService = "0x3dE1c24a19d9bd89b4d4Ea4b23645481480DB0be"
# Keep network configuration.
[LibP2P]
Peers = ["/dns4/bootstrap-1.test.keep.network/tcp/3919/ipfs/16Uiu2HAm3eJtyFKAttzJ85NLMromHuRg4yyum3CREMf6CHBBV6KY", "/dns4/bootstrap-2.test.keep.network/tcp/3919/ipfs/16Uiu2HAmNNuCp45z5bgB8KiTHv1vHTNAVbBgxxtTFGAndageo9Dp", "/dns4/bootstrap-3.test.keep.network/tcp/3919/ipfs/16Uiu2HAm8KJX32kr3eYUhDuzwTucSfAfspnjnXNf9veVhB12t6Vf", "/dns4/bootstrap-4.test.keep.network/tcp/3919/ipfs/16Uiu2HAkxRTeySEWZfW9C83GPFpQUXvrygmZryCN6DL4piZrbAv4"]
Port = 3919
# Override the node's default addresses announced in the network
# AnnouncedAddresses = ["/ip4/VPS_IP_ADDRESS/tcp/3919"]
# Storage is encrypted [Storage] DataDir = "/keepclient/data"

Build keep-core

Install protoco buffers: https://github.com/protocolbuffers/protobuf/blob/master/src/README.md

Install dependencies:

$ sudo apt-get install autoconf automake libtool curl make g++ unzip

Get protocol buffers

cd /root git clone <https://github.com/protocolbuffers/protobuf.git> cd protobuf git submodule update --init --recursive ./autogen.sh

To build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) execute the following:

./configure make make check make install ldconfig # refresh shared library cache.

Install protoc-gen-gogoslick

go get -u [github.com/gogo/protobuf/protoc-gen-gogoslick](<http://github.com/gogo/protobuf/protoc-gen-gogoslick>)

Go back to keep-core directory and build:

cd /root git clone <https://github.com/keep-network/keep-core.git> git checkout tags/v0.14.1-rc # gets the current release build cd keep-core

Now generate and build keep-core:

go generate ./... go build -a -o keep-core .

Run run.sh script and follow instructions:

# from /root/keep-client ./scripts/run.sh

--

--

Coinmonks
Coinmonks

Published in Coinmonks

Coinmonks is a non-profit Crypto Educational Publication. Other Project — https://coincodecap.com/ & Email — gaurav@coincodecap.com

Parley Labs, Inc.
Parley Labs, Inc.

Written by Parley Labs, Inc.

Based out of Southern California, Parley Labs is focused on building, testing and validating new technology related to autonomous and distributed systems.

No responses yet