In the dynamic realm of cryptocurrency, Horizen has emerged as a promising player, offering a robust blockchain platform that prioritizes privacy and scalability. If you are keen on maximizing your involvement with Horizen and earning rewards in the process, learning how to set up Horizen Staking on a VPS (Virtual Private Server) could be the game-changer you are looking for.
This article is about a Horizen Node on the Main Chain!
In this guide, we will walk you through the step-by-step process of setting up Horizen staking on a VPS from Contabo, empowering you to take control of your crypto journey. Beyond the technical intricacies, the choice of your VPS provider can significantly impact the smoothness of this task.
Why choose Contabo?
Contabo takes center stage in our journey due to its noteworthy contributions to the Horizen staking ecosystem. Hosting over 16,000 nodes, Contabo proudly holds the title of being the largest Horizen-Node host, reflecting the community’s trust in its services.
Established Reliability
When it comes to uptime, Contabo sets an impressive standard. With a remarkable 99.996% uptime over the last 12 months, Contabo ensures that your staking node remains operational, maximizing your potential rewards.
Tailored Cut for Horizen
What sets Contabo apart is its commitment to optimizing the staking experience. Offering custom-made configurations specifically designed for Horizen Node hosting, Contabo ensures that your setup is not only seamless but also attuned to the unique requirements of the Horizen network.
As we guide you through the Horizen staking setup on a VPS, keep in mind these significant attributes that make Contabo the preferred choice for enthusiasts venturing into the world of staking. Let us leverage these advantages to make your staking journey with Horizen both efficient and rewarding.
Setting up a Horizen Node with Cloud-Init
Contabo streamlines the setup of your Horizen node by employing Cloud-Init scripts, a robust tool available in the Customer Control Panel. These scripts offer an efficient and automated method for installing nodes, removing the requirement for manual configuration.
Step 1: Accessing the Customer Control Panel
Log in to the Customer Control Panel with your Contabo account and navigate to VPS Control
Step 2: Enable Cloud-Init for your VPS
Cloud-Init is disabled by default – you can enable it in the VPS control section for the corresponding server by flicking the dedicated toggle:
Step 3: Selecting the Horizen-Node Cloud-Init Script
Now, to set up your server with the Horizen-Node Cloud-Init Script, click on “Reinstall” in the VPS control section.
Then, click on “Reinstall” and select “Advanced/Custom Image Installation” in the next menu:
You should select Ubuntu 22.04 (LTS) to ensure full compatibility.
Also, be sure to enable the Root user by flicking the switch!
Now, fill in all the required things and select the “Horizen Node” script in the “Cloud-Init” section.
The full Cloud-Init script can be checked, so you can have a look at what commands will be executed:
If you want to learn more about Cloud-Init, how it works, and how the script is built, check out our dedicated article “What is Cloud-Init and Why is it so Cool?”
To complete the configuration, simply select ‘Install.’ Now, relax as Contabo’s system takes charge, automating the installation process for your Horizen node and sparing you valuable time and effort.
This user-friendly method for setting up nodes on Contabo’s VPS caters to both novices and seasoned users, ensuring accessibility for anyone keen on contributing to the Horizen network.
Setting up Your Node for Staking
In this crucial chapter, we will guide you through the process of configuring your Horizen Node for optimal staking performance on Contabo’s VPS. Ensure you follow each step diligently to seamlessly contribute to the Horizen network.
Execute the following commands as a root user (or a user with sudo privileges).
Not sure if you are the root? Then check out our Practical Guide to Superuser Accounts, sudo & root.
Disable Apache to Avoid Port Conflicts
The following command prevents port conflicts by turning off Apache service
sudo systemctl disable apache2
Now, let us stop the currently running Apache service
sudo systemctl stop apache2
Install SSL Certificate with Certbot
sudo certbot certonly --preferred-chain "ISRG Root X1" --key-type rsa -n --agree-tos --register-unsafely-without-email --standalone -d $FQDN
This command installs obtaining SSL certificates, securing your staking node’s communication.
Setting Up Certificates for Horizen Node
Let us assign the ownership to Horizen user for SSL certificates with this command:
sudo chown -R horizen:horizen /etc/letsencrypt/
Here we will set secure permissions for SSL certificates:
sudo chmod -R 750 /etc/letsencrypt/
This command updates the certificate authorities for SSL:
sudo csplit -s -z -f /usr/local/share/ca-certificates/intermediate-cert- /etc/letsencrypt/live/$FQDN/chain.pem '/-----BEGIN CERTIFICATE-----/' '{*}' --suffix-format='%02d.crt'
sudo update-ca-certificates --fresh
Write out the Certificates to the Config File
echo "tlscertpath=/etc/letsencrypt/live/$FQDN/cert.pem" >> /home/horizen/.zen/zen.conf
echo "tlskeypath=/etc/letsencrypt/live/$FQDN/privkey.pem" >> /home/horizen/.zen/zen.conf
export IPV4=$(ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
echo "externalip=$IPV4" >> /home/horizen/.zen/zen.conf
echo "port=9033" >> /home/horizen/.zen/zen.conf
Restarting the Zen Node
This step should be executed by the horizen user, then switch back to the root user to finish the setup. To switch to the horizen user, use the following command:
su horizen
Now let us stop the Zen Node, wait for 60 seconds, and then restart it with this long command:
zen-cli stop && sleep 60 && zend && sleep 30 # Stops Zen node, waits, and then restarts it
If you wish to explore more about this step, check out the official Contabo Docs for Horizen Node.
Following these steps ensures your Horizen Node is set up for staking, equipped with SSL certificates for secure communication. The restart concludes the process, bringing your staking node online.
Install Node Tracker
In this chapter, we will guide you through installing and setting up Node Tracker—an essential application for managing your staking activities.
Execute the following commands as a root user (or a user with sudo privileges).
Install Dependencies
Update the package information:
sudo apt-get update
Now, install necessary dependencies:
sudo apt-get install -y ca-certificates curl gnupg
Create a directory for keyrings:
sudo mkdir -p /etc/apt/keyrings
Add the Nodesource GPG key:
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=18
Add the Nodesource repository:
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
Update the package information with the new repository:
sudo apt-get update
And install Node.js:
sudo apt-get install nodejs -y
Clone Node Tracker Repository
Clone the Node Tracker repository
cd ~/ && git clone https://github.com/HorizenOfficial/nodetracker.git
Now, navigates to the Node Tracker directory
cd nodetracker
Setup Node Tracker
In this step, let us configure the Node Tracker:
ZENCONF=/home/horizen/.zen/zen.conf ZEN_HOME=/home/horizen/.zen/zen.conf node setup.js
Start Node Tracker (for Testing)
Initiate the Node Tracker for testing:
ZENCONF=/home/horizen/.zen/zen.conf ZEN_HOME=/home/horizen/.zen/zen.conf node app.js
Start Node Tracker with PM2 for Auto-Restart
This command installs PM2 globally:
npm install pm2@latest –g
Now, start the Node Tracker with PM2
ZENCONF=/home/horizen/.zen/zen.conf ZEN_HOME=/home/horizen/.zen/zen.conf pm2 start app.js --name nodetracker
Read Logs of Node Tracker
To retrieve and display logs for the Node Tracker use this command:
pm2 logs nodetracker
Node Tracker is now installed, configured, and ready to manage your staking activities. Utilize PM2 for auto-restart and monitor logs for insights into Node Tracker’s performance. Congratulations on completing the setup for Horizen staking on Contabo’s VPS!