First of all, install/sync the Zcoin wallet on your own PC/Laptop.
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. https://www.vultr.com/?ref=6955361
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 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
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'
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/v0.13.4.2/zcoin-qt-0.13.4.2-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 zxf zcoin-qt-0.13.4.2-linux64.tar.gz
Now we can copy the binaries (so we don't have to cd into folders).
# cp -f zcoin-0.13.4/bin/zcoind /usr/bin/zcoind
# cp -f zcoin-0.13.4/bin/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
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 !
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 XZCWait 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
# Znode config file
# Format: alias IP:port znode_privatekey collateral_output_txid collateral_output_index
# Example: zn1 127.0.0.1:8168 7Cqyr4U7GU7qVo5TE1nrfA8XPVqh7GXBuEBPYzaWxEhiRRDLZ5c 2bcd3c84c84f87eaa86e4e56834c92927a07f9e18718810b92e0d0324456a67c 1
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
# Znode config file
# Format: alias IP:port znode_privatekey collateral_output_txid collateral_output_index
# Example: zn1 127.0.0.1:8168 7Cqyr4U7GU7qVo5TE1nrfA8XPVqh7GXBuEBPYzaWxEhiRRDLZ5c 2bcd3c84c84f87eaa86e4e56834c92927a07f9e18718810b92e0d0324456a67c 1
znode01 your-vultr-shitty-node-ip-here:8168 8YourZnodeGenKeyHere 7YouKnowThatRandomLongAssStringHere 0
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.
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
The status should say ENABLED
with the payee your Zcoin address starting with "a".
#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