How To Set Up Masternodes

More guides coming soon!

How to host a Chaincoin Masternode on windows.

– Thanks to jeffblogs


VPS Hosted Masternode – Video Guide

– Thanks to pr0fess0r

Hey guys, this is pr0fess0r. I hope this guide is helpful, and if you have any questions, please feel free to message me on Slack! Also, if you’d like to donate, I’d really appreicate it:
Donate CHC to: CJ4ArC2PwqyP1ryvyysqEnwk9cQkaEFjPB
Donate BTC to: 1AJxYYPXsbxVdioiBfCedyWn4asGABg8YA

Download PDF here  💾

Alternatively you can use this easy script created by @spookiestevie

sudo apt-get install curl -y && curl -s `http://chaincoin.org/easySetupv2.sh` | bash -s

Step 1 - Introduction

Introduction

We’re going to be setting the masternode up on a Ubuntu server and assume you’re running Windows
Here’s what you’re going to need:
  1. A server running Ubuntu Linux. In this example, we’re going to rent one from Vultr.com. You can use your own, but note that we use a slightly older build of Ubuntu (14.04) for compatibility, so if you’re using a newer version you may encounter some issues.
  2. A static IP address
  3. Basic UNIX or Linux skills – you’re going to be compiling code, potentially dealing with errors, editing files, connecting via SSH etc. (If you get stuck, head over to ChainCoin Slack)
Please also take our security suggestions seriously you’re dealing with currency here, so you want to ensure you’re using strong passwords you don’t use anywhere else, that your personal computer has an up to date antivirus etc.

 

Step 2 - Setting a server

Setting up a Ubuntu server

This is our recommendation for hosting your Masternode server. It’s only $5-$6 per month and is hands-off once you’ve set it up. Vultr is a popular Cloud Computing SSD host for Masternodes.

  1. Create an account on vultr.com
  2. Choose the option to Deploy a Server, as follows:
    1. Choose a region near your location
    2. Choose a 64 bit OS
    3. Select Ubuntu 14.04 x64
    4. Server Size should be 25GB SSD or higher
    5. We recommend enabling auto backups for an additional $1.00/month. If you want DDOS protection it’s an extra $10.00/month – that’s up to you.
    6. Give the server a hostname, and a label to identify it in your Vultr account.
  3. The server will take a few minutes to deploy and will be available in the “Servers” list on the website.
  4. Once your server is set up, you can see it by clicking the Servers menu.
    1. To connect to the server via the console, click the … menu to the right of the Status and you’ll see the option to view the Console.
    2. To retrieve the root password, click the server instance and on the Server Information page, under Overview, you’ll see the password, which you should make a note of and keep somewhere secure.
  5. Make a note of the server’s IP address so you can connect to it later.

Step 3 - Configuring the server

Configuring and securing the server

We recommend you secure your server as soon as possible. In this section, we set up a more secure way to access your server and remove the normal login and password approach for logging in, and we also set up the firewall.

  1. Log in to your server from your computer, using SSH:
    1. If you’re using Windows, you’ll need to download and install a set of tools called PuTTY from http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html These will allow you to connect to your server remotely using a secure protocol known as SSH. Download and install the 32 or 64 bit MSI Windows Installer depending on your computer and set it up. PuTTY is installed by default to C:\Program Files\PuTTY and you might want to make a shortcut to putty.exe on your desktop.
      1. Run putty.exe
      2. Select the “Session” category on the left, if it’s not selected
      3. In the Host Name field, enter your server IP address and set the port to 22
      4. Make sure the Connection Type is SSH
      5. Type a name for this connection in the “Saved Sessions” filed and click Save. Now you can load these settings again future by selecting them and clicking Load.
      6. Click the “Open” button. You should be connected to your server and prompted to login with “root” and the root password you noted when you set the server up.
    2. If you’re on Mac or Linux, you should be able to connect to your server from the Terminal or command prompt using the syntax:

ssh root@your_server_ip

  1. You may be asked about host authenticity if this is the first time you’ve logged in, so you can answer ‘Yes’. You might also be prompted to change your password after logging in, which is also a good idea.
  2. To change your root password, if you are logged in as root, type:

passwd

And enter your new password twice when prompted. Don’t forget it!

  1. The root account is too risky for day-to-day use, so let’s create a new user who can access root powers as needed but is safer to use.
    1. Add a new user with this command:

adduser newusername

    1. You’ll be prompted for a password. Make sure it’s strong, you don’t use it anywhere else, and you keep a copy of it somewhere safe.
    2. You’ll be asked some more questions which you can answer or just skip by pressing enter
    3. Now let’s add this user to the sudo group so where necessary, they can issue commands with superuser privileges:

usermod -aG sudo newusername

    1. Logout of the server and try logging in as this new user to make sure the account is working correctly.
  1. A more secure way to connect to your server than via login and password is to use Public Key Authentication. This involves creating a secure connection between your computer and the server using key files stored on both machines.

Please select your operatiing system below (view document for info);

Security for Mac/UNIX/Linux

Secuirty for Windows

 

  1. Now that you can log in to your server using SSH, let’s remove the ability to log in via username and password, which is less secure.
    1. Log in to your server as newusername and open the SSH daemon configuration:

sudo nano /etc/ssh/sshd_config

2. Find the line that specifies PasswordAuthentication, uncomment it by deleting the # at the start of the line, then change its value to “no”. It should end up looking like this:

PasswordAuthentication no

3.Find, uncomment and change these two values as well:

PubkeyAuthentication yes

ChallengeResponseAuthentication no

    1. When you are finished making your changes, save and close the file using CTRL-X, then Y, then ENTER
    2. Type this to reload the SSH daemon:

sudo /etc/init.d/ssh restart

    1. Password authentication is now disabled. Your server is now only accessible with SSH key authentication.
    2. Test you can still login.
  1. As the final step before we install the Chaincoin Masternode, let’s Setup the firewall. It needs to allow access to OpenSSH so you can login, as well as access to Masternode for clients to connect.
    1. Login to your server as newusername
    2. Enter these commands:

sudo ufw allow OpenSSH

sudo ufw allow 8333

sudo ufw allow 11994

sudo ufw default deny incoming

sudo ufw default allow outgoing

sudo ufw enable

    1. This configures and turns on the firewall.
    2. You should log out and confirm you can still log in.

Step 4 - Compiling the Masternode

Compiling the ChainCoin masternode

  1. Login to your server as newusername
  2. We need to create a swap drive, as compilations fails with a memory error otherwise – this Vultr server doesn’t quite have enough memory to compile the Masternode. The free command shows you how much free memory you have:

free

Run these commands to make a swapfile:

sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=1000

sudo mkswap /var/swap.img

sudo swapon /var/swap.img

Run free again to confirm you now have a swapfile

  1. To make the swap file persist if the server is rebooted:

sudo chmod 0600 /var/swap.img

sudo chown root:root /var/swap.img

sudo nano /etc/fstab

Append the following line to the end of the file:

/var/swap.img none swap sw 0 0

Save the file and exit

  1. Install the dependencies needed before compiling the Masternode

sudo apt-get update

sudo apt-get install automake

sudo apt-get install libdb++-dev

sudo apt-get install build-essential libtool autotools-dev

sudo apt-get install autoconf pkg-config libssl-dev

sudo apt-get install libboost-all-dev

sudo apt-get install libminiupnpc-dev

sudo apt-get install git

sudo apt-get install software-properties-common

sudo apt-get install python-software-properties

sudo apt-get install g++

  1. Download and compile the Berkely DB v4.8 database

sudo add-apt-repository ppa:bitcoin/bitcoin

sudo apt-get update

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

  1. Download the chaincoin source code:

cd ~

git clone https://github.com/chaincoin/chaincoin.git

  1. Compile the masternode using the Berkely DB v4.8 and no GUI

cd ~/chaincoin/

./autogen.sh

./configure – -without-gui

make

sudo make install

  1. Edit the configuration file for the Masternode
    1. Go to the configuration folder:

cd ~/.chaincoin/

    1. If the folder doesn’t exist, create it with

mkdir ~/.chaincoin/

    1. List the contents and look for chaincoin.conf

ls

    1. If the file doesn’t exist, create it like this:

touch chaincoin.conf

    1. Edit the file:

nano chaincoin.conf

    1. Add these lines to the file if they don’t already exist:

rpcuser=username

rpcpassword=password

server=1

The rpcuser and rpcpassword values are for the RPC interface, allowing you to interact with the Masternode from the command line. Use any values you like but keep a copy of them on file somewhere.

  1. Run chaincoind and wait for it to sync. This may take a while as it needs to download a large file.

 

chaincoind –daemon

 

  1. Get an address to deposit CHC into, as this is the cost of starting the Masternode

 

chaincoind getaccountaddress 0

 

  1.  Send exactly 1000 CHC to this address from Cryptopia.
  2. Get a masternode key and make a note of it

 

chaincoind masternode genkey

 

  1. Stop chaincoind

chaincoind stop

 

  1. Update your chaincoin.conf file

 

listen=1

masternode=1

masternodeprivkey=masternodekey

masternodeaddr=<your server ip>:11994

Note: You must have an IP that’s connectable from the internet with port 11994 open.

 

  1. Start chaincoind

chaincoind –daemon

 

  1. Wait for chaincoind to sync, and your 1000 CHC deposit to have 15 confirmations. You can see how many confirmations you have with the command

 

chaincoind listtransactions

 

  1. Once you have 15 confirmations, start your masternode

 

chaincoind masternode start

 

 

Managing your masternode

 

Stopping your masternode:

chaincoind masternode stop

This will stop the Masternode. The Chaincoin daemon will still run.

Monitoring your masternode:

chaincoind getinfo

or

chaincoind masternode current.

You can also do this remotely using the rpc interface.

Closing the masternode and recovering your 1000CHC:

Stop the masternode, and then check your balance

chaincoind getinfo

You might have to wait if your coins are locked up. Then:

chaincoind sendtoaddress <newaddr> <amt>

Once you receive your coins

chaincoind masternode stop