Developers Forum for XinFin XDC Network

Cover image for [Informative] Upgrading XDC Clients from v1.4.4 (Old Directory Structure) to Newer v1.6.0
s4njk4n
s4njk4n

Posted on • Updated on

[Informative] Upgrading XDC Clients from v1.4.4 (Old Directory Structure) to Newer v1.6.0

Upgrade by node MIGRATION is a safer option for masternode operators (both validators and standby nodes). New article to upgrade via Migration is here.

Original upgrade article is below but please keep in mind if using it that you MUST ensure you have adequate backups of your keystore file or you may risk losing masternode status, losing any associated income and losing your masternode stake. The migration method is much safer so recommended approach is to use that via the link just above instead of the information below.

Info below kept only for reference for those who really need it.


We've had some operators request help on how to upgrade from the old v1.4.4 clients to the new v1.6.0 after unsuccessfully using upgrade.sh. (The reason it doesn't work is that the directory structures in the older client versions were different and have since been updated). Information below is a quick update from memory of how we've done it for other v1.4.4 clients.

Note that the steps below will involve waiting for the new client to sync the chain which seems to still take us around a week on any nodes we've got running on Gigabit ethernet.

Clients running in a production environment will need to minimise downtime, so will benefit from obtaining and decompressing a chain snapshot so it can be copied straight into the client as soon as it is completed with installation. We encountered some issues when doing this (details in the instructions below) and are working on putting together a solution which should be available in the next few days.

The instructions below are are a quick memory-dump guide from my head of the steps we used so definitely recommend you go through them first to make sure you understand and are happy with them before applying anything below.


TO UPDATE AN OLDER v1.4.4 XDC CLIENT to v1.6.0:

ssh to VPS

UPDATE THE OS:

sudo apt update
sudo apt upgrade
sudo apt autoremove
sudo apt clean
Enter fullscreen mode Exit fullscreen mode

BACKUP REQUIRED FILES TO HOME DIRECTORY:

cd ~
sudo cp ~/XinFin-Node/.env .
sudo cp ~/XinFin-Node/xdcchain/coinbase.txt .
sudo cp ~/XinFin-Node/xdcchain/keystore/UTC* .
Enter fullscreen mode Exit fullscreen mode

SHUTDOWN THE CLIENT:

cd ~/XinFin-Node
sudo bash ./docker-down.sh
Enter fullscreen mode Exit fullscreen mode

DELETE THE v1.4.4 CLIENT:

cd ~
sudo rm -rf XinFin-Node
Enter fullscreen mode Exit fullscreen mode

WARNING THIS ABOVE COMMANDS WILL DELETE ALL NODE FILES ON YOUR MACHINE INCLUDING THE CHAIN WHICH THEN NEEDS TO BE RESYNCED ONCE THE CLIENT IS REINSTALLED. YOU MAY BE ABLE TO BACKUP THE CHAIN FILES BUT WE HAVE NOT TRIED THIS SO CANNOT SUGGEST ANYTHING. For the v1.4.4 clients we helped with, we just deleted the whole client and let them resync the chain from scratch after installing the new v1.6.0 client and restoring coinbase.txt, keystore file, and updating .env details. We were unable to get the current xdcchain.tar snapshot file working, and noted it contains some extra files/folders (and we noted is around 500GB download whereas a current completely synced client normally has a drive footprint of only around 360GB even including the OS). If you can get that snapshot working is the best option to start with. As an alternative we are in the process of creating a new chain snapshot in a few days time from one of our own 1.6.0 clients and plan to make download access to it available online for an XDC fee, but suggest everyone first try the official xdcchain.tar if going down this route as it is free.
The official snapshot is available at:

https://download.xinfin.network/xdcchain.tar

INSTALL THE v1.6.0 CLIENT VIA BOOTSTRAP SCRIPT:

sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)" root
Enter fullscreen mode Exit fullscreen mode

SHUTDOWN THE NEW v1.6.0 CLIENT:

cd ~/XinFin-Node/mainnet
sudo bash ./docker-down.sh
Enter fullscreen mode Exit fullscreen mode

DELETE THE NEW coinbase.txt AND keystore FILES:

cd ~
sudo rm -rf ~/XinFin-Node/mainnet/xdcchain/coinbase.txt
sudo rm -rf ~/XinFin-Node/mainnet/xdcchain/keystore/UTC*
Enter fullscreen mode Exit fullscreen mode

COPY THE OLD coinbase.txt AND keystore FILES INTO THE NEW CLIENT:

sudo cp ~/coinbase.txt ~/XinFin-Node/mainnet/xdcchain/
sudo cp ~/UTC* ~/XinFin-Node/mainnet/xdcchain/keystore/
Enter fullscreen mode Exit fullscreen mode

MAKE SURE YOU DONT HAVE ANY OTHER RANDOM SIMILARLY-NAMED KEYSTORE FILES IN THE HOME DIRECTORY BEFORE YOU RUN THE COPY COMMAND ABOVE ON YOUR UTC* FILE AS IT WILL COPY THEM ALL TO THE NEW CLIENT'S keystore DIRECTORY. IF YOU HAVE MORE THAN ONE FILE IN YOUR HOME DIRECTORY BEGINNING WITH "UTC", YOU WILL NEED TO PUT THE SPECIFIC FILE DETAILS INTO THIS COPY COMMAND SO ONLY THE RIGHT ONE IS MOVED INTO THE NEW CLIENT

CHECK AND MAKE NOTE OF NODE NAME AND CONTACT DETAILS FROM OLD .env FILE:

sudo nano .env
Enter fullscreen mode Exit fullscreen mode

To exit use Ctrl+X

OPEN THE NEW .env FILE IN THE NEW CLIENT:

sudo nano ~/XinFin-Node/mainnet/.env
Enter fullscreen mode Exit fullscreen mode

UPDATE THE NODE NAME
UPDATE THE CONTACT DETAILS
IGNORE THE NEW PRIVATE KEY FIELD. APPARENTLY THERE'S NOTHING WE NEED TO DO WITH THIS
SAVE THE FILE: CTRL+X, press Y, Press

NOTE YOU WILL ALSO NEED TO CONSIDER RESTORING ANY OTHER CUSTOMISATIONS (eg custom port mappings in .yml file, or customisations to your start-node.sh script for --enable-0x-prefix etc.. if you have made any modifications you will need to redo them at this point).

REBOOT YOUR VPS:

sudo reboot
Enter fullscreen mode Exit fullscreen mode

SSH TO YOUR VPS AGAIN

RESTART THE NEW v1.6.0 CLIENT:

cd ~/XinFin-Node/mainnet
sudo bash ./docker-up.sh
Enter fullscreen mode Exit fullscreen mode

LOGOUT OF YOUR VPS, WAIT FOR 30-60 MINS THEN CHECK YOUR NODE'S STATUS AND CLIENT VERSION ON:
https://xinfin.network
or
https://stats.xdc.org

YOU CAN ALSO CHECK THE CLIENT VERSION BY ATTACHING THE JAVASCRIPT CONSOLE:

cd ~/XinFin-Node/mainnet
sudo bash ./xdc-attach.sh
Enter fullscreen mode Exit fullscreen mode

To exit the console, use the "exit" command

IF THE NODE SHOWS AS BEING ONLINE, WITH THE CORRECT VERSION, AND IS SYNCING OK, THEN CONSIDER WHETHER YOU NEED ANY FURTHER BACKUPS OF YOUR KEYSTORE FILE. ONCE DONE WITH THAT, WE CAN DELETE THE .env , coinbase.txt , AND keystore FILES WE PLACED IN THE HOME DIRECTORY:
SSH TO THE VPS

cd ~
sudo rm -rf .env
sudo rm -rf coinbase.txt
sudo rm -rf UTC*
Enter fullscreen mode Exit fullscreen mode

MAKE SURE YOU DONT HAVE ANY OTHER RANDOM SIMILARLY-NAMED KEYSTORE FILES IN THE HOME DIRECTORY BEFORE YOU RUN THIS COMMAND AS IT WILL DELETE EVERYTHING STARTING WITH "UTC"

LOGOUT OF YOUR NODE AND YOU'RE ALL DONE!

Discussion (1)

Collapse
11ppm profile image
11ppm

Thank you for the wonderful procedure, as always. Indeed, the official snapshot was quite large. I don't know why that is... I had hoped that snapshots could be made more frequently. I think it is important to have them released at least once a month. If the releases could be automated, even weekly would be fine.