Setting up a Zcoin Masternode/Znode

Romano RNR
10 min readDec 21, 2017

Zcoin Masternodes are available since a few days ago. So in this article I will show you how to setup a Masternode/Znode.

Disclaimer: I assume you have basic knowledge of Linux and your own OS. I’m not responsible for any loss by using this guide. I assume you don’t have a learning disorder. Do not proceed this guide if you have any doubts in the guide or in yourself.

- This guide has been updated at July 31 2018

Never sent your private key to anyone. Not even me. Don’t get social engineered by people acting they want to help you on discord or telegram.

There’s an original guide from Zcoin here: https://zcoin.io/zcoin-znode-setup-guide/

However in this tutorial, I do it my way.

So many of you know me as @RNR_0 on twitter. Known as a trader, shitposter and Viacoin Lead Developer. It might looks strange for some people but I do invest in other coins I believe in. Zcoin is one of them. Great tech & Developers. (Hoping to eat KFC with Zcoin community manager Reuben when I go to Bangkok in 2018.)

For setting up a Zcoin masternode you need 1000 XZC (Keep tx fee in mind) which is 4.55 BTC which is around $74.460 (current price when this was written) making it one of the few most expensive masternodes. Not everyone can afford it.

Expecting the masternode to generate $3000+ per month. You could live without almost 0 work and still not run out of money lol.

When that happens, your friends who can’t afford it will probably call you “a faggot”, “no skilled trader”, “trash bagholder” etc when ironically both of you are those things. So your best bet to counter this is to screenshot your Znode earnings and keep sending it to them and tell him your masternode isn’t shit, he is. You will be the one making money, not them.

First of all, install/sync the Zcoin wallet on your own PC/Laptop.

Vultr

Personally I use Vultr instead of Digital ocean for my VPS. Main reason is that their servers usually perform better and I can pay with bitcoin.

After you made an account, we can start setting up our Zcoin Masternode. I chose Frankfurt to be the location of my node.

However you can deploy it anywhere you want. As Operating System I chose CentOS 7 x64 for my Masternode instead of the famous Ubuntu.

CentOS

CentOS is a free alternative clone of Red Hat Enterprise Linux, which is known of being the most widely-supported distribution in corporate IT. Working with a CentOS server is extremely similar to working with RHEL. CentOS is (arguably) more stable& secure than Ubuntu. CentOS has less frequent updates meaning everything will be tested for a longer time.

This saves you headache from unstable software because you won’t get a buggy release. It uses yum instead of apt-get and if you ever want to work at a hosting company, being able to use CentOS is definitely a plus. A small downside is that CentOS has less tutorials and tends to be difficult to use for beginners.

Anyways are you cheaper than a college student pirating textbooks? Fear not! The $5 node aka “The vultr shitty” is something for you.

Deploy it. If you have some Linux experience, I’d recommend to use SSH keys. Deployment will take some minutes. This is the perfect moment to grab some coffee for yourself… even better might be bleach.

(I’ve never seen that $2.50 node available.)

When your node is ready, you can make an ssh connection to it. Windows users should use Putty to make an SSH connection to their server. https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.70-installer.msi If you are a Linux user, I expect you know how to ssh into your machine.

$ ssh root@ip-addr-here

update machine

To update your machine in CentOS, we don’t use apt-get update like we do in Ubuntu. We use “yum” instead as package manager.

# su -c 'yum update' -y

The yum package supplied with CentOS includes scripts to perform full system updates every day. To activate automatic daily updates, enter this command:

# su -c '/sbin/chkconfig --level 345 yum on; /sbin/service yum start'

Zcoin binaries

It’s time to get the binaries. I often see people and even developers compiling from source on their servers. We don’t compile on our servers. Compiling from source costs time and requires us to install extra things like libboost, libssl, libdb etc. There’s a faster and more reliable way. We can use the binaries availble on github. We can use wget to get those.

# wget https://github.com/zcoinofficial/zcoin/releases/download/0.13.6.6/zcoin-0.13.6.6-linux64.tar.gz

Now we have the tar file. You can compare it to a .zip or .rar file. We can extract it by using the command

# tar -xvzf zcoin-0.13.6.6-linux64.tar.gz

Now we can copy the binaries (so we don’t have to cd into folders).

# cd zcoin-0.13.6/bin/
# sudo cp -f zcoind /usr/bin/zcoind
# sudo cp -f zcoin-cli /usr/bin/zcoin-cli

The purpose of creating a swap is to provide disk storage to the kernel when RAM is under pressure. It allows for the kernel to move memory pages that are not likely to be accessed soon to disk, freeing memory. Our server has only 1GB RAM, it’s not a lot so that is why we need a swap for sure. The downside of swapping is that disks are slow. RAM is magnitudes faster. However using a swap can be the difference of your server crashing because it doesn’t have enough RAM or staying online.

Let’s create a Swap file. The fastest way is by using fallocate. We will use a 4GB swap (There’s no perfect number).

# sudo fallocate -l 4G /swapfile

We should adjust the permission on the swap file so that it is not readable by anone besides root. We can use chmod to lock down permissions.

# sudo chmod 600 /swapfile

Now the swap file is created, the system should format this file as a swap & enable it.

# sudo mkswap /swapfile# sudo swapon /swapfile

Now we have to make the swapfile permanent. So we still have it when the system reboots.

# echo “/swapfile swap swap sw 0 0” >> /etc/fstab

Swapiness

Now we can do some tweaking. Swapiness param determines how often the system swaps datta out of memory to the swap. This value is between 0 & 100% (The percentage of memory that will trigger the use of swap). Lets change this to 10.

# sudo sysctl vm.swappiness=10

and to make it pernament

# echo “vm.swappiness = 10” >> /etc/sysctl.conf

Might as well check the status of SELinux

 # getenforce

If you get Permissive or disabled it's fine, you probably won't run into problems. If it says Enforced, for the sake of simplicity... turn it to Permissive or disable it.

More info here: https://wiki.gentoo.org/wiki/SELinux/Tutorials/Permissive_versus_enforcing

You should easily get it disabled by reading the gentoo wiki or by googling it. If you can’t figure it out…. you might have a learning disorder anon ! However SELinux might be worth learning.

Having it on Enforced would be safe (But we are using root for this demo, so don’t because SELinux won’t allow you to login)… This one time I had an internship at a dutch cloud company when I was 18 and I … got REKT by this mistake. Also if you ever try to use grsecurity enhanced Linux kernel, delete your old one…. anyways continuing on

Computer/Laptop side

So in this part, stop using the server. It’s time to use your Zcoin wallet which is installed locally on your pc or laptop

(NOT YOUR MASTERNODE/ZNODE/SERVER).

Now I assume you use the Gui/QT/Graphical Zcoin wallet. Hit on the tab receive.

As Label: Znode01

Amount: 1000

Message: Znode setup

Hit Request payment. Write down your zcoin public address. The address starts with an "a".
Now deposit EXACTLY 1000 Zcoins to your Zcoin public address.
NOTE: If you transfer funds from bittrex, send 1000.02 Zcoins to the address. This is because Bittrex deducts fee from the transer.

Do not screw this up. Double check that the address starting with "a" is yours or you will lose that 1000 XZC

Wait for 7 confirmations.
Now go to Help > Debug window > console
Use the command znode genkey

It will generate an address starting with "8". This is your Znode genkey !
Paste it in a text editor/save it.

If you got the requires confirmations you can type in your console znode outputs and you will get somehting like this

{
"7SomeRandomLongAssStringHere" : "0"
}

That 0 can be a 1 in some cases.

On Windows this is located at %appdata%/zcoin (type this in Windows Explorer). In Mac, this is in (Lol nobody cares about Mac users) and in Linux it’s typically in your $ ~/.zcoin folder.

now open znode.conf That file is filled with an example

The # means that it is commented out. Your wallet won't read that. Anyways grab your znode genkey (That address which starts with "8")

make tour znode.conf file on your laptop/pc look like this

Now save it & restart your wallet. If your wallet starts up again, it's fine. If not, you probably fucked up some port in the znode.conf file. Btw on the end of the line, notice the 0. If it was 1 in your case, change it to 1.

Znode/Masternode zcoin.conf configuration

Now I assume you have some basic Linux skills. Install your favorite editor Vim or if you are a peasant, install nano

Vim: yum install vim

Nano: yum install nano

Now for this example I will use nano because I don’t want to hear “Romano pls halp, I don’t know how to close vim.”

# nano znode.sh

and paste this in

echo "Enter your znode genkey (starts with 8): "
read genkey
sudo mv .zcoin/zcoin.conf .zcoin/zcoin.bak
touch .zcoin/zcoin.conf
IP=$(curl http://checkip.amazonaws.com/)
PW=$(date +%s | sha256sum | base64 | head -c 32 ;)
echo "==========================================================="
pwd
echo "daemon=1" > .zcoin/zcoin.conf
echo "rpcuser=zcoinrpc">> .zcoin/zcoin.conf
echo "rpcpassword="$PW >> .zcoin/zcoin.conf
echo "rpcallowip=127.0.0.1" >> .zcoin/zcoin.conf
echo "listen=1" >> .zcoin/zcoin.conf
echo "server=1" >>.zcoin/zcoin.conf
echo "externalip=$IP:8168" >>.zcoin/zcoin.conf
echo "logtimestamps=1" >> .zcoin/zcoin.conf
echo "maxconnections=64" >> .zcoin/zcoin.conf
echo "txindex=1" >> .zcoin/zcoin.conf
echo "znode=1" >>.zcoin/zcoin.conf
echo "znodeprivkey="$genkey >>.zcoin/zcoin.conf
#Start Zcoind to begin sync
zcoind

and save it. Now use this command

# sh znode.sh This will copy the right configuration into your ~/zcoin/zcoin.conf file and starts zcoind up.
Now you have to wait for zcoind to totally sync on your server.

You can check this with the command # zcoin-cli getblocktemplate

it tells you if it is still downloading, if it’s ready, you get a result.

When it is, restart your wallet you have running on your own pc/laptop/locally and go to the Znodes tab if the wallet is done loading. your Znode should appear.

Now there’s one thing left undone. Press on the button Start all

Start all

The status should say ENABLED with the payee your Zcoin address starting with "a".

Znode is running

Extra — — —

Fail2ban

Now maybe it will happen that a hacker hacks/powns your masternode. He can’t steal your funds but he can disable/shutdown your masternode or whatever. Well you don’t want your Server/masternode to be hacked.

fail2ban might help. Fail2ban scans log files for patterns and repeated attempts (unsuccessful SSH authentication attempts). When detected, fail2ban automatically creates a firewall or TCP wrapper drop or deny rule to esnure the service availability is not jeopardized.

To install fail2ban and activate

# sudo yum install epel-release

# sudo yum install fail2ban -y

and we need to enable it for ssh.

nano /etc/fail2ban/jail.conf

and uncomment the bantime=3600 and #sshd enabled = true

# sudo systemctl enable fail2ban

# sudo systemctl restart fail2ban

If you want more security https://highon.coffee/blog/security-harden-centos-7/

or if you are really interested, it might be useful to buy a book: https://www.amazon.com/CentOS-Linux-Server-Cookbook-Second/dp/1785887289/ref=sr_1_4?ie=UTF8&qid=1513813720&sr=8-4&keywords=centos

Important

Go to Help > debug window and use the command: dumpprivkey “Your zcoin a-address”

It will shit out your private key. Print this out and store it in a safe place (not online but somewhere in a safe/locker). Anyone who has your private key can steal your funds.

After that:

Encrypt your Zcoin wallet on your pc/laptop.

Go to Settings > Encrypt Wallet.

And don’t forget your password or your funds will be lost. Encrypting is important because if some gets access to your pc (with malware, RAT or just physically) he can’t steal your funds because there’s a password on it. (Use a strong password)

Another thing, on the server we worked from root. This is not the best practice but I did it for simplicity. Well the challenge for you might be to try making your own user account on your VPS & configure everything.

I hope you learning something and if you have any questions, do not DM/PM me. Ask someone else first (And don’t give them your private key).

--

--

Romano RNR

Derivatives trading, investing, cryptocurrency, stocks, forex, options & volatility - programmer & sysadmin