From aee8eeaf5ad8dd18a801010891027bea83ce10d6 Mon Sep 17 00:00:00 2001 From: STAVR <77785195+111STAVR111@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:39:32 +0300 Subject: [PATCH] Add files via upload --- Union/uniont | 191 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 Union/uniont diff --git a/Union/uniont b/Union/uniont new file mode 100644 index 00000000..fea28052 --- /dev/null +++ b/Union/uniont @@ -0,0 +1,191 @@ +#!/bin/bash + +while true +do + +# Logo + +curl -s https://raw.githubusercontent.com/111STAVR111/props/main/logo_1.txt | bash + +# Menu + +PS3='Select an action: ' +options=( +"Install Node" +"Create wallet" +"Check node logs" +"Synchronization via StateSync" +"Synchronization via SnapShot" +"UPDATE" +"Delete Node" +"Exit") +select opt in "${options[@]}" +do +case $opt in + +"Install Node") +echo "*********************" +echo -e "\e[1m\e[35m Lets's begin\e[0m" +echo "*********************" +echo -e "\e[1m\e[32m Enter your Validator_Name:\e[0m" +echo "_|-_|-_|-_|-_|-_|-_|" +read Validator_Name +echo "_|-_|-_|-_|-_|-_|-_|" +echo export Validator_Name=${Validator_Name} >> $HOME/.bash_profile +echo export CHAIN_ID="union-testnet-8" >> $HOME/.bash_profile +source ~/.bash_profile + +echo -e "\e[1m\e[32m1. Updating packages and dependencies--> \e[0m" && sleep 1 +#UPDATE APT +sudo apt update && sudo apt upgrade -y +sudo apt install curl tar wget clang pkg-config libssl-dev libleveldb-dev jq build-essential bsdmainutils git make ncdu htop screen unzip bc fail2ban htop -y + +echo -e " \e[1m\e[32m2. Installing GO--> \e[0m" && sleep 1 +#INSTALL GO +ver="1.20.5" +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 -e " \e[1m\e[32m3. Downloading and building binaries--> \e[0m" && sleep 1 +#INSTALL +cd $HOME && mkdir -p go/bin/ +wget https://uniont.binary.stavr.tech/union/uniond +chmod +x uniond +mv uniond $HOME/go/bin/ + +uniond init $Validator_Name --chain-id $CHAIN_ID + +wget -O $HOME/.union/config/genesis.json "https://raw.githubusercontent.com/111STAVR111/props/main/Union/genesis.json" +wget -O $HOME/.union/config/addrbook.json "https://raw.githubusercontent.com/111STAVR111/props/main/Union/addrbook.json" + +echo -e " \e[1m\e[32m4. Node optimization and improvement--> \e[0m" && sleep 1 + +sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.0muno\"/;" ~/.union/config/app.toml +external_address=$(wget -qO- eth0.me) +sed -i.bak -e "s/^external_address *=.*/external_address = \"$external_address:26656\"/" $HOME/.union/config/config.toml +peers="" +sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.union/config/config.toml +seeds="" +sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.union/config/config.toml +sed -i 's/max_num_inbound_peers =.*/max_num_inbound_peers = 50/g' $HOME/.union/config/config.toml +sed -i 's/max_num_outbound_peers =.*/max_num_outbound_peers = 10/g' $HOME/.union/config/config.toml + +# pruning +pruning="custom" +pruning_keep_recent="1000" +pruning_keep_every="0" +pruning_interval="10" +sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.union/config/app.toml +sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.union/config/app.toml +sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.union/config/app.toml +sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.union/config/app.toml + + +sudo tee /etc/systemd/system/uniond.service > /dev/null <> $HOME/.bash_profile +source ~/.bash_profile +uniond keys add $Wallet +echo -e " \e[1m\e[32m!!!!!!!!!SAVE!!!!!!!!!!!!!!!!SAVE YOUR MNEMONIC PHRASE!!!!!!!!!SAVE!!!!!!!!!!!!!!!!\e[0m'" + +break +;; +"Synchronization via StateSync") +SNAP_RPC=https://union.rpc.t.stavr.tech:443 +peers="59d554ab6bee4d814afb3e15af4031df19b2084c@union-t.seed.stavr.tech:4256" +sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.union/config/config.toml +LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \ +BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000)); \ +TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) + +echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH + +sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \ +s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \ +s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \ +s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \ +s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.union/config/config.toml +uniond tendermint unsafe-reset-all --home /root/.union +wget -O $HOME/.union/config/addrbook.json "https://raw.githubusercontent.com/111STAVR111/props/main/Union/addrbook.json" +systemctl restart uniond && journalctl -u uniond -f -o cat + + +break +;; +"UPDATE") +echo -e " \e[1m\e[32m SOOOON\e[0m" + + +break +;; +"Check node logs") +sudo journalctl -u uniond -f -o cat + +break +;; +"Synchronization via SnapShot") +cd $HOME +apt install lz4 +sudo systemctl stop uniond +cp $HOME/.union/data/priv_validator_state.json $HOME/.union/priv_validator_state.json.backup +rm -rf $HOME/.union/data +curl -o - -L https://union-t.snapshot.stavr.tech/union-snap.tar.lz4 | lz4 -c -d - | tar -x -C $HOME/.union --strip-components 2 +curl -o - -L https://union-t.wasm.stavr.tech/wasm-union.tar.lz4 | lz4 -c -d - | tar -x -C $HOME/.union --strip-components 2 +mv $HOME/.union/priv_validator_state.json.backup $HOME/.union/data/priv_validator_state.json +wget -O $HOME/.union/config/addrbook.json "https://raw.githubusercontent.com/obajay/nodes-Guides/main/Projects/Union/addrbook.json" +sudo systemctl restart uniond && journalctl -u uniond -f -o cat + +break +;; +"Delete Node") +sudo systemctl stop uniond +sudo systemctl disable uniond +rm /etc/systemd/system/uniond.service +sudo systemctl daemon-reload +cd $HOME +rm -rf .union +rm -rf $(which uniond) + +break +;; +"Exit") +exit +esac +done +done