Script to bootstrap the syncing when a new peer/validator join to BitCanna-Cosmos.
When a new peer tries to join a running chain it can take days to fully synchronise and this can take up a huge amount of disk space.
StateSync is a feature which would allow 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.
- For to sync a new peer/validator:
statesync_client_linux_new.sh
- For to sync an existent peer/validator:
statesync_client_linux_existing.sh
We asume you are not running a validator or simple node so far.
-
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,): Read carefully the instructions displayed at screen when you run it:
./statesync_client_linux_new.sh
-
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!
Follow the instructions at the screen when the script starts. Be patient, StateSync need some minutes (2 to 4) to fetch the good state. Press CTRL + C to stop it when you see the peer synced with last block.
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, daemon should 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_existing.sh chmod +x statesync_client_linux_existing.sh
-
Clean the data folder to ensure a fresh resync and a new Address book.
- Cosmovisor
cosmovisor run unsafe-reset-all
- Bcnad daemon
bcnad unsafe-reset-all
-
Then launch the script to get the StateSync data:
./statesync_client_linux_existing.sh
-
Follow the instructions of the script, as recap:
a) Replace the settings in `config.toml` b) Run the daemon until is synced. Stop it. c) Restore your previous settings at `config.toml` d) Start again the daemon
This script is experimental, StateSync 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.