This guide will teach you how to setup a Sparks Masternode or Guardian node on a remote server (VPS). You should have at least a basic knowledge of linux. For better clarity, all commands that must be typed shall be displayed as such:

 

this is a command

Type the command exactly (you may copy&paste it). There will always be some space between commands, so that you can easily see commands spanning over several lines. Some commands may also be appended together with && to speed up the process when commands are short or trivial. You may execute these commands as one, or you may type each one separately.

If you need any additional help, feel free to join our discord and ask for help in the #masternode channel.

BEWARE scammers trying to impersonate team members! Do not accept help from people directly contacting you. No one from SparksPay team will contact you and “help” proactively!

 

What you’ll need

1.     A local computer – your everyday computer, typically a Windows or Mac, which will run a control wallet and hold your coins. This computer need not always be online.

2.    A remote server – typically a VPS, with Ubuntu Server 18.04 64-bit OS installed with a unique and static IP address (an IP address that does not change), which is always running and connected to the Internet. This VPS should at least have 1Gb of RAM and 10Gb of space storage.

3.    A collateral – an amount in Sparks that will be unspendable as long as you wish to keep your node running. For a regular masternode you’ll need 1,000 SPK. For a Guardian node you’ll need 25,000 SPK. In both cases you’ll need some change for transaction fees, so 1 SPK more to cover expenses is good enough.

 

Setting up a Control wallet

 

Step 1 – Set up wallet

This involves downloading and synchronizing the wallet. Please refer to our wallet guide if you need any help

 

Step 2 – Create collateral

As mentioned above, you will need some Sparks to create what is called a collateral: a certain amount of Sparks that will be “frozen” in order for your masternode to keep running.

You will first need to get the amount of sparks for the collateral, as well as a small amount to pay the transactions fees. You may purchase some Sparks on exchanges (see available exchanges in Tools > Exchanges). You will need:

  • 1,000 SPK (+1 SPK) for a masternode
  • 25,000 SPK (+1 SPK) for a Guardian node

Once you have this amount in your control wallet, you need to set it as an official collateral. This is done by creating a receiving address in your wallet, and sending the exact amount – 1,000 or 25,000 SPK – to it. Making a payment to yourself requires a fee. This is why you needed that extra SPK.

After making that payment, you will need to retrieve some information about it: the Transfer ID and Index.

This information can be found using the Debug Console. Go to Tools > Debug Console. Depending on the type of node, type the following command:

 

masternode outputs

or

 

guardian outputs

this will yield something like this

 

{
  "65cf41726b215976ee8c9e35a06aec003af1557be435d9d11f91cd47e7570911": "1",
}

The first part is the transfer ID, and the last (the digit) is the index. This information can also be found in the explorer if you type the address you sent the collateral to.

 

Step 3 – Create private key

A private key is used to identify your masternode or guardian node in your control wallet. You can create this key using the console again and typing the following command:

 

masternode genkey

This key will work for both masternodes and guardian nodes. The guardian genkey command yields exactly the same thing.

 

Setting up a VPS

The following procedure assumes an installation from scratch. If you have an existing VPS already installed, then some steps might not be needed. BEWARE: while we provide certain security measures and best practices, securing your server is still your responsibility!

 

Step 1 – Acquire a VPS from any provider

The cheapest one will do, provided you create a swap file (see below). Here are a few providers:

When asked, choose the Ubuntu 18.04 LTS Linux distribution.

 

Step 2 – Log into your VPS and install updates and packages

In order to access your VPS, you will need a software/SSH client such as PuTTY. This tutorial does not cover installation of, nor how to use such software.

Once you have access to your VPS, create a user that will be running your masternode (for security reasons, it is always better not to run any application as root user):

 

adduser sparks && adduser sparks sudo

This creates user “sparks” with root privileges (be able to run root commands using the “sudo” prefix).

Switch to “sparks” user

 

su - sparks

A clean server install will likely need some software updates. Enter the following command which will bring the system up to date (can take a few minutes to complete):

 

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

Reboot your VPS for changes to take effect:

 

sudo reboot

After rebooting, swith to sparks user again:

 

su - sparks

Install the following packages and libraries (some libraries are not necessary if you don’t compile sources but it’s still a good idea to do it so you got them installed anyways):

 

sudo apt-get install -y ufw wget git nano htop unzip autoconf automake libboost-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libboost-all-dev libminiupnpc-dev build-essential libtool autotools-dev pkg-config libssl-dev libevent-dev bsdmainutils virtualenv python-virtualenv software-properties-common && add-apt-repository ppa:bitcoin/bitcoin

At some point, you will be asked to confirm installation of the bitcoin library. Simply hit enter

 

sudo apt-get update -y

 

sudo apt-get install -y libdb4.8-dev libdb4.8++-dev libzmq3-dev libzmq5

 

Step 3 – Set up a Swap File

This will be needed especially if using a low end VPS and you wish to compile the source code. Some providers already install a swap on their VPS. You can check this by doing:

 

htop

This provides you with a nice view of your VPS resources. In the higher left part, check if Swp has any value higher than 0K. If so, you are good to go to Step 4. If not, continue below.

The following command sets up a 2 Gb swap file. You may change this size by modifying the 2G to anything you like (we still recommend at least 1G). Leave all other commands unchanged.

 

sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile && echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab && sudo sysctl vm.swappiness=10 && sudo sysctl vm.vfs_cache_pressure=50 && echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf && echo 'vm.vfs_cache_pressure=50' | sudo tee -a /etc/sysctl.conf

More information about swap files

 

Step 4 – Set up a Firewall

This protects your VPS against some attacks. You might need to add some additional allow clauses if your VPS is used for anything other than Sparks masternode or guardian.

Allow all ports needed:

 

sudo ufw default allow outgoing && sudo ufw default deny incoming && sudo ufw allow ssh/tcp && sudo ufw limit ssh/tcp && sudo ufw logging on && sudo ufw enable

Allow Sparks port:

 

sudo ufw allow 8890/tcp comment Sparks

Check status:

 

sudo ufw status

You should see the following lines (maybe only one if IPv6 is not enabled on your VPS):

 

    8890/tcp       ALLOW       Anywhere         # Sparks
    8890/tcp (v6)  ALLOW       Anywhere (v6)    # Sparks

More information about ufw firewall

 

Step 5 – Install masternode binaries and configuration

Get the latest binaries from github. At the time of writing, latest version is v0.12.4.3. You should check on github and adapt the following commands with latest binaries reference.

 

wget https://github.com/sparkspay/sparks/releases/download/v0.12.4.3/sparkscore-0.12.4.3-x86_64-linux-gnu.tar.gz

 

tar zxvf sparkscore-0.12.4.3-x86_64-linux-gnu.tar.gz

 

sudo mv sparkscore-0.12.4/bin/sparks{d,-cli} /usr/local/bin/

 

rm -r sparkscore-0.12.4*

Before the node can operate as a masternode, a custom configuration file needs to be created. Since we have not loaded the blockchain yet, we will create the necessary directory and configuration file

 

mkdir .sparkscore && cd .sparkscore

Get the following values for your configuration file:

 

  • <user> – an alphanumerical string
  • <password> – an alphanumerical string, not the same as user
  • <vps ip> – the IP of your VPS (looks something like: 192.168.2.1)
  • <private key> – the one you created earlier in your control wallet’s Debug Console

Create Sparks.conf file

 

nano sparks.conf

then copy&paste the following in it, inserting the proper values:

 

rpcuser=<USER>
rpcpassword=<PASSWORD>
listen=1
server=1
daemon=1
maxconnections=16
masternode=1
printtodebuglog=0
disablewallet=1
 
externalip=<VPS IP>
rpcallowip=127.0.0.1
rpcport=8818
 
masternodeprivkey=<PRIVATE KEY>

*** END OF COPY PASTE ***

Save the file (ctrl-x, then ctrl-y)

 

Step 6 – Start the daemon

Now that you have everything set up, it’s time to start the daemon. To speed up the synchronization of the blockchain, you may download a booststrap file and put it in the .sparkscore directory you created earlier, the one where your sparks.conf file was created (this is not mandatory):

 

wget https://github.com/sparkspay/sparks/releases/download/bootstrap/bootstrap.dat

And finally launch the masternode daemon

 

sparksd

Wait about 30 minutes for your masternode to sync completely.

You may monitor the sync progress using the following command:

 

watch sparks-cli getinfo

which should yield the following information:

 

{
  "version": 120103,
  "protocolversion": 70208,
  "blocks": <total number of blocks>,
  "timeoffset": 0,
  "connections": 8,
  "proxy": "",
  "difficulty": 22.7406807988061,
  "testnet": false,
  "paytxfee": 0.00000000,
  "relayfee": 0.00010000,
  "errors": ""
}

Here, “watch”-ing lets you see the synchronization (you can exit the watch at any time with ctrl-c). The

blocks number will go up until your masternode reaches the total number of blocks in the blockchain.

This is the longest part. You can see what number it needs to reach by hovering over the small V in the lower right of your (Windows or Mac) control wallet.

BEWARE: the blocks number might not start growing for a while. This is because the blockchain could be stuck for lack of miners. As long as you have connections higher than zero you are fine.

You may verify that it is synced using the command:

 

watch sparks-cli mnsync status

which should yield the following information:

 

{
  "AssetID": 999,
  "AssetName": "MASTERNODE_SYNC_FINISHED",
  "Attempt": 0,
  "IsBlockchainSynced": true,
  "IsMasternodeListSynced": true,
  "IsWinnersListSynced": true,
  "IsSynced": true,
  "IsFailed": false
}

The masternode is completely synced when AssetID is 999 (it will go through 0, 1, 2, 3, 4, 5 and 999).

Once your masternode is synced, you may delete the bootstrap file:

 

rm bootstrap*

 

Installing sentinel

Sentinel is not strictly needed for payouts, but if you want to monitor your masternode easily from your wallet or with 3rd party services such as nodecheck.io, you will have to install it.

 

Step 1 – download source code

The following commands will suppose that sentinel is installed in the home directory of sparks user.

 

cd ~/
git clone https://github.com/sparkspay/sentinel.git

BEWARE: if you are installing sentinel for a guardian node, use the following two commands, which will adapt the sentinel code to work for guardian nodes:

 

sed -i "s/'masternode'/'guardian'/g" ~/sentinel/lib/sparksd.py

 

sed -i "s/'masternodelist'/'guardianlist'/g" ~/sentinel/lib/sparksd.py

 

Step 2 – Compile and test/run code

The following commands will compile the code and create necessary files and folders

 

cd sentinel
virtualenv venv && venv/bin/pip install -r requirements.txt

The following command tests various aspects of Sentinel. It must return “24 passed tests” in green.You do not have to wait for your masternode to be fully synchronized for this test.

 

~/sentinel/venv/bin/py.test ./test

The following command sets up files and must return nothing. If it does, something went wrong. Only use this command after masternode is fully synced and activated with collateral (see very last step of this guide).

 

~/sentinel/venv/bin/python bin/sentinel.py

 

Step 3 – Create crontab entry

Sentinel needs to be executed regularly to monitor your masternode accurately. This is done by entering a command in your sparks user cron daemon.

Edit your crontab:

 

crontab -e

Add the following line:

 

* * * * * cd sentinel && ./venv/bin/python bin/sentinel.py >/dev/null 2>&1

And save the file (ctrl-x, ctrl-y)

 

Starting the masternode / guardian node

Your masternode is now synchronized and chatting with the network but is not accepted as a masternode because it hasn’t been introduced to the network with your collateral. This is done with the control wallet.

 

Step 1 – Activate masternodes tab

If the masternodes tab is not available in your control wallet, you need to activate it. Go to Settings > Options, then Wallet tab and check the Show Masternodes Tab box.

 

Step 2 – Edit masternode.conf file

This file is used to link your control wallet to your masternode or guardian node. You can access it by going to Tools > Open Masternode Configuration File. You must add the following line:

 

<name> <ip:8890> <private key> <collateral txid> <collateral index>

Where:

 

  • <name> is any name you wish to give your masternode. For example “MN-01”
  • <ip:8890> IP is the static IP address of your VPS. 8890 is the port
  • <private key> is the key you generated with the masternode genkey command
  • <collateral txid> is the first part of what you got when typing the masternode outputs or guardian outputs command
  • <collateral index> is the second part (the digit, almost always “1”) of what you got when typing the masternode outputs or guardian outputs command

For example (should be typed as one line):

 

MN-01 192.168.2.1:8890 7h2SqVCRzkjgeVCAz97vfNW6WtojmKBmmWH5LU1vVBdRzjupJ7 65cf41726b215976ee8c9e35a06aec003af1557be435d9d11f91cd47e7570911 1

ce you have typed this line, save the file and restart your control wallet.

 

Step 3 – Start masternode / guardian node

At last, we arrive to the final step needed to complete the installation. BEWARE: for this final step, your collateral transaction needs at least 15 confirmations!

Go to the Masternodes tab. You should see your masternode information, and a MISSING status. Click on the Start MISSING button. Your masternode or guardian node will go to PRE_ENABLED status, then ENABLED. Once enabled, all is done J

Again, don’t forget: your collateral must have 15 confirmations before you can use it to enable a masternode or guardian.

You may check the status on your VPS with the following command (as sparks user):

 

sparks-cli masternode status

which should yield the following information:

 

{
  "vin": "CTxIn(COutPoint(<your TxID>, (<your index>), scriptSig=)",
  "service": "<your ip>:8890",
  "payee": "<your collateral address>",
  "status": "Masternode successfully started"
}

 

Need Help?

Join us on Discord or use the contact form