Staking with Multiple Masternodes

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@dillagr·
0.000 HBD
Staking with Multiple Masternodes
This post aims to outline a procedure you could follow along to build multiple NYEX masternode(s). It requires that you already have a wallet for staking. Else, you may want to check several posts below.

* [Staking Alt Coins for Passive Income](https://steemit.com/cryptocurrency/@dillagr/staking-alt-coins-for-passive-income)
* [AutoStart Staker Daemon on Boot](https://steemit.com/cryptocurrency/@dillagr/autostart-staker-daemon-on-boot)
* [Setup An Alt Coin Masternode for Passive Income](https://steemit.com/utopian-io/@dillagr/setup-an-alt-coin-masternode-for-passive-income)

 
Most of the scripts, configs and other supplemental files are available for download in [my github repository](https://www.github.com/dillagr/staker).

## Terminologies and Definitions
In this post and the above, the staker instance refers to the wallet. The user that runs the staker wallet is "nyex", while the user that runs the masternode instance is "nyexmn". Create the users as they don't usually exist by default in the VPS.

It follows that when making modifications to the staker instance, everything is relative to the home directory of user "nyex"; while the configuration files for the masternode is relative to the home directory of the masternode user "nyexmn". There usually is confusion in this matter.

## Create Another VPS Instance
Launch another VPS instance. Prep it like the rest of the VPS instances. The "setup.sh" script in the github repository above. Download and execute the shell script.
`$ sudo bash setup.sh`

Multiple masternode instances could not co-exist in the same VPS instance since the masternode runs on a specific TCP port (port 54918 in the case of NYEX). The masternode will not start unless that port is available.

#### Install Additional Packages
Next, download the NYEX Linux wallet and extract it to /usr/local/bin. At the time this procedure was written, the current wallet version is V1.0.1.0. You may want to check the latest version from [the Nyerium github repository](https://github.com/nyerium-core/nyerium/releases).
`$ wget https://github.com/nyerium-core/nyerium/releases/download/v1.0.1.0/nyerium-1.0.1.0-x64-linux-tar.gz`
`$ sudo tar zxf nyerium-1.0.1.0-x64-linux-tar.gz -C /usr/local/bin`

## Deposit Exactly 10,000 NYEX
*(NOTE: Execute this on the staker node)*

Generate a NYEX wallet address for your masternode. *MN2* (enclosed in quotes below) can be any alias you want to call your masternode. Just like MN1, remember that this will be used later. You are starting to see the logic of using MNx (where "x" is the next number on the sequence).
`$ nyerium-cli getaccountaddress "MN2"`
`Nb53ez1Kr24q1SjwgJJez9wFNAjyQxV9N1`

Next, you need to deposit *exactly* 10,000 NYEX coins. Yes, you read it right -- exactly 10,000 NYEX coins. Just like the first masternode instance, the next masternode you build will require another 10,000 NYEX deposit to your staker wallet. This means you should have at least 20,000 NYEX coins for masternode collateral.

This could be a transfer from the same wallet, and will show up as a "To yourself" type transaction. If sending directly from another exchange, impute the transaction fees.
`$ nyerium-cli sendtoaddress "Nb53ez1Kr24q1SjwgJJez9wFNAjyQxV9N1" 10000`

#### Obtain Masternode TXID
After the deposit, the masternode transaction id information can be obtained. The output is a transaction hash and a trailing number having a value of either 0 or 1. Take note of these information. Let's call them **MN2TRXHASH** and **MN2VOUT** respectively. You will see that the previous TRXHASH and VOUT are already existing and another entry was added. Use the *NEW* ones.
```
$ nyerium-cli masternode outputs
{
	"54f937a7eb216fc17f4c0ab7aa8489229a1e63a26cafbadce11018d061fcfa46" : "0",
	"1f1f40accaa1a0a48a427a33d4c0f42325ca4020c80e5336f15095d51c97d8bf" : "1"
}
```

 
#### Generate a New Masternode Private Key
Next, generate a masternode private key. Take note of the output as well. Again, let's call this **MN2PRIVATEKEY**.
`$ nyerium-cli genkey`

## Configure the Masternode
*(NOTE: Execute this on the new masternode)*

Create the username that will run the masternode daemon. In my case, I use *nyexmn* as the user that runs the masternode daemon.
`$ sudo useradd nyexmn -m`

#### Create the masternode configuration
Next, create the masternode configuration file *~nyexmn/.nyerium/nyerium.conf*.
`rpcuser=nyexrpc`
`rpcpassword=somelongmd5hashthatcontainstherpcpassword`
`rpcallowip=127.0.0.1`
`server=1`
`masternode=1`
`masternodeaddr=#MN2VPSIPADDR#:57418`
`masternodeprivkey=#MN2PRIVATEKEY#`

Replace MN2VPSIPADDR with the IP address of the new VPS masternode, and likewise replace MN2PRIVATEKEY with the output of the `nyerium-cli genkey` that was previously executed. The hashes are there to highlight the variables, but they are not needed so **remove** them.

#### Masternode systemd service
Like the previous masternode, download the file nyex-masternode.service [from my github repository](https://github.com/dillagr/staker/blob/master/nyex-masternode.service). Place this file in the folder /etc/systemd/system.
`$ sudo cp nyex-masternode.service /etc/systemd/system`
`$ sudo systemctl daemon-reload`
`$ sudo systemctl enable nyex-masternode`
`$ sudo systemctl start nyex-masternode`

Check and ensure that the system is running (initially, you will have to wait for the wallet to completely sync the blockchain history). Note that another command is introduced here. This is another way to check the status of the masternode.
`$ nyerium-cli masternode debug`
`Not capable masternode: Hot node, waiting for remote activation.`

Once you see a "message" similar to the above, your masternode is now ready.

## Configure The Staker Node
*(NOTE: Execute this on the staker node)*

The staker node can now activate the masternode. But it needs to be configured first.

#### Masternode Configuration
The masternode configuration file *~nyex/.nyerium/masternode.conf* needs to be modified. Add the following lines.
`MN2  #MN2VPSIPADDR#:57418  #MN2PRIVATEKEY#  #MN2TXHASH#  #MN2VOUT#`

MN2 in the above is the alias used to generate the NYEX wallet. The rest of the items enclosed in hashes are already defined before. The line beginning with MN1 should still be there. Do not make changes to that line, but simply add another line for MN2.

#### Restart the staker service
Restart the staker service for it to be able to re-read the masternode.conf configuration file.
`$ sudo systemctl restart nyex-staker`

Next, activate the masternode. Again the MN1 alias is used here.
`$ nyerium-cli startmasternode alias false MN2`

Check and ensure that the masternode is running.
```
$ nyerium-cli masternode list-conf
{
    "masternode" : {
        "alias" : "MN1",
		(some output snipped)
        "status" : "ENABLED"
    },
    "masternode" : {
        "alias" : "MN2",
		(some output snipped)
        "status" : "ENABLED"
    }
}
```

 
Once you see the "status" is ENABLED, the masternode is now working. 

Verify the status as well on the masternode with command `nyerium-cli masternode debug`. Status should indicate `Masternode successfully started`. Otherwise, you have misconfigured your masternode.

Repeat the same procedure for additional masternodes you wish to add.

<center>![NYEXMN.PNG](https://ipfs.busy.org/ipfs/QmfYpGZcGUZTEhgGMD2nFVzpDetH9SkSjARjiQbFGRmxhY)
</center>

<br/><hr/>
If you like this post, you know what to do.

### Support:
* Bitcoin (BTC) - 3Kyjg1Wj1PNGN3KhiRprxYvvQpdjC5kT3k
* Etherium (ETH) - 0x5F168F895C63ccC5FbEf921047bc2b63f6780c3F
* SmartCash - SbgqBUuGBVaaFERmc5zPn8XStxXe7vE1SL

### Thanks!
* @votingpower

&#160;
<center><a href="https://smartsteem.com?r=dillagr" target="_blank"><img src="https://steemitimages.com/0x0/https://steemitimages.com/DQmYRoKwatvUwCAfuZo4Gbvbr2qhtYLDZfbmBfNw76BnhiC/smartsteem_banner.gif" /></a></center>
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,