[HOWTO] Setting up a Local/Remote STRAKS Masternode (Ubuntu/Raspberry Pi)


#1

Notes:

  1. System - Local : Windows
  2. System - Remote : Ubuntu Server 16.04 or Raspberry Pi 2 with Raspbian Stretch Lite
  3. You MUST use STRAKS core release v1.14.6.2 or later
  4. The wallet and the MN daemon MUST be the same version.
  5. Created using testnet. Your mainnet Masternode addresses should start with a “S”

This tutorial will guide you through the steps necessary to setup a STRAKS Masternode on a Ubuntu 16.04 or Raspberry Pi 2 remote server that is controlled via your local wallet. This is the most secure way of configuring a masternode as the 15,000 STAK collateral resides in your local wallet and not within the remote masternode. Your local wallet is not required to be kept open and you can store it as a cold wallet whilst still collecting masternode payments. Whilst there are other ways to setup masternodes, this is by far the most secure and is highly recommended.

Part A - Install and Setup Local STRAKS Qt Wallet (Windows)

Step 1 - Download STRAKS wallet

Download the most recent version of the STRAKS Qt wallet from https://github.com/straks/straks/releases/latest.

Step 2 - Extract and install

Extract and run the wallet. When presented with the default data directory dialog, record the directory that you select. The default directory will be similar to C:\Users\your_username\AppData\Roaming\straks. If you choose your own location ensure that you record where that is.

Allow the wallet to fully sync with the STRAKS network.

Step 3 - Create masternode public address

Depending on the number of masternodes you will be running, you will want to create a unique receiving address for each. A receiving address can be created with the wallet by selecting File -> Receiving addresses.... When the Receiving addresses dialog appears, select New and label your new masternode address appropriately. Create a new address for each masternode that you intend to run.

Step 4 - Generate masternode key

Each masternode also has a unique masternode key. This key is generated by the local wallet, however it is placed in the remote nodes configuration file to identify the masternode as your own. The key does not allow any access to collateral or coins earned so it is not a security concern but best practice is to keep it private.

To generate masternode keys, select Help -> Debug Window and then select the Console tab. In the scratch-pad type masternode genkey in order to generate a unique masternode key. Run this command multiple times if you are intending to run multiple masternodes. You can come back and run this command at any time should you require additional keys.

In the picture above, two masternode keys have been generated. Record these for later use.

Masternode 1 key: 92pVpovVYNUJvkorQFDfCzxaKAB3wnzoJCcqYbPvHjSFbfWLiq9
Masternode 2 key: 93LqM7TK5NfJHhipRqMJf2BAN5aQ3Wr9X2SaJ1H1aY9U6S39rbT

Step 5 - Transfer 15,000 STAK to each masternode public address

To allow your remote masternode to start you need to send 15,000 STAK to each masternode address - in your local wallet, as generated in Part A, Step 3 - that you intend to operate. The transaction needs to be EXACTLY 15,000 STAK. It CANNOT be 15,001 STAK. It CANNOT be 14,999.9998. When you make this transaction, ensure that you factor in fees. The windows wallet will show you the total amount being deposited so ensure this reads EXACTLY 15,000 STAK. Just to reiterate, you need to send EXACTLY 15,000 STAK in a SINGLE TRANSACTION to each masternode address that you intend to operate.

Step 6 - Record the transaction and output ID

The transaction and output ID from the deposit you made into your masternode public address will need to be added to the masternode configuration file later on. Fetching this information now will make things a bit easier when we reach that stage.

To get the transaction and output ID, go to Help -> Debug Window and then select the Console tab. In the scratch-pad type masternode outputs and the transaction and output ID will be displayed. If there is no output, you have probably misread Part A, Step 5 of this tutorial. Record these details for later use.

Masternode 1 key: 92pVpovVYNUJvkorQFDfCzxaKAB3wnzoJCcqYbPvHjSFbfWLiq9
Masternode 2 key: 93LqM7TK5NfJHhipRqMJf2BAN5aQ3Wr9X2SaJ1H1aY9U6S39rbT

Masternode 1 txid : 55a7043b8f69e0406edb7fbee7255cc214aadfc29108893a72d8be1903a37274
Masternode 1 outid: 0
Masternode 2 txid : 6d4dc744e16f66cbdee67fc273fa0ac508c2b91dfffddc74aac86f3b0e7b76c5
Masternode 2 outid: 0

We now have all the information we need to setup our remote masternodes.

Part B - Install and setup remote STRAKS Masternode

These procedures are for a clean server install. If you have an existing installation then some steps may not be required. Performing the steps is unlikely to have any affect on the system however already running a server you are likely a linux wizard anyway. Securing the server has NOT been included in this tutorial. That is your responsibility. A great guide can be found here to assist you.

Since we will be creating a masternode and not technically using the wallet features, it is common to refer to the wallet as a node. I will use this term node and masternode interchangeably throughout the following sections.

Note for Raspberry Pi users - Configuration of your home network to allow incoming traffic on port 7575 to reach the masternode is not covered in this HOWTO. Failure to do so will result in lost earnings.

Step 1 - Install most recent security patches

A clean server install will likely need some software updates. The following commands will bring the system up to date;

Ubuntu

sudo apt-get update
sudo apt-get -y upgrade

Raspberry Pi

sudo apt-get update
sudo apt-get -y dist-upgrade

Step 2 - Download and extract STRAKS wallet for linux

Download the most recent version of the STRAKS wallet for your system from https://github.com/straks/straks/releases/latest. To do this via bash type the following commands;

Ubuntu

cd ~
wget https://github.com/straks/straks/releases/download/1.14.7.3/straks-1.14.7.3-linux-amd64.tar.gz
tar zxvf straks-1.14.7.3-linux-amd64.tar.gz
cd straks-1.14.7.3-linux-amd64

Raspberry Pi

cd ~
wget https://github.com/straks/straks/releases/download/1.14.7.3/straks-1.14.7.3-RPi2.arm.tar.gz
tar zxvf straks-1.14.7.3-RPi2.arm.tar.gz
cd straks-1.14.7.3-RPi2.arm

Version 1.14.7.3 was the most recent version at the time of writing. Ensure you use a link for the latest version as per the github repository link above.

Step 2 - Install dependencies

The masternode requires that certain dependencies are available which are not included by default on a clean server install. Type the following commands to install the necessary dependencies;

Ubuntu

# Add ubuntu repo management packages
sudo apt-get install -y software-properties-common python-software-properties

# Add the bitcoin respository to apt and refresh lists
sudo add-apt-repository -y ppa:bitcoin/bitcoin
sudo apt-get -y update

# Install nessessary libraries
sudo apt-get install -y libboost-all-dev
sudo apt-get install -y libdb4.8-dev
sudo apt-get install -y libdb4.8++-dev
sudo apt-get install -y libminiupnpc-dev
sudo apt-get install -y libevent-dev
sudo apt-get install -y libzmq3-dev

Raspberry Pi

# Install nessessary libraries
sudo apt-get install -y libboost-all-dev
sudo apt-get install -y libminiupnpc-dev
sudo apt-get install -y libevent-dev

Step 3 - Get servers public IP address

The masternode needs to send and receive traffic from other masternodes and STRAKS wallets. To allow this to occur, we need to set the server’s public IP address in the next step. To get your servers public IP address, type the following;

curl ipinfo.io/ip

The result will be the public facing IP address of your server.

Step 4 - Create the masternode configuration file and populate

Before the node can operate as a masternode a custom configuration file is needed to be created. Since we have not loaded the wallet yet, we will create the necessary directories and the configuration file by typing the following commands;

mkdir ~/.straks
cd ~/.straks
touch straks.conf

This has created a blank STRAKS configuration file that we will enter our masternode configuration variables. To configure a masternode carry out the following;

Load the straks.conf file in the editor of your choice. I will use nano for simplicity;

nano straks.conf

Paste the following configuration settings into the editor;

#################
# General Config
#################
rpcuser=<YOUR_OWN_RPC_USERNAME>
rpcpassword=<YOU_OWN_RPC_PASSWORD>
rpcallowip=127.0.0.1
server=1
daemon=1
listen=1
maxconnections=500

####################
# Masternode Config
####################
masternode=1
masternodeprivkey=<ADD_YOUR_MASTERNODE_KEY_HERE>
externalip=<IP_ADDRESS_FROM_STEP_3>:7575
promode=1

Before you exit the editor, there are 4 parameters that you need to update with your own settings. These are;

  • <YOUR_OWN_RPC_USERNAME> - Set this to a custom username. i.e. rpcuser
  • <YOU_OWN_RPC_PASSWORD> - Set this to a STRONG password. i.e. password <-- NO!!!
  • <ADD_YOUR_MASTERNODE_KEY_HERE> - This is the masternode key that we generated during the Windows Wallet setup in Part A, step 4. If you are setting up multiple masternodes, give each configuration file one of the keys you generated
  • <IP_ADDRESS_FROM_STEP_3> - Set this to your servers public IP address from step 3.

Save and exit the editor. In nano this is done by pressing CTRL-O to save and CTRL-X to exit.

Step 5 - Load the masternode

With the configuration created we are now ready to load the masternode and sync to the network. Load the masternode by typing the following commands;

Ubuntu

cd ~/straks-1.14.7.3-linux-amd64
./straksd

Raspberry Pi

cd ~/straks-1.14.7.3-RPi2.arm
./straksd

If successful, you will get a message that reads straks server starting and you will be placed back at the command line.

To check the status of the blockchain sync, type ./straks-cli getinfo. You will get an output that looks similar to the following;

{
  "version": 1140703,
  "protocolversion": 70103,
  "walletversion": 130000,
  "balance": 0.00000000,
  "blocks": 195200,
  "timeoffset": 0,
  "connections": 2,
  "proxy": "",
  "difficulty": 930.5458409932694,
  "testnet": no,
  "keypoololdest": 1513512237,
  "keypoolsize": 1000,
  "paytxfee": 0.00000000,
  "relayfee": 0.00010000,
  "errors": ""
}

You need to wait for the blocks field to reach the latest block as indicated by the STRAKS Blockchain Explorer. Once you are synced, the masternode is ready to be started. To start the masternode, we will go back to the windows wallet.

Part C - Setup local STRAKS Qt wallet (Windows) for Masternode control

To control our remote masternode we need to create a link between the windows wallet and the node. This link is created by adding additional masternode configuration settings to a masternode.conf file for the windows wallet.

If you are comfortable creating files, go ahead and create masternode.conf in the directory you recorded in Part A, Step 2 and skip to Step 2 below, otherwise, proceed to Step 1.

Step 1 - Load the masternode.conf file for editing*

Back in Part A, Step 2 we recorded the directory where the STRAKS wallet is storing all of its files. Navigate to that folder now. If you left the settings as default, you can quickly get to this folder by typing %appdata%/straks in File Explorer.

In this folder, create a blank file called masternode.conf and load it in your favourite editor.

Step 2 - Populate masternode.conf

In the masternode.conf file you need to enter a line for each masternode that you want to control. The format of the file is as follows;

<masternode_alias> <ip_address_and_port> <masternode_key> <transaction_id> <transaction_output>

Before you exit the editor, there are 5 parameters that you need to update with your own settings. These are;

  • <masternode_alias> - An alias for this masternode. i.e. Masternode1
  • <ip_address_and_port> - The IP address and port number of the masternode. This is the same as what you entered into the Masternode configuration file in Part B, Step 4
  • <masternode_key> - The masternode key for this node, again from Part B, Step 4
  • <transaction_id> - Use the transaction ID that you recorded in Part A, Step 6
  • <transaction_output> - Use the transaction OUTPUT that you recorded in Part A, Step 6.

An example entry with populated values is as follows;

mn1 45.77.158.182:7575 92YQFVwhDgNTqJjYGfFbNHqvhduz4FPUTBv7ofyzAfW89k3ZFwG 6d4dc744e16f66cbdfe67fc273fa0ac508c2b91dfffddc74aac86f3b0e7b76c5 0

Save the file and exit.

Step 3 - Load/Reload the STRAKS windows wallet

If the wallet is already open, close and reload otherwise load the wallet and allow it to sync. Once it has completed syncing, we are ready to test our masternode. Navigate to the Masternodes section and click the My Masternodes tab. This tab will not contain any entries yet as the network has not seen our masternode. Click Start MISSING down the bottom of the window. You will get a confirmation window which you can click Yes.

The most likely outcomes will be the following windows, ordered from failure to success;

load_fail

The wallet is not able to see the masternode.conf file that you created. Check to ensure it does not have any hidden file extension such as .txt and that it is located in the correct folder.

load_fail_ok

This is the most common error. This occurs as the wallet is trying to protect your collateral from being spent so that your masternode stays safe. To overcome this error, you need to manually unlock your collateral transaction and then start the masternode. You can unlock the transaction by going to Help -> Debug Window and then selecting the Console tab. In the scratch-pad type lockunspent true. The debug window will respond with true if transactions were unlocked. These will re-lock once you start your masternode.

load_fail_ok

The masternode has been started successfully. Congratulations! The wallet will now list your masternode and update the status. The values will only update every 30 minutes.

Tip for young players

1. My masternode keeps dropping offline

If your masternode status changes from ACTIVE to any other value, it is likely that it is not communicating with other masternodes. This means that after one hour the masternode will drop offline and you will receive no payments. Check the wallet status after one hour the first time you load your masternode to ensure it is working correctly.

2. My masternode still keeps dropping offline

Ensure that if your masternode server has a firewall, port 7575 is open for tcp traffic. If this port is not reachable, other masternodes will not be able to communicate with your masternode and your masternode will drop off the network.