Docker

This repository provides a docker-compose file to run a fully-functional, Testnet network for Engram Tokio with proof-of-stake enabled. This configuration uses Lighthouse as a consensus client and Stryatum From EngramLabs for execution.

The development net is fully functional and allows for the deployment of smart contracts and all the features that also come with the Lighthouse consensus client such as its rich set of APIs for retrieving data from the blockchain. This development net is a great way to understand the internals of Engram proof-of-stake and to mess around with the different settings that make the system possible.

Using

$ git clone --recursive https://github.com/engram-network/tokio-docker.git 
$ cd tokio-docker
$ chmod +x ./scripts/*.sh
$ bash ./scripts/init-dependency.sh
$ mkdir -p execution consensus validator

Change a few lines of code inside docker-compose.yml

identity=avenbreaks << Replace with your discord username (e.g: avenbreaks. don't add your hastag discord user)
enr-address=13.210.210.210 << Replace with your public IPAddress
graffiti=engram-labs << Replace with your unique name

Then, run:

$ docker compose up -d

You will see the following:

$ docker compose up -d
[+] Running 4/4
 ⠿ Network tokio_default_default                           Created
 ⠿ Container striatum_init                                 Started
 ⠿ Container striatum_el                                   Started
 ⠿ Container lighthouse_cl                                 Started

Each time you restart, you can wipe the old data using ./clean.sh.

Next, you can inspect the logs of the different services launched.

$ docker logs striatum_el -f

see on striatum_el:

INFO [09-26|19:28:45.046] Forkchoice requested sync to new head    number=30729 hash=a38be3..648659 finalized=30652
INFO [09-26|19:28:57.045] Forkchoice requested sync to new head    number=30730 hash=eb3642..45f557 finalized=30652
INFO [09-26|19:29:09.046] Forkchoice requested sync to new head    number=30731 hash=b9fd32..3748bd finalized=30652
INFO [09-26|19:29:21.046] Forkchoice requested sync to new head    number=30732 hash=51ff7b..803756 finalized=30652
INFO [09-26|19:29:33.046] Forkchoice requested sync to new head    number=30733 hash=f80ac7..19e5f7 finalized=30652
$ docker logs lighthouse_cl -f

see on lighthouse_cl:

INFO Subscribed to topics
INFO Sync state updated      new_state: Evaluating known peers, old_state: Syncing Finalized Chain, service: sync
INFO Sync state updated      new_state: Syncing Head Chain, old_state: Evaluating known peers, service: sync
INFO Sync state updated      new_state: Synced, old_state: Syncing Head Chain, service: sync
INFO Subscribed to topics    topics: ["/eth2/9c4e948f/bls_to_execution_change/ssz_snappy"]

if your node is stuck unable to pull sync and losing peers, you just stop docker then restart it. however if this solution does not solve you can replace the bootnode and noderecord here:

Consensus Specification.

When losing peers the normal logs will show up like this on consensus: 

striatum_el
WARN [10-03|04:50:47.133] Beacon client online, but no consensus updates received in a while. Please fix your beacon client to follow the chain! 
WARN [10-03|04:55:47.172] Beacon client online, but no consensus updates received in a while. Please fix your beacon client to follow the chain!

lighthouse_cl
INFO Oct 03 04:59:39.001 WARN Low peer count                          peer_count: 0, service: slot_notifier
WARN Oct 03 04:59:39.001 INFO Searching for peers                     current_slot: 78259, head_slot: 5248, finalized_epoch: 162, finalized_root: 0xa9c8…f1f7, peers: 0, service: slot_notifier
WARN Oct 03 04:59:39.001 WARN Syncing deposit contract block cache    est_blocks_remaining: initializing deposits, service: slot_notifier

Engram Network Validator Node Setup Guide

This guide will walk you through the process of depositing and running node on the Engram network.

Prerequisites

Make sure you have eth2-val-tools and ethereal installed on your system.

$ bash ./scripts/dep-deposit.sh

wait until the binary installation is complete. and try to check

$ eth2-val-tools --help
$ ethereal version

If you cannot install automatically you can install manually and move the binary to the system folder, make sure you have installed golang:

$ sudo apt-get install gcc jq clang llvm g++ -y
$ go version
$ go install github.com/protolambda/eth2-val-tools@latest
$ go install github.com/wealdtech/ethereal@latest

$ sudo mv $HOME/go/packages/bin/eth2-val-tools /usr/local/bin
$ sudo mv $HOME/go/packages/bin/ethereal /usr/local/bin

Deposit Steps

Once everything required is fulfilled, you need to create a mnemonic phrase to prepare the deposit data.

$ eth2-val-tools mnemonic 
"female more wash genuine pilot slim exit mosquito glimpse blue science garlic creek upset acquire soup silent submit pitch spatial maple measure mutual picnic"

and keep your mnemonic!

Not Your Key, Not Your Coin

Obtain the following parameters in validator-deposit-data.sh:

$ nano ./scripts/validator-deposit-data.sh
amount: The amount of tGRAM to deposit (e.g., 32000000000)
smin: source min value (e.g., 0)
smax: source max value (e.g., 1)
withdrawals-mnemonic: your mnemonic phrase from generate eth2-val-tools.
validators-mnemonic: your mnemonic phrase from generate eth2-val-tools.
from: address that was already funded from the faucet.
privatekey: your privatekey address that has funds from the faucet.

Run the following command to generate final the deposit data.

./scripts/validator-deposit-data.sh

wait until the script executes the deposit data. if the deposit is successful you will get the file: testnet_deposit_0_1.json

Run the following command to generate the deposit keystore. it will show you will make a keystore deposit using engram-deposit-cli.

Creating Keystore

Once you have completed the step of creating a keystore deposit, it will look like this:

./scripts/run-key.sh

wait for docker to bring up the interface to create a keystore deposit.

Using the tool on an offline and secure device is highly recommended to keep your mnemonic safe.

Please choose your language ['1. العربية', '2. ελληνικά', '3. English', '4. Français', '5. Bahasa melayu', '6. Italiano', '7. 日本語', '8. 한국어', '9. Português do Brasil', '10. român', '11. Türkçe', '12. 简体中文']: [English]: 
Please repeat the index to confirm: 0

Please enter your mnemonic separated by spaces (" "). Note: you only need to enter the first 4 letters of each word if you'd prefer.: enter mnemonic from generating eth2-val-tools
Please choose the (mainnet or testnet) network/chain name ['mainnet', 'goerli', 'sepolia', 'zhejiang', 'holesky', 'engram', 'mainnet']: engram
Create a password that secures your validator keystore(s). You will need to re-enter this to decrypt them when you setup your Ethereum validators.: 

Create a password that is easy to remember. this will refer to importing the keystore in the lighthouse client.

Once you have completed the step of creating a keystore deposit, it will look like this:

Creating your keys.
Creating your keystores:          [####################################]  1/1
Verifying your keystores:         [####################################]  1/1
Verifying your deposits:          [####################################]  1/1

Success!
Your keys can be found at: validator_keys/validator_keys

After that, create a password.txt file in the custom_config_data folder and fill your password from create keystore before

Running Validator Node

$ docker inspect lighthouse_cl | grep "IPAddress"
  "IPAddress": "172.30.0.3",

Copy the IPAddress of the lighthouse_cl container and change the docker-compose-validator.yml section

--beacon-nodes=http://CHANGE_IPAddress:5052
--suggested-fee-recipient=CHANGE_WITH_YOUR_ADDRESS
--graffiti=CHANGE_WITH_YOUR_DISCORD_USER_WITHOUT_HASHTAG
docker compose -f docker-compose-validator.yml up -d

Attention!

Making a deposit takes time for the protocol to receive and validate your deposit data and keystore, it takes at least 18-46 hours (estimation only) for the protocol to completely validate your data.

Last updated