How to set up a ZenCash Secure node using Docker (Easy)

In this guide I am going to show you how to easily set up a ZenCash secure node using Docker, which automates most of the process, meaning very little code. Seriously you can do this!

ZenCash is a secure and private Cryptocurrency that uses secure nodes to allow encrypted communication between other nodes and wallets. To run a secure node you must have 42 Zen in a swing wallet (Full wallet), 1 Zen to send to the node (43 Zen total), a domain name and a Linux VPS. As a reward for operating a secure node, you get a portion of the 3.5% mining reward. Basically, you get paid to hold Zen, similar to a Dash master node but at a fraction of the price.

 

Step 1. Download and Sync Zencash Swing wallet

You need a wallet that will support the private send features of Zen, which at this point is only the Swing wallet (Please correct me if I am wrong). Once you download this you need to let it sync the blockchain, this will take a while, so you can skip forward to step 2.

Download Zen Swing For Windows, Mac OS and Linux

Step 2. Buy Zencash or mine Zencash

You need atleast 43 Zen to set up a secure node, you can get this by mining it or buying it on an exchange.  Once your Swing wallet is synced you can send it to an address on there.

Step 3. Buy a domain or use an existing domain

To operate a secure node you need to control a domain. You can either buy and new one or if you already own a domain you can simply set up a new subdomain to use for this. Check out my article on how to buy domains with bitcoin for more information.

Step 4. Buy a Linux VPS

The docker builds we will be using needs Ubuntu 16.04 with 4GB ram (2GB ram / 2GB swap works as well) and approx 10GB hard drive. In the past, I have used OVH SSD2 which are about $10 CAD/month. However, with this build, I am attempting to keep my costs only in crypto so I will be using RamNode 2GB KVM which is currently $10 USD/month. This VPS only has 2GB of RAM so we will need to configure some swap memory. If you are new to Linux I do not recommend you start with a build that needs a swap file change. Depending on the provider they can be tricky

**Important** OpenVZ does not allow the creation of swap files. If you use an OpenVZ VPS it needs to have 4GB of ram

***OMG Important update again*** I am switching off of Ramnode back to the OVH SSD2 – The RamNode ones was just not perfoming fast enough to pass challenges***

Once you select the location you need to set a hostname which can just be a subdomain of the domain you bought in step 3 and set the operations system to Ubuntu 16.04 64-bit

Hostname = {subdomain}.{yourdomain}

Operating system = Ubuntu 16.04 64-bit

After this complete your account information and make a payment over a credit card, paypal or Bitcoin.

Once the order is complete you should get a confirmation email with the login details. The main pieces of information you need are the IP address, username, hostname and password

 

Step 5. Point your subdomain

Now that you have the IP address of your VPS you can configure your subdomain to point at it. You set up subdomains wherever the DNS is set, usually the place you purchased the domain. Just google “How to set up a subdomain on {godaddy|namecheap|ect}”. Once you find out how to add a subdomain you need to add an “A” record. With Epik the process of adding a subdomain and adding an A record are combined which is very convenient.

The subdomain can be whatever you want and you set the A record to point to the IP address of your VPS. As you can see in the screenshot you do not need a unique domain for a secure node, if you plan on operating more than one simple add more subdomains.

 

Step 6. Login to the VPS

To set up the VPS you need to be able to login via SSH, for windows you can download Putty Once its downloaded the simplest way to login to your VPS is to make a shortcut that will automatically log in.

  1. Create a shortcut on the desktop to putty.exe
  2. Rename the shortcut to {subdomain}.{yourdomain} or your choice
  3. Right-click shortcut and choose Properties
  4. Modify the target similar to: “C:\Program Files\PuTTY\putty.exe” {username usually root}@{subdomain}.{yourdomain}-pw {password}
    Click OK

If this is not working you can just log in by opening putty, entering the hostname or IP and manually entering the username and password into the terminal.

 

Step 7. Configure the Swap File (optional and Advanced)

As I mentioned earlier this Docker build recommends 4GB of RAM but in my case, I only have 2 GB. To adjust for this we need to configure some swap memory.

Swap memory can be a bit tricky to configure as some VPS providers block or limit its use to prevent abuse. The steps below should work.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Make the swap come back on after a reboot:

sudo su -
cat <<EOF >> /etc/fstab
/swapfile none swap sw 0 0
EOF
exit

Make the swap work better by making the server wait until memory is 90% used before using the hard drive as memory:

sudo su -
cat <<EOF >> /etc/sysctl.conf
vm.swappiness=10
EOF
exit

You can then check the memory on your VPS with the following

free -h
df -h

Step 8. Docker Install

Ok home stretch now, I promise. We are going to be using the Docker Zen node build from the awesomely named WhenLamboMoon. You should make a text file with these commands saved as they really help when fixing any issues.

 

You need to run the following commands in Putty

curl -O https://raw.githubusercontent.com/WhenLamboMoon/docker-zen-node/master/install.sh
chmod +x install.sh
./install.sh {Stake Address} {email} {hostname} {region}

the { } fields are placeholders

{Stake Address} = This is the address on your swing wallet that holds 42 Zen

{email} = The email you want downtime notices to go to

{hostname} = The subdomain.domain combination you registered in Step 3

{region} = The region of the server choose to be eu for Europe and na for North America

Example

curl -O https://raw.githubusercontent.com/WhenLamboMoon/docker-zen-node/master/install.sh
chmod +x install.sh
./install.sh znTB3vopbrHPj3SAdfgfgfgTZky3UMD [email protected] [email protected] na

It should start installing all the packages and end up with a output like

## Generating shield address for node...

ztSpgr2Yat7zSMiLNHtyDKGajzSesxabQsRwJnqtomDJU9wd6LzZppnQJyYiNE8sJDEy5MyTiMrSjf3bWcMKgtF9xcEY4eA

The install will take a few minutes and you may have to repeat the last install command if it runs into an error.

The Docker side is basically done, your node now needs to download the whole blockchain which can take about 24 hours.

Step 9. Sending Zen to your Node

Now you need to send 4 separate transactions of 0.25 Zen to your node shield address, these are the only funds that actually sit on the node. You need to send these funds from a Swing wallet or another wallet which supports private sends.

Step 10. Hurry up and wait

The VPS is now downloading the entire blockchain and this process will take time, approximately 24 hours.

 

Troubleshooting and Notes

Take a look at the following resources if you have any issues

Docker Zen Node on Github

Zencash Node overview

If you look at your node 24 hours later and it doesn’t seem to be up on the Zencash tracker try the following commands.

docker exec zen-node gosu user zen-cli getinfo

What your looking for here is the “blocks”: ####, you can compare that with the current block on a https://explorer.zen-solutions.io/block chain explorer. If the heights do not match the node is still syncing.

 

How to Move Zen Off your Node

Because of my Ramnode debacle, I need to transfer funds from my existing Ramnode node to my new OVH node. But how?

Here are the instructions from Github

Moving/removing nodes

If you want to move the ZEN off the node you need to run the following commands:

# Get your T_ADDR
docker exec -it zen-node gosu user zen-cli z_listaddresses

# Get the balance of your T_ADDR
docker exec -it zen-node gosu user zen-cli z_getbalance T_ADDR

# Send the balance to another address
docker exec zen-node gosu user zen-cl i z_sendmany "T_ADDR" "[{\"amount\": 0.00, \"address\": \"TO_ZEN_ADDR\"}]"

Remember to deduct the 0.0001 fee from your balance if you wish to empty the entire balance.

I found these instructions a bit confusing, basically, the most important command is the last one.

docker exec zen-node gosu user zen-cl i z_sendmany "T_ADDR" "[{\"amount\": 0.00, \"address\": \"TO_ZEN_ADDR\"}]"

T_ADDR = Address on the node with the balance.

0.00 = The total you want to send off the node

TO_ZEN_ADDR = The Address you want to send to. It is important to note that you can’t send this directly to another node. It must be a Public address (eg like a staking address)

Leave a Reply

Your email address will not be published. Required fields are marked *