DPOPS Manual Installation
Manual Installation
This guide hasn't been updated since May 2020. It is highly recommended to install the xcash-dpops program with the installer script provided here.
This guide is designed for people knowledgeable in Linux and who want to install everything from scratch. If you are not comfortable with the Linux distribution, or if you are following these steps without understanding what you are doing, you might make a mistake that will prevent the xcash-dpops program to run as intended.
1. Installation Directories
In the ~ directory, create the xcash-official directory and the xcash-wallets , systemdpid , and logs directory within. Additionally, create the .X-CASH directory that will store the X-Cash blockchain file.
mkdir -p ~/xcash-official/{xcash-wallets,logs,systemdpid}
mkdir -p ~/.X-CASH2. Install Dependencies
First, update your system packages and install the necessary dependencies:
sudo apt update -y && sudo apt upgrade -y
sudo apt install build-essential cmake pkg-config libssl-dev git -yIf you want to install xcash-core from source, you will need to install these additional packages.
sudo apt install libboost-all-dev libzmq3-dev libunbound-dev libsodium-dev libminiupnpc-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev libgtest-dev doxygen graphviz libpcsclite-dev screen p7zip-full -y2.a) Installing MongoDB
You will need to get the latest stable version (current release) on the MongoDB website: https://www.mongodb.com/download-center/community

Version: Latest current release. OS: Ubuntu 18.04 Linux x64 (if you are using this version). Package: Server
Then click on All version binaries.

Copy the link address of the tgz file of the latest version available (disregarding debug symbols version) and use it to download the installation folder using this command (replacing the link with the most recent version).
cd ~/xcash-official && wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-v4.4-latest.tgzThen, extract it and remove the downloaded file:
tar -xf mongodb-linux-x86_64*.tgz && rm mongodb-linux-x86_64*.tgzLastly, add the MongoDB binaries folder to your path with the following command.
echo -e '\nexport PATH=$USER/xcash-official/mongodb-linux-x86_64-ubuntu1804-4.4.0-rc7-36-gcf4ac31/bin:$PATH' >> ~/.profile && source ~/.profileReplace $USER/xcash-official/mongodb-linux-x86_64-ubuntu1804-4.4.0-rc7-36-gcf4ac31/bin with the MongoDB binaries folder in your system.
Additionally, create the /data/db folder that will keep the delegates databases:
sudo mkdir -p /data/db && sudo chmod 770 /data/db && sudo chown $USER /data/db2.b) Building the MongoDB C Driver from source
First, download the latest stable version of the MongoDB C Driver. Go to the official GitHub repository and download the latest stable release. Get the tarball file in your installation folder:
cd ~/xcash-official/ && wget https://github.com/mongodb/mongo-c-driver/releases/download/1.16.2/mongo-c-driver-1.16.2.tar.gzNow, build the driver using the following commands (based on these instructions):
tar xzf mongo-c-driver-*.tar.gz && rm mongo-c-driver-*.tar.gz
cd mongo-c-driver-*
mkdir cmake-build && cd cmake-build
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
sudo make -j `nproc`
sudo make installThen, update the links and cache of the newly installed library:
sudo ldconfig2.c) Building xcash-core from source
xcash-core from sourceClone the xcash-core repository to your installation folder and go to the downloaded folder:
cd ~/xcash-official/ && git clone https://github.com/X-CASH-official/xcash-core.git
cd xcash-core
git checkout --quiet xcash_proof_of_stakeMake sure to have all the dependencies installed, and build the binaries using make:
make clean
make release -j `nproc`Once the build finishes, the binaries will be located in ~/xcash-official/xcash-core/build/release/bin
3. Build Instructions
At this point, all the dependencies should be installed and built. First, clone the xcash-dpops repository:
cd ~/xcash-official/ && git clone https://github.com/X-CASH-official/xcash-dpops.gitGo into the downloaded folder, and build using make:
cd ~/xcash-official/xcash-dpops
make clean ; make release -j `nproc`Once the build is completed, you will get the xcash-dpops Has Been Built Successfully message. Now that the program is built, you will need to generate a wallet to be used for the delegate and set up the different units for systemd to organize how your server manages the different services.
4. Generate a Wallet
You will need to create a wallet to register as a delegate, to receive the block reward if you are elected as a top delegate and if you are a shared delegate, the payments will be sent from this wallet as well.
To generate a new wallet, use the following command:
~/xcash-official/xcash-core/build/release/bin/xcash-wallet-cli --generate-new-wallet ~/xcash-official/xcash-wallet/<WALLET_NAME> --password <PASSWORD> --mnemonic-language English --restore-height 0 --daemon-address <REMOTE_NODE>Replace <WALLET_NAME>, <PASSWORD> and the <REMOTE_NODE> with the parameters of your choice.
Make sure that you write down your mnemonic key and store it in a secure place as it will be the only way to restore your wallet in case of a problem. Failing to do so will result in loss of funds.
The wallet files will be located in ~/xcash-official/xcash-wallets/
5. Setup The Services
In systemd, a unit refers to any resource that the system knows how to operate on and manage. This is the primary object that the systemd tools know how to deal with. These resources are defined using configuration files called unit files.
On this guide, we will set up the different unit files to manage the programs needed to run your delegate node. The unit files template are present in the xcash-dpops/scripts/systemd folder, but will need to be adjusted with your delegate information.
5.a) Initialization
Create two empty PID files in the systemdpid folder previously created, that will manage the corresponding services:
touch ~/xcash-official/systemdpid/mongod.pid ~/xcash-official/systemdpid/xcash-daemon.pid5.b) mongodb Service
Edit the systemd unit file mongodb.service from in the xcash-dpops/scripts/systemdfolder :
nano ~/xcash-official/xcash-dpops/scripts/systemd/mongodb.serviceYou will get the following unitfile:
[Unit]
Description=MongoDB X-Cash Database Server
After=network.target
[Service]
Type=forking
User=root
Type=oneshot
RemainAfterExit=yes
PIDFile=~/xcash-official/systemdpid/mongod.pid
ExecStart=~/xcash-official/mongodb-linux-x86_64-ubuntu1804-4.4.0-rc7-36-gcf4ac31/bin/mongod --fork --syslog --dbpath /data/db
LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitNPROC=64000
LimitMEMLOCK=infinity
TasksMax=infinity
TasksAccounting=false
[Install]
WantedBy=multi-user.targetIn the file, replace the following if needed:
User: User of the system (most likelyroot)PIDFile: The path tomongod.pidfile that you created at the initialization step.ExecStart:Replace the path to the
mongodfile.Replace the path to the database directory (
/data/dbas per the instructions)
5.c) xcash-daemon Service
Edit the systemd unit file xcash-daemon.service from in the xcash-dpops/scripts/systemdfolder :
nano ~/xcash-official/xcash-dpops/scripts/systemd/xcash-daemon.serviceYou will get the following unitfile:
[Unit]
Description=X-CASH Daemon background process
[Service]
Type=forking
User=root
PIDFile=~/xcash-official/systemdpid/xcash-daemon.pid
ExecStart=~/xcash-official/xcash-core/build/release/bin/xcashd --rpc-bind-ip 0.0.0.0 --p2p-bind-ip 0.0.0.0 --rpc-bind-port 18281 --restricted-rpc --confirm-external-bind --log-file ~/xcash-official/logs/xcash-daemon-log.txt --max-log-file-size 0 --detach --pidfile ~/xcash-official/systemdpid/xcash-daemon.pid
RuntimeMaxSec=15d
Restart=always
[Install]
WantedBy=multi-user.targetIn the file, replace the following if needed:
User: User of the system (most likelyroot)PIDFile: The path toxcash-daemon.pidfile that you created at the initialization step.ExecStart:Replace the path to the
xcashdfile.Replace the path to the
xcash-daemon_Log.txtfile.Replace the path to the
xcash-daemon.pidfile.
5.d) xcash-rpc-wallet Service
Edit the systemd unit file xcash-rpc-wallet.service from in the xcash-dpops/scripts/systemdfolder :
nano ~/xcash-official/xcash-dpops/scripts/systemd/xcash-rpc-wallet.serviceYou will get the following unit file:
[Unit]
Description=X-Cash RPC Wallet background service
[Service]
Type=simple
User=root
ExecStart=~/xcash-official/xcash-core/build/release/bin/xcash-wallet-rpc --wallet-file ~/xcash-official/xcash-wallets/WALLET --password PASSWORD --rpc-bind-port 18285 --confirm-external-bind --daemon-port 18281 --disable-rpc-login --trusted-daemon
Restart=always
[Install]
WantedBy=multi-user.targetIn the file, replace the following if needed:
User: User of the system (most likelyroot)ExecStart:Replace the path to the
xcash-wallet-rpcfile.Replace the path to the
xcash-walletsfolder, and replaceWALLETby your delegate wallet name.Replace
PASSWORDwith your delegate wallet password.
5.e) Firewall Service
Edit the systemd unit file firewall.service from in the xcash-dpops/scripts/systemdfolder :
nano ~/xcash-official/xcash-dpops/scripts/systemd/firewall.serviceYou will get the following unit file:
[Unit]
Description=firewall
[Service]
Type=oneshot
RemainAfterExit=yes
User=root
ExecStart=~/xcash-official/xcash-dpops/scripts/firewall/firewall_script.sh
[Install]
WantedBy=multi-user.targetIn the file, replace the following if needed:
User: User of the system (most likelyroot)ExecStart: Replace the path to thefirewall/firewall_script.shfile.
5.f) xcash-dpops Service
Edit the systemd unit file xcash-dpops.service from in the xcash-dpops/scripts/systemdfolder :
nano ~/xcash-official/xcash-dpops/scripts/systemd/xcash-dpops.serviceYou will get the following unit file:
[Unit]
Description=X-Cash DPOPS Daemon background process
[Service]
Type=simple
LimitNOFILE=infinity
User=root
WorkingDirectory=~/xcash-official/xcash-dpops/build
ExecStart=~/xcash-official/xcash-dpops/build/xcash-dpops --block-verifiers-secret-key BLOCK_VERIFIER_SECRET_KEY
Restart=always
[Install]
WantedBy=multi-user.targetIn the file, replace the following if needed:
User: User of the system (most likelyroot)WorkingDirectory: Replace the path of thexcash-dpops/buildfolder.ExecStart:Replace the path to the
xcash-dpopsfile.Replace
BLOCK_VERIFIER_SECRET_KEYwith your generated verifier secret key. This should be the first parameter.
5.g) Install and reload
Now that you have prepared all the unit systemd files, you will need to copy all of them to the system folder:
cp -a ~/xcash-official/xcash-dpops/scripts/systemd/* /lib/systemd/system/Then, reload systemd to take the changes into account and run the services.
systemctl daemon-reload6. Generate a Block Verifier Key
The block verifier key is a unique identifier generated by a delegate and is used in the consensus process to sign messages and verify the information. As a delegate, you will need to generate a block verifier key before being able to register yourself in the system.
First of all, stop the currently running process of the xcash-dpops program.
systemctl stop xcash-dpopsThen, run the xcash-dpops program with the --generate-key option. The program is located in the xcash-dpops/build folder. Run the command:
~/xcash-official/xcash-dpops/build/xcash-dpops --generate-keyYou will be given a block verifier public key and block verifier private key.
XCASH DPOPS - Version 1.0.0
---------------------------
Public Key:
cf8718d638ce0a831f3538ea60d1e27c3a258c7004a1ad7c547cc5331de7d9d7
Secret Key:
ca1319431124f55fa0d9e0fcc84edd780f80da7d91f08d334fac17c803934ecccf8718d638ce0a831f3538ea60d1e27c3a258c7004a1ad7c547cc5331de7d9d7Securely save the key you will be using! Once you have registered as a delegate with this key pair, you will be identified in the system with this. If you lose it, you will lose your delegate stats and will have to start over.
First of all, stop the currently running process of the xcash-dpops program.
systemctl stop xcash-dpopsThen, add your block verifier secret key as a parameter in the service. See the setup of the services guide to see how to edit the unit file.
Once done, make sure to save the new changes to systemctl by using the following command:
systemctl daemon-reload7. Test build
To run the X-CASH DPOPS test, make sure to have already started the xcash-daemon, xcash-rpc-wallet and mongodb systemd services, and to have stopped the xcash-dpops systemd service if it was already running.
Navigate to the folder that contains the binary, rebuild the binary in debug mode then run the test
make clean ; make debug -j `nproc`
cd build && ./xcash-dpops --testThe test will return the number of passed and failed tests at the bottom of the console. The failed test need to be 0 before you run the node. If the output is not showing 0 for a failed test, then you need to scroll through the testing output and find what test failed (It will be red instead of green).
If this is a system compatibility test, then you will need to fix the system. If this is a core test that has failed, then you need to possibly rebuild, or contact us on the DPoPS testing section or go the Discord channel to get help from testers and the dev-team.
Shared delegates Manual Installation
If you plan on being a delegate but need to accept people vote to help you place in the top delegates spot and earn the right to forge blocks, you will need to run a shared delegate. The shared delegates website will automatically pay your voters taking into account their share.
Manual Setup
To run your node as a shared delegate, you just need to run the xcash-dpops program with the following added set of parameters:
--shared-delegates-website --fee <fee> --minimum-amount <amount>With :
<fee>: Your delegate fee is the amount of the block reward you are keeping to yourself. The<fee>is expressed in percentage (%) and can take up to 6 decimals.<amount>: The minimum amount of XCASH that can be sent to voters as part of their payment. Has to be an integer number.
Example
--shared-delegates-website --fee 12.092032 --minimum-amount 10000Will register as a shared delegate, taking a fee of 12.092032% from the block reward, and process payments to voters when they have accumulated to 10,000 XCASH.
Update the xcash-dpops program
xcash-dpops programTo make sure that your node is running with the parameters, you should update the unit files and restart the service.
First, make sure to stop the running xcash-dpops service:
systemctl stop xcash-dpopsThen, edit the unit file:
nano /lib/systemd/system/xcash-dpops.serviceAnd add the parameters to the ExecStart variable:
[Unit]
Description=XCASH DPOPS
[Service]
Type=simple
LimitNOFILE=infinity
User=root
WorkingDirectory=~/xcash-official/xcash-dpops/build
ExecStart=~/xcash-official/xcash-dpops/build/xcash-dpops --block-verifiers-secret-key BLOCK_VERIFIER_SECRET_KEY --shared-delegates-website --fee <fee> --minimum-amount <amount>
Restart=always
[Install]
WantedBy=multi-user.targetMake sure that the following parameter is in first place:
--block-verifiers-secret-key BLOCK_VERIFIER_SECRET_KEYBuild the shared delegate website
As a shared delegate, you will need to pay your voters a share of the block reward. We have designed a delegate pool website, which works similarly to a regular PoW pool website, where your voters can see their pending payments, your forging statistics and so on...
First, install the website dependencies:
NodeJS
Install nodeJS latest available version:
sudo apt install nodejsAnd update to the latest version using this tutorial.
npm
Install npm globally:
npm install -g npmAngular & Uglify JS
Install Angular and UglifyJS globally:
npm install -g @angular/cli@latest uglify-jsBuild
Once all dependencies are installed, clone the delegate pool website repository :
cd ~/xcash-official && git clone https://github.com/X-CASH-official/delegates-pool-website.gitGo into the folder, install the dependencies, and build the website:
cd ~/xcash-official/delegates-pool-website
npm update
npm run buildIt will build in the distfolder.
Compress the .js files with Uglify-JS and move all of the contents of this folder to your xcash-dpops/ folder:
cd ~/xcash-official/delegates-pool-website/dist
for f in *.js; do echo "Processing $f file.."; uglifyjs $f --compress --mangle --output "{$f}min"; rm $f; mv "{$f}min" $f; done
rm -r ~/xcash-official/xcash-dpops/delegates-pool-website
mkdir ~/xcash-official/xcash-dpops/delegates-pool-website
cd ..
cp -a dist/* ~/xcash-official/xcash-dpops/delegates-pool-websiteAnd you are done 🎉 Verify that you are listed in the delegate explorer, and start advertising your node to get people joining your cause and vote for you!
Last updated