Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

Reuben's Detailed Masternode Setup and Maintenance Guide

Discussion in 'Masternode Guides' started by BolehVPN, Feb 7, 2016.

  1. BolehVPN

    BolehVPN Active Member

    Joined:
    Nov 24, 2014
    Messages:
    195
    Likes Received:
    301
    Trophy Points:
    123
    [​IMG]

    This post was originally posted on BolehVPN's blog.


    8 February 2016

    Special Thanks to:
    moocowmoo for going through my guide and helping me improve it and making Dashman so awesome
    TaoOfSatoshi for making the original awesome Dummy's guide
    tungfa For always listening to my suggestions.
    @TicoSonny on Telegram for giving me the idea to revamp the existing guides.

    What is a Dash Masternode?

    Dash
    , is a privacy centric, anonymous and innovative digital currency that seeks to solve the drawbacks of Bitcoin. These improvements are achieved primarily through a layer of users hosting servers that provide services on top of Dash which are called masternodes.

    Masternodes enable the following services:

    • InstantX (instant transactions). In contrast, Bitcoin takes about 10 minutes to confirm a payment.
    • PrivacyProtect (anonymous transactions). In contrast, Bitcoin transactions are totally public and traceable. Only the identity of the addresses is anonymous.
    • Dash Evolution (a decentralized payment processor (think a decentralized Paypal).)
    Masternode users also have to put down a stake of their Dash (1000 Dash which at the time of writing is worth about USD4240.00) and temporarily locks it up to host a masternode. This prevents people from easily creating a masternode in order to game the security of the system.

    Masternode users also are given voting rights on proposals. Each masternode has 1 vote and this vote can be used on budget proposals or important decisions that affect Dash.

    How much can you earn from hosting a Masternode?

    Masternodes cost money and effort to host so they are paid a share of the block reward to incentivize them. With current masternode numbers and rewards masternodes earn approximately a 14% return on 1000 Dash (which means 140 Dash or USD593.60 at current prices) for the year of 2016. This rewards fall off in subsequent years but as the value of Dash is rising and the supply of Dash goes down, masternodes should still be sufficiently incentivized. This projection also doesn't count the fees that masternodes earn whenever someone uses its services (InstantX and PrivacyProtect).

    [​IMG]

    [​IMG]

    What do I need to host a Masternode?

    • 1000 Dash: Arguably the hardest part. Dash can be obtained from exchanges such as Poloniex, Bittrex and LiveCoin. Shapeshift's service is also an excellent way. You can also use
    • A server or a VPS installed with Linux: For the purposes of this guide we will be used Ubuntu 14.04 LTS. We recommend cheap VPSes such as from Vultr and DigitalOcean though any decent provider will do. Generally a low specced one will do. I use the 5 USD ones from Vultr and they work fine.
    • A dedicated IP address: These usually come with the VPS/server.
    • A little time <3 When I first got into masternodes, there were only a few guides around and did not cover all the scenarios. It took days for me to figure out the best ways to do everything. However, the process now takes a few minutes. With this guide it, I hope it will make the process a lot easier.
    If you can't be bothered with setting up and maintaining your own and don't mind paying a little extra, you can go with paid masternode hosters which will greatly simplify the process. A few good ones are:

    • Node40 You can tell Perry that Reuben from BolehVPN sent you! (perry [a] node40 dot com)
    • Splawik Supershare Hosting Service Tell Splawik (splawik21 [a] dash dot org) that Reuben from BolehVPN sent you! He also does share services where if you don't have 1000 Dash you can share with other people too! Splawik is an official member of the Dash team.
    • Masternodehosting by Holger (flare). Holger is an official member of the Dash team.
    • Moowcowmoo Masternode.Me Moocowmoo is an official member of the Dash team.
    A full list of all known providers can be found here.

    Step By Step Guide in Hosting a Masternode

    This post assumes you are familiar with setting up a Ubuntu 14.04 VPS and already have a Dash wallet installed on your local computer.

    If you do not have your Dash wallet yet, you can download the client from here. You can also read full documentation on the Dash wallet here.

    If you need step by step instructions on setting up a VPS, you can use Tao's Masternode setup guide for dummies which has a section on setting up one in Vultr.

     
    #1 BolehVPN, Feb 7, 2016
    Last edited by a moderator: Feb 7, 2016
    • Like Like x 6
  2. BolehVPN

    BolehVPN Active Member

    Joined:
    Nov 24, 2014
    Messages:
    195
    Likes Received:
    301
    Trophy Points:
    123
    Step 1 Secure your wallet

    First of all make sure you have encrypted your wallet. This makes sure your Dash is kept safely even if your computer or wallet falls in the wrong hands.

    Click on Settings > Encrypt Wallet and choose a suitably long passphrase.

    Step 2 Generate a masternode private key and a deposit address.

    Your masternode private key identifies you as the owner of the masternode. It also allows you to vote on budget proposals.

    Although it isn't a good idea to leak out your masternode private key, even if this information is out, your 1000 Dash is safe. If a third party gets hold of this masternode private key, all they can do is use your vote on proposals so it isn't the end of the world.

    Your deposit address is where you will be depositing your 1000 Dash.

    Click on Tools > Debug Console and enter in the following commands as in the picture below.

    [​IMG]

    Copy the two results and save it in a text file for later use. The first result is the masternode private key and the second result is the masternode deposit address. We will use it very shortly!

    Step 3 Deposit your 1000 Dash

    Make sure DarkSend (or Privacy Protect) and InstantX are left UNCHECKED. Send EXACTLY 1000 Dash into the masternode deposit address that you just created in one single transaction. That means, don't send 500 and then another 500! It has to be in one single transaction! When sending it from direct from an exchange, make sure you have accounted for the transfer fees or else you might end up with less than 1000 Dash!

    You now have to wait for 15 confirmations which should take approximately 40 minutes. We can move on to the other steps first while waiting for this!

    Step 4 Install Dashman

    Dashman is an amazing script by Moocowmoo (one of Dash's devs) that automates a lot of the tedious parts of maintaining a masternode.

    SSH into your Linux server.

    Type the following in a terminal.

    sudo apt-get install git
    git clone https://github.com/moocowmoo/dashman.git
    cd dashman
    ./dashman install

    This will create a new hidden folder called .dash in your user directory with all the relevant Dash files. You now need to edit the Dash configuration file.

    nano ~/.dash/dash.conf

    This will bring up a file like this:

    #----
    rpcuser=1c94c9c6ec78e96d78c2db67639ff71340af4f499670ded12bde1f679a5c6634
    rpcpassword=5ee4ffecc41502bc19e18e338c26e84bb03239e7f49ay4e50fd70f40aac6633f
    rpcallowip=127.0.0.1
    rpcport=9998
    #----
    listen=1
    server=1
    daemon=1
    logtimestamps=1
    maxconnections=64
    #----
    #masternode=1
    #masternodeaddr=YOURMASTERNODEIP:9999
    #masternodeprivkey=YOURMASTERNODEPRIVATEKEY

    Delete the three "#" marked in green and enter in your masternode private key that you created in Step 2 in the place marked red. Dashman should have already automatically inserted your masternode ip in the appropriate section but just double check to make sure.

    Press Ctrl X and confirm to save the file.

    Type the following to restart your dash client to use the new settings:

    ./dashman restart

    It is also highly recommended also to setup a simple firewall for added security.

    apt-get install ufw

    Enter the following commands EXACTLY (in this order) to set up your firewall:
    Please note: Make sure you enter the code in this order! If you do not, the program will not work!If need be you can disable your firewall by entering as root: ufw disable.

    ufw allow ssh/tcp
    ufw limit ssh/tcp
    ufw allow 9999/tcp
    ufw logging on
    ufw enable

    Check your firewall's status by entering the following command:

    ufw status

    You will see a message saying that your ufw status is active and will activate upon reboot as well.
     
    • Like Like x 1
    • Informative Informative x 1
  3. BolehVPN

    BolehVPN Active Member

    Joined:
    Nov 24, 2014
    Messages:
    195
    Likes Received:
    301
    Trophy Points:
    123
    Step 5 Create a masternode.conf file on your local PC

    Masternode.conf is a place to put all your masternodes details so your local Dash wallet knows which funds are in masternodes and allows you to label your masternodes.

    You would first need to get your transaction hash and index for the deposit that you did into your masternode deposit address. To do this, go to Tools>Debug Console and type

    masternode outputs

    This will return something like this (the details below are fake but are for illustration purposes only).

    {
    "06e38868bb8f9958e34d5155437d009b72dff33fc28874c87fd42e51c0f74fdb" : "0",
    }

    The transaction hash is the first part marked in blue and the index is the single digit marked in orange (usually 0 or 1). You will need this info to create your masternode.conf.

    Create a new text file called masternode.conf in the same place where dash.conf is located on your local PC (not your masternode server!). On Windows this is located at %appdata%/Dash (type this in Windows Explorer). Open it to edit it and enter in the following format.

    LABEL IP:9999 YOURMASTERNODEPRIVKEY TRANSACTIONHASH INDEX

    LABEL: Any name that you want to call your masternode in one word. For e.g. MN1
    IP: Your masternode IP
    MASTERNODEPRIVKEY: This is the masternode private key that you placed in your remote configuration just now
    TRANSACTIONHASH: This is the transaction hash for the transaction in which you got your 1000 DASH deposited which you obtained just now through the masternode outputs command.
    INDEX: This is the Index of your transaction which you obtained just now through the masternode outputs command.

    To make things clearer let's show a made up example of how a masternode.conf would look like.


    MN1 52.14.2.67:9999 7rxSr3fXpX3dZcU7CoiFuFWqeHYw83r28btCFfIHqf6zkMp1PZ4 06e38868bb8f9958e34d5155437d009b72dff33fc28874c87fd42e51c0f74fdb 0

    Once you have entered the necessary details, save your masternode.conf. Restart your Dash local client so it would take the new settings.

    Note for multiple masternodes:

    If you are creating more than one masternode, the "masternode outputs" command will return several transaction hashes and indexes. Just determine which one is the new one by comparing it with your existing masternode.conf and see which one is not in it.

    You will then add the new corresponding details in new line in masternode.conf. An example is below:

    MN1 52.14.2.67:9999 7rxSr3fXpX3dZcU7CoiFuFWqeHYw83r28btCFfIHqf6zkMp1PZ4 06e38868bb8f9958e34d5155437d009b72dff33fc28874c87fd42e51c0f74fdb 0
    MN2 52.14.2.70:9999 7qmYP6epTN8d3S7pmkKsY52oFWRPCMs99kDe8tY4jkiDcP2X5bM 2788be8a939d445fff0c53ba5a53669925434a7498bd607a0791117633810b6a 1

    Remember to restart your local Dash wallet whenever you edit your masternode.conf.

    Step 6 Starting your Masternode

    Before you proceed, make sure your masternode is synced up to the latest block. To do this, on your masternode server, type:

    ./dashman status

    This will return a result that shows the health and other information on your masternode. Generally if everything is ok, it will appear green. To check if your masternode has fully synced, see this portion of the status:

    [​IMG]

    If your local dashd has the same number as the other ones, you are synced!

    Now startup your local Dash wallet if it isn't open already.

    Open up your terminal and type

    masternode start-missing YOURWALLETPASSWORD

    If all is well, you will see something to similar to this (in this example there are 3 Masternodes listed in masternode.conf)

    {
    "overall" : "Successfully started 3 masternodes, failed to start 0, total 3",
    "detail" : {
    "status" : {
    "alias" : "MN1",
    "result" : "successful"
    },
    "status" : {
    "alias" : "MN2",
    "result" : "successful"
    },
    "status" : {
    "alias" : "MN3",
    "result" : "successful"
    }
    }
    }

    You can also use the command below to selectively start a single masternode.

    masternode start-alias YOURMNLABEL

    To make sure they are properly started, go back to your masternode server and type again

    ./dashman status

    It should show the following:

    [​IMG]

    Sometimes the ninja one may take a few minutes to sync up but if the first two results are YES you should be safe and can check a bit later to ensure that ninja is updated.

    Congratulations, you now have a running masternode!

    Step 7 Getting your Payment and Maintaining your Masternode

    Your first payment may take a week or more to show but afterwards should take place once every 6 days. As long your ./dashman status shows that everything is okay, you should be in line for a masternode payout!

    IMPORTANT NOTE: Everytime you start a masternode, it resets its place in the payout queue thus delaying payments. Therefore although there is also a "masternode start-many " command, it isn't recommended since it would also restart nodes that have no issues. If one of your masternode servers has an issue (for e.g. the server was rebooted), only restart the masternodes which are down by using the masternode start-missing command and not the start-many command.

    If there is a new version of Dash out, you can easily update by issuing the following command on your masternode server which will update your Dash to the latest version.

    ./dashman update

    After you update always double check with a ./dashman status to make sure your masternode is still in a started state. If not, you will have to start it again from your local Dash wallet.

    Step 8 Optional: Auto restart of dashd in the event of crash

    You can also install a monitor to auto restart dash if it crashes. This is optional. The below is taken from Moomoocow's post:

    Install Monit

    sudo apt-get install monit

    Create file /home/user/.dash/start_dashd.sh (change user to yours)

    #!/bin/bash
    /bin/su user -c '/home/user/.dash/dashd 2>&1 >> /home/user/.dash/rc.local.log'

    Make it executable

    chmod 755 /home/user/.dash/start_dashd.sh

    Edit the file /etc/monit/monitrc

    sudo nano /etc/monit/monitrc

    Edit the file as follows:

    # uncomment these lines
    set httpd port 2812 and
    use address localhost # only accept connection from localhost
    allow localhost # allow localhost to connect to the server and
    # add this to bottom - change user to yours
    check process dashd with pidfile /home/user/.dash/dashd.pid
    start program = "/home/user/.dash/start_dashd.sh" with timeout 60 seconds
    stop program = "/bin/su user -c /home/user/.dash/dash-cli stop"

    Load the new configuration

    sudo monit reload

    Enable the watchdog

    sudo monit start dashd

    That's it. You only have to do above once.
    You can check monit's status by typing below:

    sudo monit status

    It'll keep your dashd running for you (across reboots too, no need for any crons or scripts) and keep you from fighting with your chosen OS. Monit only runs once a minute, so be patient if you're waiting for it to do something.

    If you need proof it works, once you see your dashd in the 'sudo monit status' output, you can test it by simply stopping your dashd (dash-cli stop) -- within 2 minutes it'll start it back up.


    If you liked my guide, consider buying me a coffee! DASH Address: XxjGQ3RYTuaNhiiibw7E4LP89qkGN1Tswj
     
    • Like Like x 4
    • Useful Useful x 1
  4. dark_wanderer

    dark_wanderer Member

    Joined:
    Nov 12, 2014
    Messages:
    82
    Likes Received:
    35
    Trophy Points:
    58
    Thanks, Reuben, for this awesome guide :)

    Small remark to:

    As a matter of fact, you can also send the vin of (exactly) 1000 DASH with a DarkSend transaction. The masternode will then be truly anonymous. Of course, it takes several days (2-3) to mix 1000 DASH. At least it was the case for me (a long time ago in a galaxy far far away, before the "Liquidity providers" proposal).

    I did not test whether darksending 1000 DASH with InstantX works too. Did someone?
     
    • Like Like x 2
  5. dark_wanderer

    dark_wanderer Member

    Joined:
    Nov 12, 2014
    Messages:
    82
    Likes Received:
    35
    Trophy Points:
    58
    By the way, what is the status of the "donation address" feature? Is it going to be re-enabled any time soon or is it gone forever?

    One possible use case of the feature: if it becomes possible to start a masternode from an offline paper wallet (with the vin) some day, then how the masternode payments are to be withdrawn? Donating 100 % of the masternode payments to an address, could solve this.
     
    #5 dark_wanderer, Feb 8, 2016
    Last edited by a moderator: Feb 8, 2016
  6. BolehVPN

    BolehVPN Active Member

    Joined:
    Nov 24, 2014
    Messages:
    195
    Likes Received:
    301
    Trophy Points:
    123
    Apparently this features was removed when I spoke to the team.
     
    • Like Like x 1
  7. Simone Paganini

    Simone Paganini New Member

    Joined:
    Nov 28, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    wonderful doc. However I can't find clear instruction on how to add a new masternode.
    I have already a running masternode with VPS and local wallet on PC.
    How do I go about sending the further 1000 DASH?

    Do I just issue:

    masternode genkey

    from the same wallet and then send the 1000 DASH to the address 0?
     
  8. splawik21

    splawik21 Grizzled Member
    Dash Core Team Foundation Member Dash Support Group

    Joined:
    Apr 8, 2014
    Messages:
    1,898
    Likes Received:
    1,277
    Trophy Points:
    1,283
    Hello, you simply open your client, go to RECEIVE and ask for a payment, you`ll receive the address where you need to send the coins. They will be inside your wallet so you will have actual 1000 coin on your address 0 and another 1000 on another address once you send them there. You can always try to send small amount to be sure and feel secure that the payment done on this address will remain on your wallet :)
    Remember to backup your wallet.
    The 'masternode genkey' will give you a key you`ll need to use to sign the masternode start of your second masternode.
     
    • Like Like x 1

Share This Page