Comment on page
Setup Standalone Validator Node Manually
For this Demo we’ll be installing Sifnode on Ubuntu 20.04 but this can be done on most modern Linux distributions and the latest versions of Mac OS.
Before installing Sifnode, there are a few prerequisites that need to be installed. The following command will update the local package list and install any available updates:
sudo apt-get update && sudo apt upgrade -y
This next command will install essential tools and ensure accurate time synchronization:
sudo apt-get install make build-essential gcc git jq chrony -y
Cosmos SDK is built with GoLang and so we need to install Go in order to execute the sifnode app. The following website will give you the download instructions for your operating system https://go.dev/doc/install.
The current version as of the last update of this document is v1.18. We can download this version to our node by executing the following:
curl -LO https://go.dev/dl/go1.18beta1.linux-amd64.tar.gz
Once downloaded we can install to the /usr/local directory:
sudo tar -C /usr/local -xzf go1.18beta1.linux-amd64.tar.gz
Let's add Go to our path. Within the profile file (~/.profile) add the following:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
After updating the file, execute the following command so the changes can take effect:
source ~/.profile
You can test that Go is installed by executing:
go version
This command should show the version number of Go installed.
Now we are going to build Sifnode from source. First clone the Sifnode github repository by executing the following:
git clone https://github.com/Sifchain/sifnode.git
We can then compile and install a non-archive node by executing the following inside the sifnode directory:
git checkout v1.0-beta.11 && make clean install
Check that the installation was successful by executing:
sifnoded version
This should print the version number of sifnoded.
Cosmovisor is a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. The latest version of Cosmovisor is not compatible with Cosmos SDK versions older than v0.45. To install the latest version of cosmovisor, execute the following:
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest
If the latest version of Sifnode is using a version of Cosmos SDK prior to v0.45 then install version 1.0.0 of Cosmovisor using the following:
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/[email protected]
Check that the installation was successful by executing the following:
cosmovisor
This should print out some details about Cosmovisor.
First, create the required directories by executing the following commands:
mkdir -p "${HOME}"/.sifnoded/cosmovisor/genesis/bin
mkdir "${HOME}"/.sifnoded/cosmovisor/upgrades
Then copy the sifnoded binanry to the genesis/bin folder:
cp "${GOPATH}"/bin/sifnoded "${HOME}"/.sifnoded/cosmovisor/genesis/bin
Now we need to add some environment variables that Cosmovisor is dependent on. One option is to add these variables to the profile that will be running Cosmovisor. Edit the ~/.profile file and add the following:
export DAEMON_HOME="${HOME}"/.sifnoded
export DAEMON_RESTART_AFTER_UPGRADE=true
export DAEMON_ALLOW_DOWNLOAD_BINARIES=false
export DAEMON_NAME=sifnoded
export UNSAFE_SKIP_BACKUP=true
Now let's initialize the node by executing the following:
sifnoded init test-node --chain-id sifchain-1
where "test-node" is the moniker and "sichain-1" the chain id.
Go to the config director
cd "${HOME}"/.sifnoded/config
Download the latest genesis file in this directory by using the following:
wget -O genesis.json.gz https://raw.githubusercontent.com/Sifchain/networks/master/betanet/sifchain-1/genesis.json.gz
Unzip the genesis file by using the following:
gunzip genesis.json.gz
Select “Y” to overwrite the old genesis file.
Execute the following command:
sed -i "s/persistent_peers =.*/persistent_peers = \"[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656\"/g" "${HOME}"/.sifnoded/config/config.toml
Next we need to set up the external address which is the public IP address of the node. Change the <bind_ip_address> to the address of your node:
sed -i -e "s/external_address = \"\"/external_address = \"<bind_ip_address>:26656\"/g" "${HOME}"/.sifnoded/config/config.toml
Instead of syncing from Genesis we can download a current snapshot of the database to speed up the synchronization process . Let's download the current snapshot provided by one of our community members. Set the snapshot file name using the following:
snapshot=$(echo "sifchain_$(TZ=GMT date +'%Y-%m-%d').tar")
Change to the data directory:
cd "${HOME}"/.sifnoded/data
and then download the snapshot using:
wget -O sifchain.tar http://135.181.60.250:8081/sifchain/"${snapshot}"
After the file is downloaded unpack using the following:
tar -xvf sifchain.tar
Note: The download and unpacking of the snapshot will still take several hours. Just keep calm and be patient while the node syncs with the state of the chain :)
Create the following service file:
sudo nano /etc/systemd/system/cosmovisor.service
Add the following content to the file. Make sure to change the <your-user>, <path-to-cosmovisor> and <path-to-sifnoded> values:
[Unit]
Description=cosmovisor
After=network-online.target
[Service]
User=<your-user>
ExecStart=/<path-to-cosmovisor>/cosmovisor start --x-crisis-skip-assert-invariants
Restart=always
RestartSec=3
LimitNOFILE=4096
Environment="DAEMON_NAME=sifnoded"
Environment="DAEMON_HOME=/<path-to-sifnoded>/.sifnoded"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
Environment="UNSAFE_SKIP_BACKUP=true"
[Install]
WantedBy=multi-user.target
Let's try to start cosmovisor. First reload the systemctl daemon:
sudo -S systemctl daemon-reload
Then enable the Cosmovisor service:
sudo -S systemctl enable cosmovisor
We can now start Cosmovisor:
sudo systemctl start cosmovisor
We can check that the service is running by executing:
sudo systemctl status cosmovisor
In order to participate in consensus, you'll need to stake your node. Let's generate a new key:
sifnoded keys add test-node --keyring-backend file
where "test-node" is the name of your node.
NB: Please ensure that you save the mnemonic generated and the keyring password you entered somewhere secure.
Finally stake the node by executing the following, making sure to change the moniker, from and chain-id and other values as required:
sifnoded tx staking create-validator \
--commission-max-change-rate 0.1 \
--commission-max-rate 0.1 \
--commission-rate 0.1 \
--amount 100000000000000000rowan \
--pubkey $(sifnoded tendermint show-validator) \
--chain-id sifchain-1 \
--min-self-delegation "1" \
--gas 300000 \
--fees 100000000000000000rowan \
--moniker test-node \
--from test-node \
--node tcp://rpc.sifchain.finance:80 \
--keyring-backend file
Your node should now be accessible on Mintscan. You can delegate more tokens to your node using Keplr as needed.
Last modified 1yr ago