DigitalOcean Droplets are Linux-based virtual machines (VMs). They run on top of virtualized hardware. Each Droplet that you create is a new server you can use, either standalone or as used as part of a larger, cloud-based infrastructure. We will be setting one up as a HYDRA staking node/wallet. This same method may be used with other VPS providers.
To access the DigitalOcean Control Panel and create a Droplet, you need a DigitalOcean account. You can create one from the DigitalOcean new account registration page if you don't already have one.
After you log in to the control panel, let's set up some of the security for our VPS. We will create our droplet and then resume the Firewall setup.
It is highly recommended to enable 2FA with Google Authenticator as well as use the SMS backup method. You can find in depth instructions here: https://www.digitalocean.com/docs/accounts/security/2fa/
We will begin by creating and importing SSH keys for logging into our HYDRA node. Please follow THIS guide to create and import SSH keys created specifically for DigitalOcean:
After you log in to the control panel, click the green Create button in the top right or click Droplets on the left panel and clicking 'Create droplet' to open the create menu.
In the create menu, click Droplets to open the Droplet create page. If you don't have any Droplets, the Resources tab displays a large, blue Get Started with a Droplet button, which takes you to the same Droplet create page.
The Droplet create page is where you choose your Droplet's configuration, like its operating system, how much memory it has, and which features to enable (like backups and monitoring). The most popular defaults are pre-selected, so you can scroll to the bottom of the page and create a Droplet immediately, or you can customize any of the options in each section.
Choose the price plan that works for you. Users have been successful staking with the minimum sized droplet (currently listed under 'Basic' plan $5/month 1GB Ram, 1 CPU 25 GB SSD, 1000 GB transfer) however it is recommended to use the higher tier $20/month option if it is within your budget, since the performance will be far more stable using the added memory as well as faster transfer speeds which may be needed down the road as the HYDRA blockchain grows).
For this guide we will be using version Ubuntu 20.04(LTS) x64 Basic plan for $5/month. Scrolling further down in droplet creation there is the option to choose your datacenter region. This depends on your own personal preference as each area should be similar in stability.
Under authentication it is recommended to select the SSH keys that we have set up earlier. If you have created more than one key you can select them all for use.
Finally click 'Create droplet' to complete the droplet creation. You have the option to select creating system backups if you require it at an extra fee.
Initialization will take a about a minute. Afterwards you will see your new droplet as well as its IP address you will connect to it with. Please take note of the IP address. The address will generally not change and it will be your way of accessing the droplet.
We'll Continue with our security setup by enabling some custom rules for our Firewall. We'll need to set up the Firewall and allow port TCP/3338 for the node connectivity, as well as allowing Network Time protocol (NTP) to sync the time accurately on port UDP/123. Lastly we will allow port TCP/22 for logging in over SSH using our previously created keys. On the left panel under 'MANAGE' click on 'Networking' and then click 'Firewalls' and then click 'Create Firewall'
Give the new firewall rule a name. We will be adding TCP port 3338 and TCP port 22 as well as UDP port 123 for the network time protocol sync service under Inbound Rules.
Under Type enter SSH and under Protocol enter TCP For Port Range enter 22 as in image below. In the New Rule box add a custom and allow port 3338 by setting to Custom Under Type and under Protocol enter TCP and For Port Range enter 3338. In a second New Rule box add another custom rule and allow port 123 by setting to Custom Under Type and under Protocol enter UDP and For Port Range enter 123.
Below this section under 'Apply to Droplets' you can search for your droplets name (usually it will show your list of droplets by typing in 'ubuntu' and then you can select it clicking on it). Apply the firewall rules to the specific droplet and then click create firewall.
You can now log into the VPS with Putty as well as use WinSCP to access files and upload/download your wallet.dat as needed.
You can download Putty from their official site here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Here is a quick guide to configuring putty. By default the username for your droplet will be root and you will not need a password unless you have set one with your SSH keys setup earlier. If you have already set up your SSH keys you can scroll to 'Configuring Putty' for quick reference on configuring your droplet for access: https://www.bluehost.com/help/article/using-ssh-on-windows-putty
Accessing your server with MobaXterm
We highly recommend MobaXterm as an SSH client. It's just a quantum leap ahead of default Putty and solves lots of issues (e.g copy/paste and or support for multi tab Linux apps such as byobu). Such issues arise often when using SSH with windows and can be really frustrating for new users.
Below is a quick guide to connecting to your droplet using MobaXterm as an alternative to using Putty:
MobaXterm can be downloaded from their official site HERE: https://mobaxterm.mobatek.net/download.html
After installation the MobaXterm program will be in your Windows start menu and can be found by pressing the Windows button and typing 'MobaXterm'. On first initialization you will be prompted to allow the program through the firewall, you can safely click yes and ok to allow it through public networks.
Once the program has started we will click 'Session' and then select 'SSH'
Enter the IP address of your droplet in 'Remote Host' box and then click 'Advanced SSH settings'
Check the box 'Use private key' and select your private key (with .ppk extension) that you have generated earlier. Then click 'Open' and then press 'OK'.
You can now continue with enabling the internal firewall and the installation of the HYDRA wallet below. The next time you start MobaXterm your server will be accessible by simply selecting its IP from the left panel. To learn more about further capabilities such as copying and downloading files as well as Xserver display access, please read the MobaXterm documentation here: https://mobaxterm.mobatek.net/documentation.html#5_1_1
We will enable UFW (Uncomplicated Firewall) and allow ports TCP 22, UDP 123 and TCP 3338. If you have been successful in connecting to your droplet through SSH then you should be looking at a terminal screen. Firstly we will add some rules to the UFW firewall and then enable it. Allow connections to ports 22, 123 and 3338:
Enter these commands on separate lines:
ufw allow 22/tcpufw allow 3338/tcpufw allow 123/udp
Enable the firewall with this command:
If you have previously generated a wallet.dat file and wish to use it you can place it in /root/.hydra/wallets/ You will need to create this directory if this is a new installation. If you are importing your wallet from a private key this step is not necessary. Please read documentation about SCP file transfer in MobaXterm: https://mobaxterm.mobatek.net/documentation.html#5_1_1 or by using WinSCP: https://winscp.net/eng/docs/guides if you wish to upload or download files such as your wallet.dat later using a file explorer. It is highly recommended that you ensure backups of wallet.dat are made and are stored in a safe location).
The latest build updates can be found at https://github.com/Hydra-Chain/node/releases We will be using an install script here to speed up the installation process. The script is made for Ubuntu 20.04 however other Operating Systems and their scripts are available HERE If you run into any problems or wish to manually install, you can follow the guide from here: https://hydrachain.org/guide-for-linux
To use the script for Ubuntu 20.04 begin with the following two commands first to update the system.
sudo apt update
Answer yes when required (updating first and separately from the script will help avoid an issue with promps for ssh configuration settings where menu is inactive):
sudo apt upgrade
If any dialogs come up requesting changes to locally modified settings choose "keep the local version" or press enter for the default choice.
When the update completes paste this command to initialize the script:
wget -O - https://raw.githubusercontent.com/meshungina/hydra/main/install-run-gui-wallet.20.04.sh | bash
After several minutes the script should conclude copying all files and setting up directories and start up the node. The node will take some time to sync to the latest block.
If you run in to any errors you can try manually updating (remember to enter
y and enter to continue if requested):
sudo apt upgrade -y
After successful setup the node will continue to run even after you log out from the shell, providing that the server is not shut down or restarted. If you restart the server you can start up the node again by navigating to
~/Hydra/bin/ and typing
./hydrad -daemon - this will initialize the daemon with which you can use the cli to send commands; for example If you have already created a wallet and have the private keys you can import them with:
./hydra-cli importprivkey <key> You can enable staking as well as perform different types of transactions and chain commands. Please see more information and full documentation of the available commands HERE.
To see information about your running node you can navigate to
~/Hydra/bin with command:
cd ~/Hydra/bin and then enter
./hydra-cli getinfo here you can see which block you are currently synced to as well as wallet version, connections, balances. For information about staking status and more please see HERE for full documentation of wallet commands.
At this point your wallet is hopefully running and set up to start staking. The wallet.dat and blockchain date is stored in
/home/username/.hydra/ depending on your setup. It is recommended to lock your wallet with a passphrase from the
./hydra-cli encryptwallet [yourpassphrase]
We can unlock only for staking when it is left running on any system or VPS:
./hydra-cli walletpassphrase [yourpassword] 9999999 true
If you lock the wallet you will then need to enter the passphrase to use the wallet to send out transactions. The following command unlocks for five minutes:
./hydra-cli walletpassphrase [yourpassphrase] 300
You can view your Coin balance and amount currently staked with the following command:
This is slightly involved, first we'll need to find out the HEX equivalent of our address. We can do this through the cli with this command:
./hydra-cli gethexaddress <YOURADDRESS>
We can then call the contract with the "getbalance" identifier appended, which is
70a08231and replacing the last part
<YOURHEXADDRESS> with your own hex address here:
./hydra-cli callcontract 4ab26aaa1803daa638910d71075c06386e391147 70a08231000000000000000000000000<YOURHEXADDRESS> | grep -e "output"
Finally convert the "output" section of the response from hex to decimal to arrive at your LOC balance.
Below is a full example:
To see expected time enter the following command:
Note below the section "expectedtime".
The "expectedtime" can be converted to human readable format using the following command (replace
1254588 with your expectedtime value:
date -u -d "@1254588" "+Estimated time to mine next block in: %d days %H hours %M minutes"
For further instructions on operating the node and unlocking the wallet for staking, please see the documentation here: https://hydrachain.org/essentials/hydra-wallet-commands
If your node is running and staking and you have imported the keys where your HYDRA coins are stored, you may now choose to delete the SSH rule from the digital ocean firewall section and add it back at a later time when you wish to access the Droplet again - This will add an extra layer of security as there is no way for anyone to access your server without two factor authentication with DigitalOcean and manually reopening the port.
You can visit explorer.hydrachain.org to check on the staking status of your node by searching for your address and seeing how many blocks have been mined as well as your balances and transactions. Good luck staking!