Run Validator Node

Fresh setup from 0

Prerequisite

The quickest way to learn about KUB is to run a node and interact with the network.

In this tutorial, we will:

  • Install and run a Validator node.

Infrastructure Requirement:

1. Linux Instance

  • OS - Ubuntu 20.04 LTS or higher version

2. Specifications

Minimum:

CPU 4Core
Ram 16GB
Disk 512GB
Network: more than 5 MB/s

Suggested:

CPU 8Core
Ram 32GB
Disk SSD 512GB 8k IOPS, 250 MB/S throughput, read latency <1ms
Network: 50 MB/s at least

Allow Inbound and Outbound

  • Protocol - TCP & UDP

  • Port - 30303

  • Source IP - 0.0.0.0/0

Installation Steps

Create directory and Download Geth

# Create directory
$ mkdir -p /bkc-node/mainnet

# Download Geth
$ sudo curl -L https://bkc-storage.obs.ap-southeast-2.myhuaweicloud.com/geth/v2.1.0/geth-linux-amd64-go1-18-10 -o /usr/bin/geth
$ sudo chmod +x /usr/bin/geth

Check geth version

geth version

The result after running commands

Geth
Version: 2.1.0-bkc-stable
Git Commit: 8ee545524b9411c306ebb62bcbfa4536264e20c2
Git Commit Date: 20230802
...

Download chain configuration and genesis file

# config.toml
$ sudo curl https://raw.githubusercontent.com/bitkub-chain/bkc-node/v2.1.0/mainnet/config.toml --create-dirs -o "/bkc-node/mainnet/config.toml"

# genesis.json
$ sudo curl https://raw.githubusercontent.com/bitkub-chain/bkc-node/v2.1.0/mainnet/genesis.json --create-dirs -o "/bkc-node/mainnet/genesis.json"

Generating a validator account

# Generate account password
$ echo "<<YourPassword>>" > ./bkc-node/mainnet/data/password.sec

# Generate new account
$ ./geth account new  --datadir ./bkc-node/mainnet/data --password ./bkc-node/mainnet/data/password.sec

# Run
$ ./geth --datadir ./bkc-node/mainnet/data --config ./config.toml \
  --syncmode snap \
  --password ./bkc-node/mainnet/data/password.sec \
  --mine --unlock 0x<<YourAccountAddress>> \
  --allow-insecure-unlock

Initialize a genesis file

# Mainnet
geth --datadir /bkc-node/mainnet/data init /bkc-node/mainnet/genesis.json

Create system service/unit file

sudo nano /etc/systemd/system/geth.service

Furthermore, copy and paste the code below

geth.service
[Unit]
Description=BKC ValidatorNode
After=network.target auditd.service
Wants=network.target

[Service]
Type=simple
ExecStart=/usr/bin/geth --datadir <DIRECTORY_LOCATION> \
    --config <CONFIG_FILE> --syncmode snap \
    --unlock <ADDRESS> --mine --allow-insecure-unlock --password <PASSWORD_FILE> 
KillMode=process
KillSignal=SIGINT
Restart=on-failure
RestartSec=5s
TimeoutStopSec=60

[Install]
WantedBy=default.target 
RequiredBy=swarm.service
Alias=geth.service

Enable and start the service

sudo systemctl daemon-reload
sudo systemctl enable geth
sudo systemctl start geth

Next Step: Validator Staking

After you have successfully installed your node configuration on your system. Proceed to the validator staking.

Last updated

Was this helpful?