Skip to content

Latest commit

 

History

History
280 lines (240 loc) · 12.6 KB

set_up_masternode.md

File metadata and controls

280 lines (240 loc) · 12.6 KB

Setting Up a Dash Masternode

About this guide

This guide will walk you through the process of setting up a dash masternode using a Mac OS X local machine and your own remote Linux virtual private server (VPS). It is adapted from the following guides:

Using this guide

  • Basic terminal usage
  • Command prompt legend
    • This guide uses the command prompts below to indicate which machine you are running commands on:
    • Local$ sample command - run on your local Mac OS X terminal
    • VPS$ sample command - run on your remote virtual private server's terminal
    • Dash$ sample command - run on your local DashCore's console

1. Download & install DashCore & prepare your wallet

The following steps will help you install a dash wallet on your Mac OS X. Although it is a bit dated, this video may help as well.

  1. From a browser on your Mac, go to https://www.dash.org/downloads
  2. Find and click the DashCore, Mac OS X dmg download link
  3. Click the downloaded dmg file to open up its contents
  4. Drag the DashCore.app file into the Applications folder
  5. Open the Applications folder and press control while clicking DashCore
  6. From the menu shown, click 'Open', then confirm by clicking 'Open' again
  7. Press 'OK' to install the app into the default directory
  8. Select 'Deny' or 'Allow' depending on your preference
  9. Note the status of the network sync shown at the bottom; this may take hours to complete but you can move on
  10. While syncing, and before depositing any dash, encrypt your wallet and back it up

2. Create and secure a Linux VPS

This step (done properly) requires a lot of steps, so there is a link below to a separate guide for this step. Once complete, come back to this guide and continue on with step 3.

  1. Create and secure a virtual private server (VPS) to host your masternode
  • You may use your own hardware, or any 3rd party hosting service you like (e.g. AWS, Digital Ocean, Vultr, etc)
  • This comprehensive VPS setup guide walks you through this process, using Vultr as your VPS host
  • Your machine should have sufficient storage, bandwidth, and RAM, and be properly configured (ssh, ports, etc)

3. Create your masternode key & address

  1. Open DashCore
  2. Get a new masternode private key and address
  • Menu: Tools > Debug console
  • A new window should appear with the "Console" tab selected at the top
  • Enter the following command in the input field at the bottom:
Dash$ masternode genkey
# Dash will output the result
Dash$ getaccountaddress <masternodeLabel> # <masternodeLabel> is a name of your choice, e.g. "masternode1", "MN01", etc.
# Dash will output the result
  1. Copy and label the two outputted strings of characters in the notes page you created for your IP address
  • These will be referred to as <masternode-privkey> and <masternode-address> in later steps

4. Fund your newly created address with 1000 DASH

You may fund your masternode address by sending dash from any wallet (e.g. Jaxx, Electrum, Poloniex, etc). These steps assume you are funding from DashCore itself. Either way, the wallet you are sourcing funds from must have 1000 DASH plus a little extra (~0.01 DASH) to cover the dash network fee.

  1. Open the 'Receiving addresses' dialog box (file > Receiving addresses)
  2. Click the Receiving address you made in step 3 (e.g. "MN01") and click the 'copy' button
  3. Click the Send tab on the main DashCore window (or your wallet of choice)
  4. Paste the address you copied on the 'Pay To' field, it should populate your label
  5. Enter '1000' in the 'Amount' field
  • Don't include any miner fee in this amount; the wallet will automatically cover it
  • The amount you actually send must be one transaction of exactly 1000 DASH
  • No, you may not send more than 1000 DASH
  • No, you may not send 999.99 DASH
  • No, you may not put in 1 DASH first and then 999 DASH. It must be all at once. You may test the address first, but you will still need to send 1000 DASH later, all in one transaction
  • No, even if you have 1000 DASH in the wallet already, that doesn't count. You must send 1000 DASH to your <masternodeLabel> address
  1. Click 'Send' to fund your masternode (you may use/check InstantSend for this)
  2. Click 'Transactions' in the main DashCore window. Your transaction should show "Payment to yourself"

5. Prepare your remote VPS

While we are waiting for the needed 6 confirmations of our 1000 DASH transaction, we can now prepare the remote server.

  1. Log in to your VPS
Local$ ssh <login-user>@<ip.add.re.ss>
<password> # if needed
Local$ ssh -p <ssh-port-number> <login-user>@<ip.add.re.ss>
  • You may also log in from your VPS cloud provider's console
  1. Optionally, create a new user on your VPS for all dash-related files and functions
VPS$ su <super-user>
<password>
VPS$ sudo adduser <dash-user> # this will be the assumed target for '~' from now on (cd ~ == cd /home/<dash-user>)
<super-users-password>
<newPassword>
<newPassword>
<otherFieldsAsDesired>
  1. Download, unpack, copy, and permission the needed applications/files on your VPS
VPS$ su <dash-user> # whatever user you want; <dash-user> if you created it above
VPS$ cd ~
VPS$ wget https://www.dash.org/binaries/dashcore-0.12.1.5-linux64.tar.gz
VPS$ tar xfvz dashcore-0.12.1.5-linux64.tar.gz # unpack files
VPS$ cp dashcore-0.12.1/bin/dashd dashd
VPS$ cp dashcore-0.12.1/bin/dash-cli dash-cli
VPS$ chmod 755 dashd # set permissions
  1. Create dash.conf file on your VPS
VPS$ cd ~
VPS$ mkdir .dashcore
VPS$ cd .dashcore
VPS$ nano dash.conf
# once open, insert the following text.  Note: rpcuser and rpcpassword can be anything, you will not have to remember them later, feel free to go nuts on your keyboard

< # start of file contents
rpcuser=<anything-like-random-numbers-and-letters>
rpcpassword=<anything-like-random-numbers-and-letters>
rpcport=9998
rpcallowip=127.0.0.1
listen=1
server=1
daemon=1
maxconnections=24
masternode=1
masternodeprivkey=<masternode-privkey>
externalip=<ip.add.re.ss>
> # end of file contents, ctrl+x to exit, save as "dash.conf"
  1. Launch dashd on your VPS
VPS$ cd ~
VPS$ ./dashd # enter command, then wait ~15 seconds -- to stop dashd issue the command ./dash-cli stop  
VPS$ ./dash-cli getinfo
  • If you run the "getinfo" command several times you should see that the number of blocks is increasing
  • The number of blocks must eventually catch up to the current blockchain before your masternode is active
  • You can check if the number of blocks is up to the current height by comparing to the current number of blocks reported on one of the many Dash blockchain explorers (several are listed on the dash.org website)
  • You don't need to wait for the blocks to completely sync; we may move on to the next step

6. Remove unnecessary files & folders from your VPS

We are done with the installation files, so those can be removed.

  1. Remove files as follows:
VPS$ cd ~
VPS$ ls
VPS$ rm dashcore-0.12.1.5-linux64.tar.gz
VPS$ exit # repeat to exit all the way out of VPS (into your local machine)

7. Create masternode.conf file on your local machine

  1. Obtain data for masternode.conf
  • Open DashCore
  • From the menu: Tools > Debug Console, then type the command:
Dash$ masternode outputs # values are listed as "hash":"index", copy them into your notes
  1. Create masternode.conf
Local$ cd ~/Library/Application\ Support/Dashcore
Local$ nano masternode.conf
# this file may already exist
# if it does not nano will create it
# either way you will need to select a name/alias (e.g. "MNO1"
# reminder: your masternode/VPS ip address can be found using 'nano ~/.ssh/config'
# populate the file with the data obtained above in the following format:
< # start of file contents
  MN01 <masternode-ip-address>:9999 <masternode-privkey> <txn-hash> <txn-output-index>
> # end of file contents, exit with ctrl+x, save the file
  • You will need a separate line for each masternode in masternode.conf
  • You may add as many masternodes to the same wallet and masternode.conf as you wish
  1. Close DashCore

8. Install & test Sentinel

  1. Install prerequisites
VPS$ sudo apt-get update
VPS$ sudo apt-get install -y git python-virtualenv
  1. Install Sentinel
VPS$ cd .dashcore
VPS$ git clone https://github.com/dashpay/sentinel.git
VPS$ cd sentinel
VPS$ virtualenv venv # create virtual python environment.  If this command fails try `sudo apt-get install -y virtualenv'
  1. Install dependencies, test setup
VPS$ venv/bin/pip install -r requirements.txt
VPS$ venv/bin/python bin/sentinel.py

If you see "dashd not synced with network! Awaiting full sync before running Sentinel", run dash-cli mnsync status until you see:

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

9. Start your masternode(s)

  1. Launch DashCore (this will use the new masternode.conf settings from step 7)

  2. Open a DashCore console session (Tools > Debug console)

  3. Enter the following to activate your remote masternode

    Dash$ walletpassphrase <your-wallet-passphrase> 120 # alternatively, Settings > Unlock Wallet.  Password is the same you created to encrypt your wallet, also used when spending Dash.
    Dash$ masternode start-alias <alias-of-masternode-you-want-to-start>
  • You should get a response similar to:

    Dash$
    {
    "alias" : "MN01",
    "result" : "successful"
    }
  1. Check your work by going back to your remote server and enter the following

    Local$ ssh <login-user>@<ip.add.re.ss> 
    VPS$ ./dash-cli masternode debug # look for success message
    VPS$ ./dash-cli masternode list full | grep <your MN IP address> # look for "ENABLED" in the returned text
  • If it doesn't show "ENABLED", don't panic; the blockchain must fully download on the remote server before it becomes active
  • You can check the status of the blockchain download by running ./dash-cli getinfo until it's caught up to the current number of blocks
  • Once caught up, give it a minute and try again to see if it shows as "ENABLED"

If you still don't see "ENABLED" check your settings from your local DashCore wallet

Dash$ masternode list-conf # to see your masternode alias(es), make sure all settings are correct (see step 7)
Dash$ walletpassphrase <yourwalletpassphrase> 120
Dash$ masternode start-alias <alias>
Dash$ walletlock # to lock your wallet back up

10. Create cron job & test setup

Your masternode is set up and sentinel is installed. Now you just need to configure Sentinel to periodically run to keep your masternode alive, proving to the network that you are performing your job as required.

  1. Test Sentinel again
VPS$ cd .dashcore/sentinel
VPS$ venv/bin/python bin/sentinel.py # should return nothing but silence.  This is how you know it's working.
  1. Create Cron job
VPS$ crontab -e
# add the following to the end of this file:
  < # start of text to add
    * * * * * cd /home/YOURUSERNAME/.dashcore/sentinel && ./venv/bin/python bin/sentinel.py  2>&1 >> sentinel-cron.log
  > # end of text to add, exit with ctrl+x, save the file
  1. Final Test
Local$ ssh <login-user>@<ip.add.re.ss> 
VPS$ ./dash-cli masternode debug # look for success message
VPS$ ./dash-cli masternode list full | grep <your MN IP address>

If you see ENABLED still then you're done. Celebrate!