Skip to main content

Union

Endpoints

APIRPC
https://union-testnet-api.kgnodes.xyzhttps://union-testnet-rpc.kgnodes.xyz

Explorer: explorer.kgnodes.xyz/union-testnet-9

Installation

Update OS

sudo apt update && sudo apt upgrade -y

Installation of required packages

sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y

Installation of go (if you need)

cd ~
VER="1.21.6" # Make sure that this version does not broke any other apps you run!
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"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin

Setting up environment variables

echo "export UNION_PORT="18"" >> $HOME/.bash_profile
source $HOME/.bash_profile

Downloading and installing node

mkdir -p $HOME/.union/cosmovisor/genesis/bin
wget -O $HOME/.union/cosmovisor/genesis/bin/uniond https://snapshot.kgnodes.xyz/snapshot/union/uniond
chmod +x $HOME/.union/cosmovisor/genesis/bin/uniond

ln -s $HOME/.union/cosmovisor/genesis $HOME/.union/cosmovisor/current -f
sudo ln -s $HOME/.union/cosmovisor/current/bin/uniond /usr/local/bin/uniond -f

Initializing the node

alias uniond='uniond --home=$HOME/.union/'

uniond config set client chain-id union-testnet-9
uniond config set client keyring-backend test
uniond config set client node tcp://localhost:18157

uniond init $MONIKER --chain-id union-testnet-9 --home=$HOME/.union

Downloading genesis and addressbook

cd $HOME
wget -O $HOME/.union/config/addrbook.json https://snapshot.kgnodes.xyz/snapshot/union/addrbook.json
wget -O $HOME/.union/config/genesis.json https://snapshot.kgnodes.xyz/snapshot/union/genesis.json

Setting seeds and peers

SEEDS=""
PEERS="[email protected]:26656,[email protected]:24656,[email protected]:31324,[email protected]:24656,[email protected]:24656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:17656,[email protected]:10656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.union/config/config.toml

Setting custom ports

Updating ports in app.toml

sed -i.bak -e "s%:1317%:${UNION_PORT}317%g;
s%:8080%:${UNION_PORT}080%g;
s%:9090%:${UNION_PORT}090%g;
s%:9091%:${UNION_PORT}091%g;
s%:8545%:${UNION_PORT}545%g;
s%:8546%:${UNION_PORT}546%g;
s%:6065%:${UNION_PORT}065%g" $HOME/.union/config/app.toml

Updating ports in config.toml

sed -i.bak -e "s%:26658%:${UNION_PORT}658%g;
s%:26657%:${UNION_PORT}657%g;
s%:6060%:${UNION_PORT}060%g;
s%:26656%:${UNION_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${UNION_PORT}656\"%;
s%:26660%:${UNION_PORT}660%g" $HOME/.union/config/config.toml

Configuring pruning and indexer settings

sed -i \
-e 's|^pruning *=.*|pruning = "custom"|' \
-e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \
-e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
-e 's|^pruning-interval *=.*|pruning-interval = "10"|' \
$HOME/.union/config/app.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.union/config/config.toml

Setting gas and other configurations

sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0muno\"|" $HOME/.union/config/app.toml

Creating service file


sudo tee /etc/systemd/system/union-testnet.service > /dev/null << EOF
[Unit]
Description=union node service
After=network-online.target

[Service]
User=$USER
ExecStart=$(which cosmovisor) run start --home=$HOME/.union
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.union"
Environment="DAEMON_NAME=uniond"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.union/cosmovisor/current/bin"

[Install]
WantedBy=multi-user.target
EOF

Enabling and starting the service.

# You need to inspect logs visually after the  to make sure that it is working
sudo systemctl daemon-reload
sudo systemctl enable union-testnet.service

Snapshot

Make sure to back up your priv_validator_key.json file if you've already created a validator! Resetting your node without a backup will cause you to lose access and require creating a new validator from scratch. Be careful!

The following snippets create a copy of your priv_validator_state.json and priv_validator_key.json files. Then, it copies the old private files back after copying the snapshot files. However, you should execute these commands with caution to prevent any kind of failure!

sudo systemctl stop union-testnet.service

cp $HOME/.union/data/priv_validator_state.json $HOME/.union/priv_validator_state.json.backup

uniond tendermint unsafe-reset-all --home $HOME/.union --keep-addr-book
curl https://snapshot.kgnodes.xyz/snapshot/union/snap_union.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.union


mv $HOME/.union/priv_validator_state.json.backup $HOME/.union/data/priv_validator_state.json

sudo systemctl restart union-testnet.service
sudo journalctl -u union-testnet.service -f --no-hostname -o cat

## Creating a wallet

You need to create or import a wallet to request test tokens. If you dont have any tokens, you will not be able to create a validator.

```bash

Add new wallet
uniond keys add wallet

Recover wallet
uniond keys add wallet --recover

List all keys
uniond keys list

Creating a validator

cd $HOME

# Learn your pubkey
uniond comet show-validator

# Create validator.json file
cat << EOF > ~/.union/config/validator.json
{
"pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"BCDw/cq+7VxwNU/UIDc08JaYXru0Wa8SPoamzYSHfY8="},
"amount": "1000000muno",
"moniker": "",
"identity": "",
"website": "",
"security": "",
"details": "",
"commission-rate": "0.1",
"commission-max-rate": "0.2",
"commission-max-change-rate": "0.01",
"min-self-delegation": "1"
}
EOF

Next Steps:

Once you're satisfied with the contents of validator.json, you can proceed with creating the validator using the information stored within the file.

# Create a validator using the JSON configuration
junctiond tx staking create-validator validator.json \
--from $WALLET \
--chain-id $AIRCHAINS_CHAIN_ID \
--fees 200amf

Delegate to yourself

You might need to update number of tokens before executing the following command.

junctiond tx staking delegate \
$(junctiond keys show $WALLET --bech val -a) 1900000amf \
--from $WALLET \
--chain-id $AIRCHAINS_CHAIN_ID \
--fees=5000amf

Deleting the node completely (if you need)

Make sure that you backed up any required files to setup later! Do not lost your validator or wallet!

cd $HOME
sudo systemctl stop union-testnet.service
sudo systemctl disable union-testnet.service
sudo rm /etc/systemd/system/union-testnet.service
sudo systemctl daemon-reload
rm -f $(which uniond)
rm -rf $HOME/.union