install_node

UnUniFi validator node

Official documentation:

Validator setup instructions

Explorer:

https://ununifi.io/explorer/

Requirements

Validator Node Server

  • OS: Ubuntu 20.04

  • Memory: 8 GB or more

  • Storage: SSD 160 GB or more

  • The following ports: 26656 must be open for peer to peer communication between nodes.

Install guide

Update packages

sudo apt update && sudo apt upgrade -y

Install dependencies

sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential bsdmainutils htop ncdu git jq liblz4-tool -y

Install go

ver="1.17" && \
cd $HOME && \
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" && \
sudo rm -rf /usr/local/go && \
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz" && \
rm "go$ver.linux-amd64.tar.gz" && \
echo "export GOROOT=/usr/local/go" >> ~/.bash_profile && \
echo "export GOPATH=$HOME/go" >> ~/.bash_profile && \
echo "export GO111MODULE=on" >> ~/.bash_profile && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bash_profile && \
source ~/.bash_profile && \
go version

Download and build binaries

cd $HOME
git clone https://github.com/UnUniFi/chain chain_repo  
cd chain_repo
make install

Configuration of Shell Variables

echo "export CHAIN_REPO=https://github.com/UnUniFi/chain" >> ~/.bash_profile
echo "export CHAIN_REPO_BRANCHE=main" >> ~/.bash_profile
echo "export TARGET=ununifid" >> ~/.bash_profile
echo "export TARGET_HOME=.ununifi" >> ~/.bash_profile
# This value is example of mainnet.
echo "export CHAIN_ID=ununifi-beta-v1" >> ~/.bash_profile
echo "export GENESIS_FILE_URL=https://raw.githubusercontent.com/UnUniFi/network/main/launch/ununifi-beta-v1/genesis.json" >> ~/.bash_profile
echo "export SETUP_NODE_CONFIG_ENV=TRUE" >> ~/.bash_profile
echo "export SETUP_NODE_ENV=TRUE" >> ~/.bash_profile
echo "export SETUP_NODE_MASTER=TRUE" >> ~/.bash_profile
echo "export DAEMON_NAME=\$TARGET" >> ~/.bash_profile
# This value will be different for each node.
echo "export MONIKER=<your-moniker>" >> ~/.bash_profile
echo "export DAEMON_HOME=$HOME/.ununifi" >> ~/.bash_profile
echo "export DAEMON_ALLOW_DOWNLOAD_BINARIES=true" >> ~/.bash_profile
echo "export DAEMON_LOG_BUFFER_SIZE=512" >> ~/.bash_profile
echo "export DAEMON_RESTART_AFTER_UPGRADE=true" >> ~/.bash_profile
echo "export UNSAFE_SKIP_BACKUP=true" >> ~/.bash_profile
echo "export peers=\"fa38d2a851de43d34d9602956cd907eb3942ae89@a.ununifi.cauchye.net:26656,404ea79bd31b1734caacced7a057d78ae5b60348@b.ununifi.cauchye.net:26656,1357ac5cd92b215b05253b25d78cf485dd899d55@[2600:1f1c:534:8f02:7bf:6b31:3702:2265]:26656,25006d6b85daeac2234bcb94dafaa73861b43ee3@[2600:1f1c:534:8f02:a407:b1c6:e8f5:94b]:26656,caf792ed396dd7e737574a030ae8eabe19ecdf5c@[2600:1f1c:534:8f02:b0a4:dbf6:e50b:d64e]:26656,796c62bb2af411c140cf24ddc409dff76d9d61cf@[2600:1f1c:534:8f02:ca0e:14e9:8e60:989e]:26656,cea8d05b6e01188cf6481c55b7d1bc2f31de0eed@[2600:1f1c:534:8f02:ba43:1f69:e23a:df6b]:26656\"" >> ~/.bash_profile
source ~/.bash_profile

Init app

ununifid init "$MONIKER" --chain-id $CHAIN_ID

Download genesis

rm ~/.ununifi/config/genesis.json
curl -L https://raw.githubusercontent.com/UnUniFi/network/main/launch/ununifi-beta-v1/genesis.json -o ~/.ununifi/config/genesis.json

Config app

Setup seeds and peers

seeds=""
sed -i "s/^seeds *=.*/seeds = \"$seeds\"/;" $HOME/.quicksilverd/config/config.toml
peers=""
sed -i "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/;" $HOME/.ununifi/config/config.toml

Config pruning

pruning="custom" && \
pruning_keep_recent="100" && \
pruning_keep_every="0" && \
pruning_interval="50" && \
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.ununifi/config/app.toml && \
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.ununifi/config/app.toml && \
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.ununifi/config/app.toml && \
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.ununifi/config/app.toml

Set min gas price

sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.0025uguu\"/" $HOME/.ununifi/config/app.toml

Enable/Disable snapshot (optional)

snapshot_interval="1000" && \
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$snapshot_interval\"/" ~/.ununifi/config/app.toml

Enable prometheus (optional)

sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.ununifi/config/config.toml

Reset chain data

ununifid unsafe-reset-all --home $HOME/.ununifi
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0

Set up folder structure

mkdir -p $DAEMON_HOME/cosmovisor
mkdir -p $DAEMON_HOME/cosmovisor/genesis
mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin
mkdir -p $DAEMON_HOME/cosmovisor/upgrades

Set up genesis binary

cp ~/go/bin/$DAEMON_NAME $DAEMON_HOME/cosmovisor/genesis/bin

Create service

sudo tee /lib/systemd/system/cosmovisor.service > /dev/null <<EOF
[Unit]
Description=Cosmovisor daemon
After=network-online.target
[Service]
Environment="DAEMON_NAME=ununifid"
Environment="DAEMON_HOME=$HOME/.ununifi"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
Environment="UNSAFE_SKIP_BACKUP=true"
User=$USER
ExecStart=$HOME/go/bin/cosmovisor start
Restart=always
RestartSec=3
LimitNOFILE=infinity
LimitNPROC=infinity
[Install]
WantedBy=multi-user.target
EOF

Register and start service

sudo systemctl daemon-reload && \
sudo systemctl restart systemd-journald && \
sudo systemctl enable cosmovisor && \
sudo systemctl start cosmovisor && sudo journalctl -u cosmovisor -f -o cat

Check synchronization status ("catching_up": false is synced)

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

Create wallet (!Safe your mnemonic)

ununifid keys add <wallet_name>

To recover your wallet using seed phrase (optional)

ununifid keys add <wallet_name> --recover

Check balance

ununifid query bank balances <wallet_address>

Create validator

ununifid tx staking create-validator \
  --amount 1000000uguu \
  --commission-max-change-rate "0.1" \
  --commission-max-rate "0.20" \
  --commission-rate "0.1" \
  --min-self-delegation "1" \
  --details "validators write bios too" \
  --pubkey=$(ununifid tendermint show-validator) \
  --moniker "$MONIKER" \
  --chain-id $CHAIN_ID \
  --gas-prices 0.025uguu \
  --from <wallet_name>

Show address validator

ununifid  keys show <wallet_name> --bech val -a

Check validator status

ununifid  query staking validator <valoper_address>

Usefull command

Synchronization info

ununifid status 2>&1 | jq .SyncInfo

Node info

ununifid status 2>&1 | jq .NodeInfo

Show node id

ununifid tendermint show-node-id

Get wallet balance

ununifid query bank balances <wallet_name>

Transfer funds

ununifid tx bank send <wallet_address> <to_wallet_address> 10000000uguu

Voting

ununifid tx gov vote 1 yes --from <wallet_name> --chain-id=$CHAIN_ID

Delegate stake

ununifid tx staking delegate <valoper_address> 10000000uguu --from=<wallet_name> --chain-id=$CHAIN_ID --gas-prices 0.025uguu

Withdraw all rewards

ununifid tx distribution withdraw-all-rewards --from=<wallet_name> --chain-id=$CHAIN_ID --gas-prices 0.025uguu

Withdraw rewards with commision

ununifid tx distribution withdraw-rewards <valoper_address> --from=<wallet_name> --commission --chain-id $CHAIN_ID --gas-prices 0.025uguu

Edit validator

ununifid tx staking edit-validator \
--moniker "$MONIKER" \
--identity=<identity> \
--website=<web> \
--details=<any details> \
--chain-id $CHAIN_ID \
--from=<wallet_name> \
--gas-prices 0.025uguu

Unjail validator

ununifid tx slashing unjail \
  --broadcast-mode=block \
  --from=<wallet_name> \
  --chain-id $CHAIN_ID \
  --gas-prices 0.025uguu

Delete node

sudo systemctl stop cosmovisor
sudo systemctl disable cosmovisor
sudo rm /lib/systemd/system/cosmovisor* -rf
sudo rm $(which cosmovisor) -rf
sudo rm $HOME/.ununifi* -rf
sudo rm $HOME/chain_repo -rf

Last updated