IMPORTANT NOTE: You can sync a node almost instantly and automatically using our StateSync script
bcnad is a blockchain application built using Cosmos SDK v.0.44.2 and Tendermint v.0.34.13.
You can run the validator software using the binary or compiling it by yourself, you can choose between Step 0a or Step 0b and continue at Step 1.
-
Before you start, you might want to ensure your system is up to date. Besides, you can install a utility named
jq
to read and navigate in JSON files and outputs.sudo apt-get update sudo apt-get upgrade -y sudo apt-get install -y build-essential curl wget jq
-
Increasing the default open files limit. If we don't raise this value, nodes will crash once the network grows large enough.
sudo su -c "echo 'fs.file-max = 65536' >> /etc/sysctl.conf" sudo sysctl -p
By downloading the binary we avoid compiling the source code.
- Download the latest version (v1.2) from Github:
cd $HOME wget https://github.com/BitCannaGlobal/bcna/releases/download/v1.2/bcnad chmod +x bcnad sudo mv bcnad /usr/local/bin/
- Check for the right version (1.2):
bcnad version >>> response: 1.2
NOTE: If you have downloaded the binary avoid Step 0B and go to Step 1
The updated instructions are always in our GitHub Readme page, click on this link to go there.
Instructions for setting up the connection with the BitCanna MainNet Blockchain
- Set the chain-id parameter
bcnad config chain-id bitcanna-1
- Create a wallet:
You may create a wallet with one or more keys (addresses) using
bcnad
; you can choose a name of your own liking (we strongly advice you use one word)
bcnad keys add MyFirstAddress
name: MyFirstAddress
type: local
address: bcna14shzreglay98us0hep44hhhuy7dm43snv38plr
pubkey: bcnapub1addwnpepqvtpzyugupvcu773rzdcvhele6e22txy2zr235dn7uf8t2mlqcarcyx2gg9
mnemonic: ""
threshold: 0
pubkeys: []
Important write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.
deposit daring slim glide spend dolphin expire shadow cluster vivid orphan work pond section client friend yellow west hamster torch settle island opinion gloom
Your address will look something similar like this: bcna14shzreglay98us0hep44hhhuy7dm43snv38plr
-
Initialize the folders: change Moniker by your validator name (use quotes for two or more separated words "Royal Queen Seeds")
bcnad init Moniker --chain-id bitcanna-1
This will create a
$HOME/.bcna
folder -
Download the Genesis
genesis.json
filecd $HOME curl -s https://raw.githubusercontent.com/BitCannaGlobal/bcna/main/genesis.json > ~/.bcna/config/genesis.json
Ensure you have the correct file. Run the SHA256SUM test:
sha256sum $HOME/.bcna/config/genesis.json <output> cd7449a199e71c400778f894abb00874badda572ac5443b7ec48bb0aad052f29
-
Add to config.toml file: server SEEDs:
sed -E -i 's/seeds = \".*\"/seeds = \"d6aa4c9f3ccecb0cc52109a95962b4618d69dd3f@seed1.bitcanna.io:26656,23671067d0fd40aec523290585c7d8e91034a771@seed2.bitcanna.io:26656\"/' $HOME/.bcna/config/config.toml
-
You can set the minimum gas prices for transactions to be accepted into your node’s mempool. This sets a lower bound on gas prices, preventing spam.
sed -E -i 's/minimum-gas-prices = \".*\"/minimum-gas-prices = \"0.001ubcna\"/' $HOME/.bcna/config/app.toml
-
Open the P2P port (26656 by default)
sudo ufw allow 26656
-
Test the connection (CTRL + C to stop)
bcnad start --log_level info
3:31PM INF Committed state appHash=77D16BED3F109A4A05A971C92602029569E049DFC1DC128CFF5CCAE3158F4B1B height=3886 module=state txs=0 3:31PM INF Indexed block height=3886 module=txindex 3:31PM INF minted coins from module account amount=1034628bcna from=mint module=x/bank 3:31PM INF Executed block height=3887 invalidTxs=0 module=state validTxs=0 3:31PM INF commit synced commit=436F6D6D697449447B5B38332031333820373720313731203135362032333220313431203435203137332037372031352031363020373120393720393520352031393020313836203733203131342034322031313620313230203536203338203230203337203437203231392032353220343920385D3A4632467D 3:31PM INF Committed state appHash=538A4DAB9CE88D2DAD4D0FA047615F05BEBA49722A7478382614252FDBFC3108 height=3887 module=state txs=0
-
Service creation Ensure that you stopped the previous test with CTRL+C. With all configurations ready, you can start your blockchain node with a single command (
bcnad start
). In this tutorial, however, you will find a simple way to set upsystemd
to run the node daemon with auto-restart.
Setup bcnad
systemd service (copy and paste all to create the file service):
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
Enable and activate the BCNAD service.
sudo mv bcnad.service /lib/systemd/system/
sudo systemctl enable bcnad.service && sudo systemctl start bcnad.service
Check the logs to see if it is working:
sudo journalctl -u bcnad -f
- Check the synchronisation: If
catching_up = true
the node is syncing. Also you can compare your current block with the last synced block of another node, or at our Explorer:curl -s localhost:26657/status | jq .result.sync_info.catching_up #true output is syncing - false is synced curl -s localhost:26657/status | jq .result.sync_info.latest_block_height #this output is your last block synced curl -s "http://seed1.bitcanna.io:26657/status?" | jq .result.sync_info.latest_block_height #this output the public node last block synced
To become a validator you need to perform additional steps. Your node must be fully synced in order to send the TX of validator creation and start to validate the network. You can check if your node has fully synced by comparing your logs and the latest block in the explorer (https://cosmos-explorer.bitcanna.io/)
- You will need coins: Send coins to your new address, you will need roughly 2 BCNA to run the validator (1 BCNA for self-delegation and a bit more for transactions).
- Send the Create validator TX:
We recommend to read the FAQ manual to understand all parameters: https://hackmd.io/_R2KtQzAS02QXdwpJdqmnw?view
When you have your node synced and your wallet funded with coins, send the TX to become validator (change wallet_name and moniker):
You can use quotes to include spaces and more than two words
--from "Royal Queen Seeds"
bcnad tx staking create-validator \
--amount 1000000ubcna \
--commission-max-change-rate 0.10 \
--commission-max-rate 0.2 \
--commission-rate 0.1 \
--from WALLET_NAME \
--min-self-delegation 1 \
--moniker YOUR_MONIKER \
--pubkey $(bcnad tendermint show-validator) \
--chain-id bitcanna-1 \
--gas auto \
--gas-adjustment 1.5 \
--gas-prices 0.001ubcna
You can check the list of validators (also in Explorer):
bcnad query staking validators --output json| jq
-
Another IMPORTANT but optional action is backup your Validator_priv_key:
tar -czvf validator_key.tar.gz .bcna/config/*_key.json gpg -o validator_key.tar.gz.gpg -ca validator_key.tar.gz rm validator_key.tar.gz
This will create a GPG encrypted file with both key files.