BitCanna — node setup

Only 50 people got into the validators, and I am one of them. In connection with this, I decided to write detailed instructions for installing the node.

First you need a server. I recommend renting a VPS server, as it will provide you with 24/7 work. However, no one forbids you to configure a node on your computer.

  1. System requirements
    We need a server with the following characteristics:
    4 CPU
    8 GB RAM
    80 SSD
    I started the server at https://www.hetzner.com/

2. Installation

2.1. Firstly, you should prepare your server and make some updates, as shown bellow:

sudo apt-get updatesudo apt-get upgrade -ysudo apt-get install -y build-essential curl wget jq

Then, you should increase the default open files limit:

sudo su -c "echo 'fs.file-max = 65536' >> /etc/sysctl.conf"sudo sysctl -p

Now you have a two options, how to run a validator: to use binaries or compile source code by yourself.
I used the binaries for this time with following commands:

cd $HOMEwget https://github.com/BitCannaGlobal/testnet-bcna-cosmos/releases/download/v0.testnet6/bcnadchmod +x bcnadsudo mv bcnad /usr/local/bin/

After that you can check that you have correct version of bcnad, as bellow:

bcnad version

gives me output:

2.2. Then you should set up the connection with TestNet Blockchain. But firstly, it is neccessary to created a wallet. You should use the following command, but don’t forget to change <yourAddress> to your address name, what you will use in future.

bcnad keys add <yourAddress>

Now you can see your data, I created a test address:

2.3. Next, you should initialize the folders, with this command. And don’t forget to change <Moniker> with your desired moniker.

bcnad init <Moniker> --chain-id bitcanna-testnet-2

2.4. Then, with the following commands, you should download the genesis.json file.

cd $HOMEwget https://raw.githubusercontent.com/BitCannaGlobal/testnet-bcna-cosmos/main/instructions/stage1/genesis.json mv genesis.json $HOME/.bcna/config/

2.5. Added some things to config.toml
server SEEDs

sed -E -i 's/seeds = \".*\"/seeds = \"d6aa4c9f3ccecb0cc52109a95962b4618d69dd3f@seed1.bitcanna.io:26656,41d373d03f93a3dc883ba4c1b9b7a781ead53d76@seed2.bitcanna.io:16656\"/' $HOME/.bcna/config/config.toml

persistent peers

sed -E -i 's/persistent_peers = \".*\"/persistent_peers = \"d6aa4c9f3ccecb0cc52109a95962b4618d69dd3f@seed1.bitcanna.io:26656,41d373d03f93a3dc883ba4c1b9b7a781ead53d76@seed2.bitcanna.io:16656\"/' $HOME/.bcna/config/config.toml

2.6. Also you should set minimum gas prices for transaction, I used the same example, that in the guide.

sed -E -i 's/minimum-gas-prices = \".*\"/minimum-gas-prices = \"0.01ubcna\"/' $HOME/.bcna/config/app.toml

2.7. For successful connection you should configure the port 26656 with the following command.

sudo ufw allow 26656

Rules should be updated as shown bellow:

2.8. Finally, you are ready to test the connection to your node.

bcnad start --log_level info

If you see something like this, then connection is successful:

2.9. Before next steps, you should the state of sync. You can check it in three ways: (screenshots)
1)Gives us in output true if sync in progress and false if sync is finished;

curl -s localhost:26657/status  | jq .result.sync_info.catching_up

2)Gives us the last block that is synced by our node;

curl -s localhost:26657/status | jq .result.sync_info.latest_block_height

3)Gives the current block high of blockchain.

curl -s "http://seed1.bitcanna.io:26657/status?"  | jq .result.sync_info.latest_block_height

2.10. Now you should create a service that will be responsible for running a node. Just put the following code in console and press ENTER:

cd $HOME
echo "[Unit]
Description=BitCanna Node
After=network-online.target
[Service]
User=${USER}
ExecStart=$(which bcnad) start
Restart=always
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
" >bcnad.service

When service ready, you can enable and activate it:

sudo mv bcnad.service /lib/systemd/system/sudo systemctl enable bcnad.service && sudo systemctl start bcnad.service

You check that everything is running good, by checking logs with this command:

sudo journalctl -u bcnad -f

3. Setting up a validator

Firstly, you should receive test tokens. Replace your_address with your address and ask for test tokens is Discord channel:

!claim your_address

To create a validator you should create a transaction with following parameters: (don’t forget to replace WALLET and MONIKER on yours)

bcnad tx staking create-validator \
--amount 1000000ubcna \
--commission-max-change-rate 0.10 \
--commission-max-rate 0.2 \
--commission-rate 0.1 \
--from WALLET \
--min-self-delegation 1 \
--moniker MONIKER \
--pubkey $(bcnad tendermint show-validator) \
--chain-id bitcanna-testnet-2 \
--gas auto \
--gas-adjustment 1.5 \
--gas-prices 0.01ubcna

Now you can find yourself in active validators in Testnet Explorer (screenshot)

To view active validators in console, you can use the follwing command:

bcnad query staking validators --output json| jq

4. Validator backup

It would be nice to create validator backup key with theese commands:

tar -czvf validator_key.tar.gz .bcna/config/*_key.json gpg -o validator_key.tar.gz.gpg -ca validator_key.tar.gzrm validator_key.tar.gz

5. Prometheus installation

To make your node visible by prometheus, you should make following things:

5.1. Configure config.toml with following command:

nano $HOME/.bcna/config/config.toml

In the end of file you should change Instrumentation Configuration Options on the following and save it using CTRL+X,Y, ENTER:

#######################################################
### Instrumentation Configuration Options ###
#######################################################
[instrumentation]

# When true, Prometheus metrics are served under /metrics on
# PrometheusListenAddr.
# Check out the documentation for the list of available metrics.
prometheus = true

# Address to listen for Prometheus collector(s) connections
prometheus_listen_addr = "0.0.0.0:26660"

# Maximum number of simultaneous connections.
# If you want to accept a larger number than the default, make sure
# you increase your OS limits.
# 0 - unlimited.
max_open_connections = 3

# Instrumentation namespace
namespace = "tendermint"

To make things work, please type:

sudo service bcnad restart

5.2. Configure firewall:

sudo ufw allow from 167.172.43.16 proto tcp to any port 26660

6. Final

If you did everything correctly, you should see yourself among the validators. https://testnet-explorer.bitcanna.io/validators

Also your node is ready for prometheus monitoring.

***************************************
Official guide for configuring a node — link
Validator List — link
Project site — link

Regards Alex (Telegram: @oxess, Discord: oxes#8647)

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Introducing Bundle — Social Payments for Cash and Crypto

Preventing Dependency Conflicts in Python

Object Oriented Programming Explained with Memes

Reading Windows Sticky Notes

Tesseract Library and Image Processing to Detect Texts

Testing the Waters of AWS EC2 C5D Instances

Methodologies & Frameworks, WHY?

Printed sticky notes glued on a board.

A Simple Guide to a Single Moving Average Cross Strategy in Python.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
oxes

oxes

More from Medium

“Simple Products that became big Companies”

Altercation between Russia and NATO vindicates Realism Theory of international relations

Altercation between Russia and NATO vindicates Realism Theory of international relations

💯OFFICIAL CONTRACT META PLANE AND PINKSALE LINK💯

Weekly picks by Ali Alohali — مختارات اسبوعيه بواسطة علي العوهلي — Issue #15