sudo apt update
sudo apt install curl iptables build-essential git wget jq make gcc nano tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev lz4 -y
cd $HOME && \
ver="1.22.6" && \
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 PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
go version
echo "export WALLET='wallet'" >> $HOME/.bash_profile
echo "export MONIKER='validator'" >> $HOME/.bash_profile
echo "export PORT_UNION='26'" >> $HOME/.bash_profile
source $HOME/.bash_profile
cd $HOME
wget -O uniond https://download.dteam.tech/union/testnet/binary
chmod +x uniond
mv uniond $HOME/go/bin
uniond version
uniond init "validator" --chain-id union-testnet-9
uniond config set client chain-id union-testnet-9
uniond config set client keyring-backend os
uniond config set client node tcp://localhost:${PORT_UNION}657
wget -O $HOME/.union/config/genesis.json https://download.dteam.tech/union/testnet/genesis
wget -O $HOME/.union/config/addrbook.json https://download.dteam.tech/union/testnet/addrbook
SEEDS="f95dc5e6216324bdc0d19e9495a10a932eac895b@seed.union.testnet.dteam.tech:49656"
PEERS="5f593c985f3a136e4078bad0d23ed1e9b72c9d00@peer.union.testnet.dteam.tech:26656,[email protected]:24656,[email protected]:24656,[email protected]:24656,[email protected]:24656,[email protected]:24656,[email protected]:26656,[email protected]:24656,[email protected]:24656,[email protected]:19756"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.union/config/config.toml
sed -i.bak -e "s%:1317%:${PORT_UNION}317%g;
s%:8080%:${PORT_UNION}080%g;
s%:9090%:${PORT_UNION}090%g;
s%:9091%:${PORT_UNION}091%g;
s%:8545%:${PORT_UNION}545%g;
s%:8546%:${PORT_UNION}546%g;
s%:6065%:${PORT_UNION}065%g" $HOME/.union/config/app.toml
sed -i.bak -e "s%:26658%:${PORT_UNION}658%g;
s%:26657%:${PORT_UNION}657%g;
s%:6060%:${PORT_UNION}060%g;
s%:26656%:${PORT_UNION}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${PORT_UNION}656\"%;
s%:26660%:${PORT_UNION}660%g" $HOME/.union/config/config.toml
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.union/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.union/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"20\"/" $HOME/.union/config/app.toml
INDEXER="null"
sed -i -e "s/^indexer *=.*/indexer = \"$INDEXER\"/" $HOME/.union/config/config.toml
SNAPSHOT_INTERVAL=0
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$SNAPSHOT_INTERVAL\"/" ~/.union/config/app.toml
sudo tee /etc/systemd/system/uniond.service > /dev/null <<EOF
[Unit]
Description=union testnet node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.union
ExecStart=$(which uniond) start
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
uniond tendermint unsafe-reset-all --home $HOME/.union
curl https://download.dteam.tech/union/testnet/pruned/latest-snapshot | lz4 -dc - | tar -xf - -C $HOME/.union
sudo systemctl daemon-reload
sudo systemctl enable uniond
sudo systemctl restart uniond
sudo journalctl -u uniond -f -o cat