π‘ How it works?Manual Upgrade - simply copy and paste the code into the terminal.
Planned Upgrade - set up tmux with the provided code, copy the planned upgrade code, paste it into the terminal, after which a tmux session will automatically start counting down to the required block for the upgrade, after which the session will end. At this point, you can detach the session or log out of your server, everything will continue to work in the background. Upon running the script, you will receive all the necessary prompts for exiting, attaching, and viewing active tmux sessions.
Useful commands TMUX:
tmux ls - view tmux sessions
tmux attach -t "session_name" - connect to an existing session
tmux kill-session -t "session_name" - close the tmux session
Press Ctrl + b , release and press D to collapse the session you are in.
π 1. Update manually only if your node has reached the specified block above.
Copy sudo systemctl stop 0gchaind
cd $HOME
rm -rf 0g-chain
wget -O 0gchaind https://github.com/0glabs/0g-chain/releases/download/v0.4.0/0gchaind-linux-v0.4.0
chmod +x $HOME /0gchaind
sudo mv $HOME /0gchaind $( which 0gchaind )
sudo systemctl restart 0gchaind
Copy local_height=$(0gchaind status | jq -r .sync_info.latest_block_height); network_height=$(curl -s https://rpc.0gchain-testnet.unitynodes.com/status | jq -r .result.sync_info.latest_block_height); blocks_left=$((network_height - local_height)); echo "Your node height: $local_height"; echo "Network height: $network_height"; echo "Blocks left: $blocks_left"
Copy tail -f -n 100 $HOME /.0gchain/log/chain.log
Copy sudo apt update
sudo apt install -y tmux
Copy tmux new -s 0g-v041 "bash <(curl -s https://raw.githubusercontent.com/UnityNodes/scripts/main/planned-upgrade.sh) 0g-testnet zgtendermint_16600-2 15100000 v0.4.0 0gchaind"
π 1. Update manually only if your node has reached the specified block above.
Copy sudo systemctl stop 0gchaind
cd $HOME
rm -rf 0g-chain
wget -O 0gchaind https://github.com/0glabs/0g-chain/releases/download/v0.3.1.alpha.0/0gchaind-linux-v0.3.1.alpha.0
chmod +x $HOME /0gchaind
sudo mv $HOME /0gchaind $( which 0gchaind )
sudo systemctl restart 0gchaind
π2. [OPTIONAL SNAPSHOT]
If necessary, download a snapshot if your node has been inactive for a long time to synchronize fewer blocks
Copy sudo systemctl stop 0gchaind
cp $HOME /.0gchain/data/priv_validator_state.json $HOME /.0gchain/priv_validator_state.json.backup
0gchaind tendermint unsafe-reset-all --home $HOME /.0gchain --keep-addr-book
curl https://snapshots-testnet.unitynodes.com/0gchain-testnet/0gchain-testnet-latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.0gchain
mv $HOME /.0gchain/priv_validator_state.json.backup $HOME /.0gchain/data/priv_validator_state.json
sudo systemctl restart 0gchaind
sudo journalctl -u 0gchaind -f -o cat
Copy local_height=$(0gchaind status | jq -r .sync_info.latest_block_height); network_height=$(curl -s https://rpc.0gchain-testnet.unitynodes.com/status | jq -r .result.sync_info.latest_block_height); blocks_left=$((network_height - local_height)); echo "Your node height: $local_height"; echo "Network height: $network_height"; echo "Blocks left: $blocks_left"
Copy PEERS="35f9eee8f064c8d838c3f45ebc495b8412c18203@168.119.136.86:26656,033792eb3f6c359bacfd0d2643a9d102ddac694c@217.76.59.219:26656,8c0c0175e2a887f048332b77edfb75f854a176e9@62.171.164.215:12656,146d2f4be7d4605d50bf312d9872401fcdcb7c3a@194.163.140.160:12656,05c41a56942d13a319998bb8478ddc8b3cd45148@84.247.162.17:26656,a580cbed6cee46d4ccdcb37b5296b027da653a7a@157.90.38.106:26656,f29b110d6eb27947dbcdf09d9fd49b5e1fa9e19f@38.242.138.245:26656,8403aa0820da76e885584ce3ac8d1d408c40b515@144.76.39.253:26656,9ac153e24e2f3f5210f63101fcc130f20546a375@116.202.37.103:26656,3e57a37e2025632bbeb94781d4ac023a536dbd95@149.50.113.93:12656,c0cfc7c9d0cab4562e1933adf9fcc62f659f1b78@94.16.105.248:13456,07c0e080cca1024a2bcff73e11d056dac0bd858e@65.108.233.73:42656,611083057d3519c1ff14c254a1fa3c3d20980ce2@195.201.160.60:26656,0a827d0e1966731fd8680490601f49e5e9dc7130@158.220.109.21:26656,b517215f5542d9978981d63b7b926f8d70d9c9db@62.171.167.145:12656"
sed -i "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME /.0gchain/config/config.toml
sudo systemctl restart 0gchaind
sudo journalctl -u 0gchaind -f -o cat
Copy sudo journalctl -u 0gchaind -f -o cat
Copy tail -f -n 100 $HOME /.0gchain/log/chain.log
Copy sudo apt update
sudo apt install -y tmux
Copy tmux new -s 0gchain-testnet-v031 "bash <(curl -s https://raw.githubusercontent.com/UnityNodes/scripts/main/planned-upgrade.sh) 0g-testnet zgtendermint_16600-2 616000 v0.3.1.alpha.0 0gchaind"