| title | Setup XDC Masternode using Docker |
|---|
The server or VPS used for the masternode should be directly facing the internet with a public IP and without NAT.
Operating System: Ubuntu 20.04 64-bit or higher
Should be facing internet directly with public IP & without NAT
Tools: Docker, Docker Compose(1.27.4+)
Setup (For Ubuntu 20.04 64-bit or higher Operating System)
Follow the written steps starting from step 1, or you can watch the video tutorials:
<iframe width="768" height="432" src="https://www.youtube.com/embed/1A20eVTJYvs" title="Deploying an XDC Network Masternode via Docker" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>git clone https://github.com/XinFinOrg/XinFin-Node.git
Then we change the directory to XinFin-Node
cd XinFin-NodeWe need to install Docker and Docker-Compose by running the following command:
sudo ./setup/install_docker.shCreate a new .env file and copy the env.example file that exist in the mainnet directory. We will ensure we are in the "mainnet" directory by typing these commands. Once in edit mode for the .env file, name your masternode and use an email address in the respective fields
cd mainnet
cp env.example .env
nano .env
For Testnet
cd testnet
cp env.example .env
nano .envFor Mainnet run the following commands:
cd mainnet
bash docker-up.shAt this point you should be able to see your masternode on the list of nodes here or as shown below:
For Testnet run the following commands:
cd testnet
bash docker-up.shYou should be able to see your node listed on the [Apothem Network] page. Select "Switch to LiveNet" to check LiveNetwork Stats and Select "Switch to TestNet" for TestNetwork.
Your coinbase address can be found in xdcchain/coinbase.txt file.
For troubleshooting purposes, you can stop the node by using the following command on either Mainnet or Testnet:
bash docker-down.shDownloading a Network Snapshot (Mainnet or Apothem)
The following steps are to expedite the syncing process of your node with the XDC Network. If you followed the steps above, your node will take 3-4 days to sync up with the network fully. You can reduce that time by downloading a network snapshot and bringing your node back up after the chain has been downloaded and unpacked.
<iframe width="768" height="432" src="https://www.youtube.com/embed/ZQF3f0Zd6-k" title="Downloading an XDC Network Snapshot to Expedite Node Syncing to" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>Bring down your node:
bash docker-down.shRemove the old xdchain file from the server
rm -rf xdcchain.tarDownload the snapshot
wget https://download.xinfin.network/xdcchain.tarUnpack the xdcchain.tar file
tar -xvzf xdcchain.tarThe unpacking will take some time, and it will look like this:
The following command will move the xdcchain/XDC to xdcchain/XDC_backup
mv xdcchain/XDC xdcchain/XDC_backup
mv XDC xdcchainThen we are going to remove the old "nodekey" file
rm -rf xdcchain/XDC/nodekeyThe last step is to run the bash upgrade.sh command
bash upgrade.shThis command will bring your node up and it will start syncing to the network. Once up and running, your node will be synced to the network in just a few minutes.
Bring down your node:
bash docker-down.shRemove the old xdchain file from the server
rm -rf apothem.tarDownload the snapshot
Full Node snapshot:
wget http://downloads.apothem.network/xdcchain.tarArchive Node snapshot:
wget http://downloads.apothem.network/xdcchain_archive.tarUnpack the apothem.tar file
tar -xvzf apothem.tarMove the xdcchain-testnet
mv XDC xdcchain-testnetBring up the node
bash docker-up.sh

