πŸ†™ Upgrade

πŸ’‘ 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.

βš™οΈ v0.7.3 [Storage node]

cd $HOME/0g-storage-node
git fetch --all --tags
git checkout v0.7.3
git submodule update --init
cargo build --release
mv $HOME/config-testnet-turbo_backup.toml $HOME/0g-storage-node/run/config-testnet-turbo.toml
sudo systemctl restart zgs && sudo systemctl status zgs

You can also upload a snapshot for quick synchronization

sudo systemctl stop zgs
sudo apt-get update
sudo apt-get install wget lz4 pv -y
cd $HOME
wget --show-progress https://snapshots-testnet.unitynodes.com/0gchain-testnet/storage_0gchain_snapshot.lz4
rm -rf $HOME/0g-storage-node/run/db
lz4 -c -d storage_0gchain_snapshot.lz4 | pv | tar -x -C $HOME/0g-storage-node/run
rm -rf $HOME/storage_0gchain_snapshot.lz4
sudo systemctl restart zgs
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)

βš™οΈ v0.4.0 [Validator node]

πŸ”§ Manual Upgrade

πŸ“Œ 1. Update manually only if your node has reached the specified block above.

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

πŸ’‘ Usefull commands

πŸ“ŒCheck sync:

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"
  • Your node height - the current block of your node

  • Network height - the last block of the network

  • Blocks left - how many blocks your node has left to sync. If - 0-1 = node sync.

πŸ“ŒCheck logs

tail -f -n 100 $HOME/.0gchain/log/chain.log

⏱️ Planned upgrade

Relevant to block 616000

  1. Install dependecies(only 1 time)

sudo apt update
sudo apt install -y tmux
  1. Run autoupgrade script

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"


Last updated