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_SELFCHAIN='26'" >> $HOME/.bash_profile
source $HOME/.bash_profile
cd $HOME
wget -O selfchaind https://download.dteam.tech/selfchain/mainnet/binary
chmod +x selfchaind
mv selfchaind $HOME/go/bin
selfchaind version
selfchaind init "validator" --chain-id self-1
selfchaind config chain-id self-1
selfchaind config keyring-backend os
selfchaind config node tcp://localhost:${PORT_SELFCHAIN}657
wget -O $HOME/.selfchain/config/genesis.json https://download.dteam.tech/selfchain/mainnet/genesis
wget -O $HOME/.selfchain/config/addrbook.json https://download.dteam.tech/selfchain/mainnet/addrbook
SEEDS="5848c2846bd2ea36ecb6e440fabc48e1893aefe2@seed.selfchain.mainnet.dteam.tech:34656"
PEERS="b127417d963b85ece3444d3eb2ef709a08f3c4cf@peer.selfchain.mainnet.dteam.tech:29656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.selfchain/config/config.toml
sed -i.bak -e "s%:1317%:${PORT_SELFCHAIN}317%g;
s%:8080%:${PORT_SELFCHAIN}080%g;
s%:9090%:${PORT_SELFCHAIN}090%g;
s%:9091%:${PORT_SELFCHAIN}091%g;
s%:8545%:${PORT_SELFCHAIN}545%g;
s%:8546%:${PORT_SELFCHAIN}546%g;
s%:6065%:${PORT_SELFCHAIN}065%g" $HOME/.selfchain/config/app.toml
sed -i.bak -e "s%:26658%:${PORT_SELFCHAIN}658%g;
s%:26657%:${PORT_SELFCHAIN}657%g;
s%:6060%:${PORT_SELFCHAIN}060%g;
s%:26656%:${PORT_SELFCHAIN}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${PORT_SELFCHAIN}656\"%;
s%:26660%:${PORT_SELFCHAIN}660%g" $HOME/.selfchain/config/config.toml
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.selfchain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.selfchain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"20\"/" $HOME/.selfchain/config/app.toml
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.005uslf"|g' $HOME/.selfchain/config/app.toml
INDEXER="null"
sed -i -e "s/^indexer *=.*/indexer = \"$INDEXER\"/" $HOME/.selfchain/config/config.toml
SNAPSHOT_INTERVAL=0
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$SNAPSHOT_INTERVAL\"/" ~/.selfchain/config/app.toml
sudo tee /etc/systemd/system/selfchaind.service > /dev/null <<EOF
[Unit]
Description=selfchain mainnet node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.selfchain
ExecStart=$(which selfchaind) start
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
selfchaind tendermint unsafe-reset-all --home $HOME/.selfchain
curl https://download.dteam.tech/selfchain/mainnet/pruned/latest-snapshot | lz4 -dc - | tar -xf - -C $HOME/.selfchain
sudo systemctl daemon-reload
sudo systemctl enable selfchaind
sudo systemctl restart selfchaind
sudo journalctl -u selfchaind -f -o cat