Script to bootstrap the syncing when a new peer/validator joins the network.
When a new peer tries to join the live network it can take days to fully synchronise, and this can take up a huge amount of disk space.
StateSync is a feature which allows a new node to receive a snapshot of the application state without downloading blocks or going through consensus. Deploying the new State Sync function on StateSync servers could help to boost the synchronizing of new peers/validators. It also reduces the disk space usage.
Bitcanna StateSync servers will include this function in mainnet.
- To sync a new peer/validator:
statesync_client_linux_new.sh
- To sync an existent peer/validator:
statesync_client_linux_backup.sh
Assuming you're not running a validator or node already:
-
Install
jq
and download the script:sudo apt install jq wget https://raw.githubusercontent.com/BitCannaGlobal/cosmos-statesync_client/main/statesync_client_linux_new.sh chmod +x statesync_client_linux_new.sh
-
Then launch the script (CTLR + C to stop it,): Carefully read the instructions displayed on your screen after you run it:
./statesync_client_linux_new.sh
At this point you can create a simple BCNA service file, or you can configure Cosmovisor, Cosmovisor works like an upgrade "supervisor" that checks and applies the correct version of the software. As a result you can setup Cosmovisor as a replacement of the bcnad daemon/command line utility and let Cosmovisor handle future upgrades.
So the next step is (one of the following)
- Skip Cosmovisor and continue with simple system service creation (step 3)
- Go to Cosmovisor guide and skip this step and following steps of this guide.
-
Move the binary to the system path:
sudo mv .bcnad /usr/local/bin/
-
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
https://github.com/BitCannaGlobal/bcna/blob/main/README.md#3Create-a-validator
Follow this instructions only if you are running currently a validator/peer.
It will reduces the disk space usage. From thousands of GB to MB maintaining your config and validator keys!
Don't start the BitCanna daemon manually, the script will do it for you and will synchronize the whole chain.
Follow the instructions at the screen when the script starts. Press CTRL + C to stop it when you see the peer synced with last block. It could takes some minutes (from 2 to 4 minutes)
If you are running a validator/peer, this script will save space in disk for you, will backup your current data and config folder and resync in several minutes.
Very important, the daemon should be turned off if is not a clean installation and
jq
tool must be installed in the system.
-
Install
jq
and download the script:sudo apt install jq wget https://raw.githubusercontent.com/BitCannaGlobal/cosmos-statesync_client/main/statesync_client_linux_with_backup.sh chmod +x statesync_client_linux_with_backup.sh
-
Then launch the script (CTLR + C to stop it):
./statesync_client_linux_with_backup.sh
-
If everything goes right, you can delete the backup folder and the backup configuration
rm -rf .old_bcna #deletes old folder to save space in hard disk rm bcna_folder_backup_* #deletes backed config; you can also save it safely
The StateSync script is experimental, run it at your own risk. Make your own backups of the configuration and do not run it before reading and understanding the contents of the script.