Shibarium
Search
K

Add new Node using ansible (Mainnet)

Pre-requisite - Ubuntu 20.04

AWS instance setup steps

Launch an instance.
Create a key pair.
Instance Type and Network Settings.
Security Group and Storage.
Now, Launch your instance.
Login into instance.

Full Validator Node Deployment (Shibarium Testnet)

The Ansible playbook is used to configure and manage a full node. It will configure your systemed services, genesis for Heimdall and Bor. You Need to update Node config.

Pre-requisites:

  • Ansible should be installed on local machine with Python3.x. Or create an AWS instance for ansible. The setup will not work if you have Python2.x.
sudo apt-get update
sudo apt install -y python3-pip
  • To install ansible with Python 3.x you can use this command. This will install Python 3 dependencies as well as Ansible.
pip3 install ansible
sudo apt install ansible
git clone https://github.com/shibaswaparmy/node-ansible.git
cd node-ansible
  • Update your inventory.yml with your instance IP.
all:
hosts:
children:
sentry:
hosts:
xxx.xxx.xx.xx: # <----- Add IP for sentry node
xxx.xxx.xx.xx: # <----- Add IP for sentry node
validator:
hosts:
xxx.xxx.xx.xx: # <----- Add IP for validator node
  • Example.
all:
hosts:
children:
sentry:
hosts:
32.44.56.789:
validator:
hosts:
12.34.56.789:
22.34.56.780:
localhost:
MAKE SURE TO FOLLOW THE ORIENTATION IN THIS MANNER

To run the ansible from instance itself

Copy your Private key to the instance.
  • Update your ansible.cfg with
private_key_file = #path to your instance private key file(xxx.pem)
sudo chmod 400 path_to_pem_file
  • You will also need to make sure that Go is not installed on your VM / Machine. Setting up your full node through ansible will run into issues if you have Go already installed, as ansible requires specific packages of Go to be installed.
  • You will also need to make sure that your VM / Machine does not have any previous setups for Shibarium Validator or Heimdall or Bor. You will need to delete them as your setup will run into issues.
    • Check the connection of your instance from local by ansible
ansible-playbook -l sentry playbooks/clean.yml 2ansible-playbook -l validator playbooks/clean.yml
  • Checking Node Connectivity.
# to check if sentry nodes are reachable
ansible sentry -m ping
SUCCESS MESSAGE:
xx.xx.xx.xxx | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
# to check if validator nodes are reachable
ansible validator -m ping
xx.xx.xx.xxx | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}

Full node set up for Shibarium Testnet

  • Validator set up (without Sentry)
### Validator node setup (with-out sentry)
To show list of hosts where the playbook will run (notice `--list-hosts` at the end):
ansible-playbook -l validator playbooks/network.yml --extra-var="bor_branch=v0.2.14 heimdall_branch=v0.2.9-bone network_version=dev network_launch_branch=mainnet node_type=without-sentry heimdall_network=local" --list-hosts
To run actual playbook on validator node:
ansible-playbook -l validator playbooks/network.yml --extra-var="bor_branch=v0.2.14 heimdall_branch=v0.2.9-bone network_version=dev network_launch_branch=mainnet node_type=without-sentry heimdall_network=local"
In case you run into any issues, delete and clean the whole setup using
ansible-playbook -l sentry playbooks/clean.yml
ansible-playbook -l validator playbooks/clean.yml

Configure the validator node

NOTE: To complete this section, you must have a RPC endpoint of your fully synced Ethereum mainnet node ready.

Configure the Heimdall Service

Log into the remote validator machine.
  • Open config.toml for editing
nano ~/.heimdalld/config/config.toml
Change the following:
  • moniker — any name. Example: moniker = "my-validator-node".
  • pex — set the value to false to disable the peer exchange. Example: pex = false.
  • private_peer_ids — comment out the value to disable it. Example: # private_peer_ids = "".
To get the node ID of Heimdall on the sentry machine:
  1. 1.
    Login to the sentry machine.
  2. 2.
    Run heimdalld tendermint show-node-id.
  3. 3.
    Now again Login into Validator node -
    1. 1.
      Open config.toml for editing vi ~/.heimdalld/config/config.toml.
      Set - persistent_peers = "sentry_machineNodeID@sentry_instance_ip:26656"
    2. 2.
      If you didn’t setup your own sentry node , Then you need to use seeds
  1. 1.
    If you setup your own sentry node, Then use -
    1. 1.
      sentry_machineNodeID@sentry_instance_ip:26656
  • prometheus — set the value to true to enable the Prometheus metrics. Example: prometheus = true.
  • max_open_connections = 100;
  • Save the changes in config.toml.
  • Open for editing nano ~/.heimdalld/config/heimdall-config.toml.
  • In heimdall-config.toml, change the following:
  • eth_rpc_url — an RPC endpoint for a fully synced Ethereum mainnet node, i.e Infura. eth_rpc_url =<insert Infura or any full node RPC URL to Ethereum>
Example:
eth_rpc_url = "https://goerli.infura.io/v3/xyz"
eth_rpc_url = "https://eth-goerli.g.alchemy.com/v2/xyz"
  • Save the changes in heimdall-config.toml.

Configure the Bor Service

To get the node ID of Bor on the sentry machine:
  • Log into the sentry machine.
  • Run bootnode -nodekey ~/.bor/data/bor/nodekey -writeaddress.
  • Now again login to Validator node -
    1. 1.
      Open for editing nano ~/.bor/data/bor/static-nodes.json.
  • If you didn’t setup your own sentry node , Then you need to use
```
f5fdf04f2f7dfdd8522fcd6418b61cd8307b3734348b8af531d0d3fbe3d047ecc00e071e8fc48e4668a345b1f0c4cf7132f0967b592a3d87a96ddc104b8744f7@52.6.145.99:30303
e000b17168e0b586340da21d2a96129db9e4ecfa0aac12e8ec48a90fb049c165a190e4fce543b2ad43f2968312f3ce2b6820b1fac45b17273d77bc6de671b27e@52.6.79.52:30303
23b746e230b70a0ec749adb5947d3993dcf2264f7ecfa408f439dadc6a5d1811e69e2733f0f4b7c8fb47adf348906575c9c45c3c244058bc3d3906bcddb6584e@54.237.88.44:30303
ce63f1ed651a31b6acd8dfbd4488229f16e0d787cdc1fe18e2d5dcf9323276912453afe33880b59e8673895537b06efe53f6cac8008efbe5e6d00a16148ffd0b@75.101.231.169:30303
10778d63b6bc8f2b9d0f228b8047ef81cc56dd19f414d334b10cb7c19bca526ed0d2c1f20ac650f13aea491149889a74fc0ef4768cee18b6abfb97b5afe00c7e@50.16.175.79:30303
```
  • If you setup your own sentry node, Then use -
    1. 1.
      "enode://enode@sentry_machine_ip:30303"
  • Example:
"enode://1e7a791c3bf22e5f398a24da638345b9446b71a3a84229cff15b9e0369fa8d90e82a56535eecbc04fba1c84c257c926303f706f83a63c8f74c9ce76c28158b83@13.232.33.209:30303"
  • Save the changes in static-nodes.json.

Set the owner and signer key

Wallet creation --- shibaswaparmy/wallet-utils

On Shibarium, you should keep the owner and signer keys different. Generate New wallet, and use its private key in next step as ETHEREUM_PRIVATE_KEY
  • Signer — the address that signs the checkpoint transactions. The recommendation is to keep at least 1 ETH on the signer address.
  • Owner — the address that does the staking transactions. The recommendation is to keep the BONE tokens on the owner address.

Generate a Heimdall private key

You must generate a Heimdall private key only on the validator machine. Do not generate a Heimdall private key on the sentry machine.
  • To generate the private key, run:
heimdallcli generate-validatorkey ETHEREUM_PRIVATE_KEY
NOTE: ETHEREUM_PRIVATE_KEY — your Ethereum wallet’s private key.
This will generate priv_validator_key.json. Move the generated JSON file to the Heimdall configuration directory:
mv priv_validator_key.json ~/.heimdalld/config

Generate a Bor keystore file

You must generate a Bor keystore file only on the validator machine. Do not generate a Bor keystore file on the sentry machine.
  • To generate the private key, run:
heimdallcli generate-keystore ETHEREUM_PRIVATE_KEY
NOTE: ETHEREUM_PRIVATE_KEY — your Ethereum wallet address.
When prompted, set up a password to the keystore file.
This will generate a UTC-<time>-<address> keystore file.
  • Move the generated keystore file to the Bor configuration directory:
mv UTC-<time>-<address> ~/.bor/keystore/

Add password.txt

Make sure to create a password.txt file then add the Bor keystore file password right in the ~/.bor/password.txt file.
nano ~/.bor/password.txt

Add your Ethereum address

Open for editing
sudo nano /etc/shib/metadata
In metadata, add your Ethereum address. Example: VALIDATOR_ADDRESS=0xca67a8D767e45056DC92384b488E9Af654d78DE2.
Save the changes in metadata.