Create a Bitkub Chain Solo validator node.
On 17 August 2023, at block 14220246. Bitkub Chain changes consensus from POSA to PoS. This post will show you how to become a Solo validator node step by step.
Form Bitkub Chain Document If you need to become a Solo Validator node, Frist, you should have at least 10 KUB. If you do not have 10KUB, buy it from Bitkub Exchange or Choose your used exchange on the CoinMarketCap website.
Second, You need a computer connected to the Internet 24/7. On this option, you can use a variety of clouds that you experienced. From document recommended Huawei Cloud. I know Bitkub Chain is running a Node on Huawei cloud Infra.
I will use DigitalOcean to run the Solo validator node in this post. If you don’t have an account, you can create one with my Referal Link and Get free 200$ over 60 days.
Setup Computer for installed validator node
First, You need to create a droplet in the DigitalOcean control panel. Click Create > Droplets
- Choose Region. Singapore region because the Bitkub chain Have node in this Region.
2. Choose an Image. Using Ubuntu 22.04
3. Choose Cpu options. Select Regular type $48/month. I think the validator node is not Using high CPU and Memory (from my experienced)
4. Additional Storage. Choosing 1TB storage is recommended by the document
5. Set your password for these droplets.
6. Add options metrics and alerting for these droplets.
7. Set up your hostname and tag easily for searching.
Time to Coffee waiting creates a Droplet process of about 5–10 minutes.
Tips. When you create a droplet, you must create a firewall first because the DigitalOcean droplet will expose all ports of your droplet to the internet.
Goto Networking > Firewall and create a new firewall for the droplet. Allow ssh port (22), 30303/TCP, and UDP and assign it to your droplet.
Installed Validator Node
After creating droplets, you can start installing the validator node.
- Remote to your server by copying the IP address of your server from the droplets control panel and checking volume is mounted to your droplet.
# connect to your server
ssh root@157.245.xxx.xxx
# checking disk is mounted
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 63.3M 1 loop /snap/core20/1828
loop1 7:1 0 111.9M 1 loop /snap/lxd/24322
loop2 7:2 0 49.8M 1 loop /snap/snapd/18357
sda 8:0 0 1000G 0 disk /mnt/volume_sgp1_02 <<# mountpoint
2. Create a directory to store BitkubChain
# create link symbols chain to /mnt/volum..
ln -s /mnt/volume_sgp1_02/ /chains
# go in /chains directory
cd /chains
# create bkc-node mainnet
mkdir -p /chains/bkc-node/mainnet
3. Install Geth
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
4. Download chain configuration and genesis file
cd /chains/bkc-node/mainnet
#config.toml
curl https://raw.githubusercontent.com/bitkub-blockchain/bkc-node/main/mainnet/config.toml -o "config.toml"
#genesis.json
curl https://raw.githubusercontent.com/bitkub-blockchain/bkc-node/main/mainnet/genesis.json -o "genesis.json"
5. Create a password file to generate a new account on Geth
cd /chains/bkc-node/mainnet
# create password txt
echo "YOUR_ACCOUNT_PASSWORD" > pass.txt
6. Create a vaidator account
# in directory /chains/bkc-node/mainnet
geth --datadir ./data account new --password pass.txt
# output
Your new key was generated
Public address of the key: 0xaFad3ak....
Path of the secret key file: data/keystore/UTC--2023-08-16T08-28-12.790028364Z--abxxx
- You can share your public address with anyone. Others need it to interact with you.
- You must NEVER share the secret key with anyone! The key controls access to your funds!
- You must BACKUP your key file! Without the key, it's impossible to access account funds!
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!
6. Initialize a genesis file
# in directory /chains/bkc-node/mainnet
geth --datadir ./data init ./genesis.json
# output
INFO [08-16|08:30:30.754] Writing custom genesis block
INFO [08-16|08:30:30.755] Persisted trie from memory database nodes=4 size=595.00B time="102.985µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [08-16|08:30:30.755] Successfully wrote genesis state database=lightchaindata hash=8a0f3e..158071
7. *** Transfer your KUB to a public address in step 6. Checking your balance on bkcscan.com *** Waiting document to become a validator node using the StakeManager contract.
8. Testing running Validator node
# in directory /chains/bkc-node/mainnet
screen -S validator-node # create new screen for running
geth --datadir ./data --unlock 0xaFad3ak.... --mine --allow-insecure-unlock --password ./pass.txt --syncmode snap --config ./config.toml
# output
INFO [08-16|08:36:44.399] Block synchronisation started
INFO [08-16|08:36:44.400] Mining aborted due to sync
INFO [08-16|08:36:44.664] Downloader queue stats receiptTasks=0 blockTasks=799 itemSize=5.30KiB throttle=8192
INFO [08-16|08:36:44.796] Imported new chain segment blocks=3 txs=3 mgas=44.507 elapsed=132.024ms mgasps=337.109 number=20149 hash=4ebf85..f503ec age=2y3mo2w dirty=2.36MiB
INFO [08-16|08:36:51.039] Imported new chain segment blocks=109 txs=109 mgas=1725.880 elapsed=6.242s mgasps=276.494 number=20258 hash=f88161..51e5db age=2y3mo2w dirty=88.89MiB
INFO [08-16|08:36:59.076] Imported new chain segment blocks=129 txs=129 mgas=2029.968 elapsed=8.022s mgasps=253.030 number=20387 hash=73b64b..c91123 age=2y3mo2w dirty=137.80MiB
# exist screen
Ctrl+Shift+A+D
9. Checking your validator node is Running
# connect to geth process
geth attach http://:8545
# output
Welcome to the Geth JavaScript console!
instance: Geth/v2.1.0-bkc-stable-8ee54552/linux-amd64/go1.18.10
coinbase: 0xab87f23e2f26f46b636f413...
at block: 22472 (Fri May 07 2021 16:13:51 GMT+0000 (UTC))
modules: eth:1.0 net:1.0 rpc:1.0 txpool:1.0 web3:1.0
To exit, press ctrl-d or type exit
>
# get current sync blockNumber
eth.blockNumber
# output
> eth.blockNumber
33922
Time for waiting. It takes 1–2 days to complete the sync chain data.
10. Create a system service for auto-start when rebooting.
# create system file
vi /etc/systemd/system/geth.service
# get.service
[Unit]
Description=Ethereum
[Service]
Type=simple
ExecStart=/usr/bin/geth --datadir /chains/bkc-node/mainnet/data --unlock 0xaFad3ak.... --mine --allow-insecure-unlock --password /chains/bkc-node/mainnet/pass.txt --syncmode snap --config /chains/bkc-node/mainnet/config.toml
RestartSec=5s
[Install]
WantedBy=default.target
# Enable service
systemctl daemon-reload
sudo systemctl enable geth
sudo systemctl start geth
# Status service
systemctl status geth
# See log
journalctl -u geth -f
Hacking node keystore and using it in Metamask
In step 6. When you create a new account, you will get a keystore file encrypted with your pass.txt. Sometimes, you need to use that wallet in Metamask or another wallet. You can use web3-cli to export the private key of your wallet.
# install web3-cli
curl -LSs https://raw.githubusercontent.com/gochain/web3/master/install.sh | sh
# extract private key form keystore
cd /chains/bkc-node/mainnet
web3 account extract --keyfile ./data/keystore/UTC--2023-08-16T08-28-12.790028364Z--... --password "YOUR_ACCOUNT_PASSWORD"
# output
Private key: 0xb18aa....
Public address: 0xaB87F....
Now you can import a private key to Metamask and start using it.
Using Official or Delegate validator
Delegate step details on consensus system Proof-of-Stake of Bitkub Chain
In which everyone can read the details according to the topic as follows
1. Delegate: https://blogs-th.bitkubchain.com/5baa6482b306
2. Claim Reward: https://blogs-th.bitkubchain.com/4cf03abc9aab
3. Unstake: https://blogs-th.bitkubchain.com/b23ec33d705e
4. Delegate additional KUB coins: https://blogs-th.bitkubchain.com/8f1befa965a0