sudo apt update
sudo apt-get install git curl build-essential make jq gcc snapd chrony lz4 tmux unzip bc -y
rm -rf $HOME/go
sudo rm -rf /usr/local/go
cd $HOME
curl https://dl.google.com/go/go1.22.3.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -
cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
source $HOME/.profile
go version
cd $HOME
rm -rf elys
git clone https://github.com/elys-network/elys.git
cd elys
git checkout v2.3.0
make install
elysd version
elysd init NodeName --chain-id=elys-1
elysd config chain-id elys-1
elysd config keyring-backend os
curl -Ls https://files.nomadvalidator.com/mainnet/elys/genesis.json > $HOME/.elys/config/genesis.json
curl -Ls https://files.nomadvalidator.com/mainnet/elys/addrbook.json > $HOME/.elys/config/addrbook.json
sudo tee /etc/systemd/system/elysd.service > /dev/null <<EOF
[Unit]
Description=elysd Daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which elysd) start
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable elysd
sudo systemctl restart elysd
journalctl -u elysd -f
curl -Ls https://files.nomadvalidator.com/mainnet/elys/addrbook.json > $HOME/.elys/config/addrbook.json
sudo systemctl restart elysd
sudo journalctl -u elysd -f
curl -Ls https://files.nomadvalidator.com/mainnet/elys/genesis.json > $HOME/.elys/config/genesis.json
peers="d71d3bce45274bf8354298042674a08c778f6d27@202.61.243.56:22056,63d6f9956561da3bcdd7a06492599d26b698b7ef@135.125.180.194:10656,2507d94809df3b6dbf5bdaa4840dbdc38356cb10@37.27.108.165:26656,1d079e8b757b21b390f3eca0880ca03f7f90d8f0@95.217.143.167:20656,113f135608a5791f4e3aa37b9c81d6e602696eed@188.165.200.129:15356,cb307242beca3223146d7e404104a91b8ff77653@65.21.214.84:22056,b4f02b4dbeb369dd9b4e81a16e0db4194e351ffb@85.10.207.118:26656,d29958aca6eaf55b33314fdf861cf9ddeec21fb0@23.94.81.26:41656,113a7099e834c9bc52bb97e220290b401edede90@162.244.27.139:26656,d95bdf717eb751667586b5e31083770630742038@65.109.58.158:22156"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = "$peers"/" ~/.elys/config/config.toml
sudo systemctl restart elysd
sudo journalctl -u elysd -f
sudo systemctl stop elysd && elysd tendermint unsafe-reset-all --home $HOME/.elys --keep-addr-book
SNAP_RPC=https://elys-rpc.nomadvalidator.com:443 && \
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 100)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash); \
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH
sudo systemctl stop elysd && elysd tendermint unsafe-reset-all --home $HOME/.elys --keep-addr-book
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/.elys/config/config.toml
sudo systemctl restart elysd && journalctl -fu elysd -o cat