We are going to follow these steps to set up an XDC Masternode.
The server or VPS used for the masternode should be directly facing the internet with a public IP and without NAT.
Follow the written steps starting from step 1, or you can watch the video tutorials:
{% embed url="https://youtu.be/1A20eVTJYvs" %}
Clone repository
git clone https://github.com/XinFinOrg/XinFin-Node.git
Then we change the directory to XinFin-Node
cd XinFin-Node
We need to install Docker and Docker-Compose by running the following command:
sudo ./setup/install_docker.sh
Create 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
cd testnet
cp env.example .env
nano .env
cd mainnet
sudo docker-compose -f docker-compose.yml up -d
At this point you should be able to see your masternode on the list of nodes here or as shown below:
Node syncing up to the network
For Testnet run the following commands:
cd testnet
sudo docker-compose -f docker-compose.yml up -d
You 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:
sudo docker-compose -f docker-compose.yml down
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.
{% embed url="https://youtu.be/ZQF3f0Zd6-k" %}
sudo docker-compose -f docker-compose.yml down
rm -rf xdcchain.tar
wget https://download.xinfin.network/xdcchain.tar
tar -xvzf xdcchain.tar
mv xdcchain/XDC xdcchain/XDC_backup
mv XDC xdcchain
rm -rf xdcchain/XDC/nodekey
bash upgrade.sh
This 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.
sudo docker-compose -f docker-compose.yml down
rm -rf apothem.tar
wget https://download.apothem.network/apothem.tar
tar -xvzf apothem.tar
mv XDC xdcchain-testnet
sudo docker-compose -f docker-compose.yml up -d