Please read this article and ensure you understand it completely before implementing anything described. If you're not sure about anything at all, please clarify it with someone who can help before you implement anything. If you post on xdc.dev someone will respond and clarify for you. (And most of all if you are a masternode operator, please make sure you have all appropriate backups of the keystore file from your node before doing anything!)
This article describes the process to upgrade your XDC Client from v1.4 to v1.6 by MIGRATING it to a new VPS. This is a safer option than deleting/reinstalling as all your files on the existing node remain intact until you are happy that your new node is up and running fine. If you encounter any immediate issues on the new node, it gives you the option of just going back to using the old/existing node until you have sorted out whatever is the issue you're experiencing with the new node.
Definitions
- VPS1 = The VPS your current v1.4 XDC Client is running on.
- username1 = Username of VPS1.
- IPaddress1 = IP address of VPS1.
- XDC-Client1 = XDC Client running on VPS1.
and:
- VPS2 = The VPS you will be setting up your new v1.6 XDC Client on.
- username2 = Username of VPS2.
- IPaddress2 = IP address of VPS2.
- XDC-Client2 = XDC Client running on VPS2.
Now we begin...
First go and arrange a new VPS to use as VPS2. You'll find information on system requirements for your VPS here:
https://xinfin.org/docker-setup
SSH to VPS2 in your Terminal
ssh username2@IPaddress2
Once logged into VPS2, update the OS:
sudo apt update
sudo apt upgrade
sudo apt autoremove
sudo apt clean
Install XDC-Client2 via Bootstrap script:
sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)" root
You'll be asked a few questions during installation of your node with the bootstrap script above.
Answer "mainnet" when asked about that.
Select "y" regarding private key etc. (We're going to replace the keystore later anyway).
Shutdown XDC-Client2:
cd ~/XinFin-Node/mainnet
sudo bash ./docker-down.sh
Download the current chain snapshot using either:
- The Rapid Download snapshot from https://xdcchain.xyz if you have a download command from there. It will be the one that looks something like:
Example: sudo wget -c -O xdcchain.xyz_snapshot.tar "https://nzYS66oEzxybde:CHiJzMnJ354Y3x@xdcchain.xyz/snapshot/xdcchain.xyz_snapshot.tar?authorisedip=nzYS66oEzxybde"
OR
- The official XinFin snapshot:
sudo wget https://download.xinfin.network/xdcchain.tar
Then logout of VPS2:
logout
SSH to VPS1
ssh username1@IPaddress1
Navigate to the XDC-Client1 directory:
cd ~/XinFin-Node
Shutdown XDC-Client1:
(It is very important that you do this now to avoid a conflict later on the network with XDC-Client2)
Depending on the version of your XDC-Client1 installation, you may have to use:
sudo docker-compose -f docker-services.yml down
OR
sudo docker-compose -f docker-compose.yml down
If neither of those commands has worked for you to shutdown XDC-Client1, please reply to this article in the comments. DO NOT PROCEED WITH FURTHER STEPS ON EITHER VPS UNTIL XDC-Client1 HAS BEEN SUCCESSFULLY SHUTDOWN (or it may interfere with XDC-Client2 receiving rewards or operating correctly)
After shutting down XDC-Client1, we then logout:
logout
SSH to VPS2
ssh username2@IPaddress2
Navigate to the mainnet directory:
cd ~/XinFin-Node/mainnet
Next we need to decompress the snapshot
If you've used the xdcchain.xyz snapshot file, then you'll use:
sudo tar -xvzf xdcchain.xyz_snapshot.tar
OR
If you've used the official XinFin snapshot, then you'll use:
sudo tar -xvzf xdcchain.tar
Delete any pre-existing chain database files on XDC-Client2:
sudo rm -rf xdcchain/XDC
Move the new chain snapshot files to the correct location:
sudo mv XDC xdcchain/XDC
Delete the new coinbase.txt and keystore files in XDC-Client2:
sudo rm -rf xdcchain/coinbase.txt
sudo rm -rf xdcchain/keystore/UTC*
Copy your coinbase.txt from VPS1 to VPS2:
sudo scp username1@IPaddress1:~/XinFin-Node/xdcchain/coinbase.txt xdcchain/coinbase.txt
Copy your Keystore file from VPS1 to VPS2:
sudo scp username1@IPaddress1:~/XinFin-Node/xdcchain/keystore/UTC* xdcchain/keystore/
Copy your .env file from VPS1 to your HOME directory on VPS2:
sudo scp username1@IPaddress1:~/XinFin-Node/.env ~
Open the .env file you just copied from XDC-Client1 in nano:
sudo nano ~/.env
Take note of the name of your node and the contact email address you used
Type them in a notepad if u need.
Then close nano by using:
Ctrl+X
Open the NEW .env for XDC-Client2 in nano (we don't need to specify a path as we're already in the ~/XinFin-Node/mainnet/ directory):
sudo nano .env
Put the name of your node into the INSTANCE_NAME field.
Put the email address you used into the CONTACT_DETAILS field.
Ignore the other fields in the file (including the Private Key field).
Then close and save the .env file by using:
Ctrl+X
Y
Press Enter
Delete the old .env file from your HOME directory:
sudo rm -rf ~/.env
Start XDC-Client2:
sudo bash ./docker-up.sh
Wait 10 minutes and then check your node's status on https://xinfin.network or https://stats.xdc.org
If you are operating a masternode (validator or standby node), you should also check you node is showing properly on https://master.xinfin.network and isn't slashed. If your node is showing as slashed or isn't showing at all on the site then there may be another issue that you'll need to troubleshoot.
If you are operating a masternode (validator or standby node), you should also check your appropriate rewards are continuing to arrive in your correct wallet at the correct intervals. If you are not receiving your expected rewards then there may be another issue that you'll need to troubleshoot.
If all looks fine then congratulations you have now migrated your node!
Once you are happy that your node migration has been successful and if you want to clear a few hundred GB of drivespace on VPS2 to allow for growth of the chain, you can consider deleting the chain snapshot file you downloaded by using the relevant command for whichever snapshot file you downloaded and used:
sudo rm -rf ~/XinFin-Node/mainnet/xdcchain.tar
OR:
sudo rm -rf ~/XinFin-Node/mainnet/xdcchain.xyz_snapshot.tar
In case of any technical queries on XDC Network, feel free to drop your queries on XDC.Dev forum.
Quick links:
XinFin.org
XDC Chain Network Tools and Documents
XDC Network Explorer
XDC Dev Forum
Beta — XDC Web Wallet
XDC faucet
XDC faucet - Blocksscan
XinFin — XDC Social Links:
Twitter
GitHub
Telegram
Facebook
LinkedIn
YouTube
Discussion (0)