Kratos Tutorial - Running A Fullnode

Posted by OneLedger on Apr 26, 2021 12:27:55 PM

 

 

There are 3 ways to set up OneLedger Kratos Full Node:

  1. GCP Marketplace Image
  2. Docker Image
  3. Build the Source Code

Video Tutorial

 

 

  1. GCP Marketplace Image
    1. Run a node on Google Cloud Marketplace now by clicking here

* Choose the name from your OneLedger instance 

* Choose a machine type with at least 7.5GB of RAM; GCP charges you only based on the number of cores you choose, we recommend using 2 vCPUs

* You can keep all other fields set to the default values

* Click Deploy

 

    1. Now you are up and running. Click on SSH to run your node.
    2. Check the Fullnode service and check the status

      sudo service olfullnode start
      sudo olfullnode status
  1. Docker Image
    1. Install docker on your machine.

sudo apt-get update

sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

sudo add-apt-repository "deb [arch=amd64]

https://download.docker.com/linux/ubuntu  $(lsb_release -cs)  stable"

sudo apt-get update

sudo apt-get install docker-ce

 

    1. Now pull Kratos Fullnode docker image from dockerhub.
      docker pull oneledgertech/kratos
    2. Now run the docker image to start Kratos Fullnode.
      docker run -it "image-id" /bin/bash 
  1. Build the Source Code

 

    1. Install golang v0.13+ following instruction
    2. Install libraries
      sudo apt-get install libleveldb-dev libsnappy-dev
    3. Download the binary
      wget https://github.com/Oneledger/protocol/releases/download/v0.16.3/olclient
      wget https://github.com/Oneledger/protocol/releases/download/v0.16.3/olfullnode
      chmod +x olclient
      chmod +x olfullnode
      And then put these binary to under any place of your executable $PATH (Example: /usr/local/bin)
    4. Verify the binary’s md5:
      For olfullnode:
      md5sum olfullnode
      should get
      9618d6b48d6e34406f7532bea2c80708 olfullnode
      For olclient:
      md5sum olclient
      should get
      deeba93c41194645f387eda3576e02e5 olclient

    5. Initialize the node
      export OLDATA="any place that you want to run the node"
      cd $OLDATA
      wget
      https://raw.githubusercontent.com/Oneledger/kratos-genesis/master/genesis.json
      wget
      https://raw.githubusercontent.com/Oneledger/kratos-genesis/master/config.toml
      olfullnode init --genesis genesis.json --node_name "your preferred name" --root ./
    6. P2P Configuration
      Configure your "config.toml" file to make the network more stable and protect your nodes.

                     

  1. if you want your node to be connectable by others through p2p

# Main address for P2P connections

p2p_address = "tcp://<your-internal-ip>:26605"

# Address to advertise for incoming peers to connect to

external_p2p_address = "tcp://<your-external-ip>:26605"

 

  1. if you want to hide one node with a sentry node.

get node id with

      olfullnode show_node_id --ip

you will get id like

      3c498d34846159daa9fcf265d8a3f4dcd46641d1@127.0.0.1:26605 

configure the sentry and protected node like following

sentry:

        # List of peers to maintain a persistent connection to

persistent_peers = ["<protected-node-id>@<protected-node-ip>:26605"]

# List of peer IDs to keep private (will not be gossiped to other peers)

        private_peer_ids = ["<protected-node-id>"]

protected node:

# List of peers to maintain a persistent connection to

persistent_peers = ["<sentry-node-id>@<sentry-node-ip>:26605"]

 

    1. Run the node

         olfullnode node --root ./

 

              or

 

         Run the node in background creating systemd service file:

 

   

 

cd /etc/systemd/system

vim olfullnode.service (Add below content)


[Unit]

Description=olfullnode


Wants=network-online.target

After=network-online.target


[Service]

Type=simple

#User=alertmanager

#Group=alertmanager

ExecStart=/usr/local/bin/olfullnode node --root /home/user/OLDATA > /home/user/OLDATA/fullnode.log &

#Restart=on-failure


[Install]

WantedBy=multi-user.target

 

          Enable the service file

 

   systemctl enable olfullnode.service

 

         start the service file and check the status

 

   sudo service olfullnode start

   sudo olfullnode status

 

    1. Run the node in background creating systemd service file:
      (Assuming "olfullnode" binary is located in $PATH /usr/local/bin. To append the fullnode log check the path where you run the fullnode.) 

cd /etc/systemd/system

vim olfullnode.service (Add below content)


[Unit]

Description=olfullnode

Wants=network-online.target

After=network-online.target


[Service]

Type=simple

#User=alertmanager

#Group=alertmanager

ExecStart=/usr/local/bin/olfullnode node --root /PATH/TO/FULLNODE > /PATH/TO/FULLNODE/fullnode.log &


#Restart=on-failure


[Install]

WantedBy=multi-user.target

 

     Enable the service file

 

sudo systemctl enable olfullnode.service

  

       start the service file and check the status

 

sudo service olfullnode start

sudo service olfullnode status

 

Tags: TECH, ALL