Bitcoin 2 Masternode Setup Guide

Last edited November 16 2018

Russian Translation: Русская версия - переведено волонтером

Basic requirements for running a BTC2 Masternode

  1. 1000 BTC2.
  2. The Masternode computer that will be running 24/7 and an IP address for it that can be used by no more than one BTC2 Masternode. Static IP recommended.
  3. Your personal computer or laptop. It can control multiple masternodes.
  4. Minimum 1 GB of RAM on the Masternode.
  5. More than 2 GB of HDD space will be used by the OS + Bitcoin 2 Core. At least 5 GB HDD recommended.
  6. If your hosting plan's bandwidth is metered, then at least 20 GB/month of bandwidth recommended but not required.

The basic reasoning for these requirements is that, you get to keep your BTC2 in your local wallet, and host your masternode remotely, securely. First you need to decide where you want to host your masternode. A VPS or a dedicated server is recommended.

Some VPS hosts

  1. aws.amazon.com (Free for 12 months for new accounts.)
  2. cloud.google.com/free/ (For new accounts: free $300 worth of credits to be used in 12 months + one always free micro google compute engine instance.)
  3. Vultr.com $5/month
  4. mp-hosting.co.uk ~$3.14/month
  5. virmach.com $4/month
  6. virpus.com $5/month
If you choose any other service than Amazon AWS or Google cloud, then after you’ve got your server details, you need to go through some initial setup before you do anything Masternode related. You can follow these 3rd party instructions.

Amazon's AWS service to host your Masternode

You can signup to Amazon's AWS service to host your masternode for free for up to 12 months.
However the free amount of outgoing bandwidth limitation of 15 GB/month means that on some months you might get charged a little bit.
Includes: One t2.micro instance (64 bit linux or windows, 15 GB bandwidth/month, 1 GB RAM, 1 virtual CPU, 30 GB HDD space)

Choose an Ubuntu instance (v.16.04 for example) or if you're not comfortable with Linux, you can choose a Windows instance.

Go with the defaults but change the storage space to the maximum free allowed. Which at the time of writing this article is 30 GB.

In the last step before clicking "Review and Launch" you should set up 2 additional fire wall rules.
* One to allow TCP traffic from all IPs for port 8333
* One to allow UDP traffic from all IPs for port 8333
Inbound AWS firewall rules

Generate a private key there and download the file when asked and follow the instructions on their website about how to connect to your new node.

in the EC2 management console, ensure you've created and associated an elastic IP with your instance. You can then use that elastic IP address to connect to the node.

Limits for free use to be aware of:
15 GB outgoing bandwidth per month at the time of writing this article. If it goes over that, it's likely to cost only cents in a month.
1 GB of RAM means you need to set up swapping by executing the following commands on your AWS instance (using Putty for example):

Linux only:
sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
sudo chmod 600 /swapfile
sudo mkswap /swapfile
echo /swapfile none swap defaults 0 0 | sudo tee -a /etc/fstab
sudo swapon /swapfile

AWS specific instruction for later stages of this guide:
Use the private IP for the "bind=" value in bitcoin2.conf on the masternode. Use the elastic IP for externalip and mastenodeaddr.

How to setup the Bitcoin 2 Masternode

  1. Using the main wallet on your local computer, enter the debug console and type the following commands:
    masternode genkey
    getaccountaddress masternodename1

    "masternodename1" being the name you give the masternode address, which you can choose yourself. Copy-paste the output you get from masternode genkey to a notepad for later, this is your MASTERNODEPRIVKEY.

  2. Send 1000 BTC2 to the public address you generated in Step 1, making sure to send exactly 1000, in one transaction.

  3. Then after a minute or two, still in the debug console, enter: masternode outputs - and copy-paste the output to your notepad, this is the TXID and INDEX you will need later.

  4. Still on the local/personal computer, go into the Bitcoin 2 data directory, by default in Windows it’ll be %Appdata%/bitcoin2

    Find masternode.conf and add the following line to it with your own values and without the “[]”s:
    [Name of Masternode(Use the name you entered earlier for simplicity)] [Unique/Static IP address]:8333 [Masternode private key - The result of Step 1] [TXID - Result of Step 3] [INDEX - The number after the long line in Step 3]

    Example: masternodename1 192WPpkqbr7sr6Si4fdsfssjjapuFzAXwETCrpPJubnrmU6aKzh c8f4965ear7a68d0e6dd384324dfd28cfbe0c801015b973e7331db8ce018716999 1

  5. Still on the local/personal computer, edit the bitcoin2.conf file (located in the same directory as masternode.conf)

    rpcuser=long random username of your own
    rpcpassword=longer random password of your own

    Save it, close and restart the wallet.

  6. Next we’re going to login to the server through ssh command-line and install the masternode wallet.

    First we need to download the wallet on our server

    Linux: cd ~/ # Or whatever directory you want.

    Linux: wget https://github.com/BITC2/bitcoin2/releases/..... (get the latest x86_64-linux-gnu.tar.gz version)

    Linux: and extract the files with: sudo tar -zxvf [filename]

    Linux: Create the data directory: mkdir ~/.bitcoin2/

  7. Still on the masternode, find the Bitcoin 2 data directory. (Linux: ~/.bitcoin2. Windows: %Appdata%/bitcoin2). Open or create the bitcoin2.conf file and make it look like this:

    rpcuser=long random username of your own
    rpcpassword=longer random password of your own
    externalip=your public ip address
    bind=your ip address (for Amazon AWS, the private IP. For Google Cloud, the Primary internal IP.)
    masternodeaddr=your public ip address:8333 (keep the :8333 as the port number)
    masternodeprivkey=Result of Step 1

  8. Start the Bitcoin 2 daemon on the masternode and let it sync.

    Linux: cd bitcoin2/bin

    Linux: ./bitcoin2d
    Windows: Launch bin/bitcoin2d.exe

    to check the current block you are on run: ./bitcoin2-cli getinfo

    and compare the "blocks" value to the latest block on your local computer's wallet's to the output of the getinfo command on the debug console or a web block explorer. If it's the same, you are ready to move on to the next step.

  9. Now you just need to start it with the controlling wallet on your local computer. (Make sure wallet is unlocked).
    Start bitcoin2-qt and go to the Masternodes tab and click "Start MISSING". A masternode needs to be online and started for a minimum of 45 minutes before you can start getting rewards from running it.

    All done, congratulations!

How to make the Bitcoin 2 daemon run on start-up in Ubuntu/unix-based system

To help ensure uninterrupted service, when connected by SSH to the masternode, make the Bitcoin 2 daemon run on start-up in case of a reboot:

if you installed bitcoin2d to /etc/init.d/:

sudo update-rc.d bitcoin2d defaults
// in case of error, try
sudo update-rc.d bitcoin2d enable

Or if you installed it elsewhere:

sudo vi /etc/rc.local # or vim. Press Esc and type :wq and Enter to exit and save.

and add ./path/to/bitcoin2d -datadir=/home/ubuntu/.bitcoin2 #(or your custom datadir where bitcoin2.conf is) to the file

Optional: Automatically combine your BTC2 rewards

It is recommended to use the command autocombinerewards in the debug console on your local wallet in order to not have too many 0.2 BTC2 rewards over time slowing down your wallet.

Example: autocombinerewards true 50
Every time a block is received, this would check if it can combine all unspent transactions in one address that are below 50 BTC2 and create a transaction (with the normal fees) that combines them if they total 50+ BTC2, and sends to that same address of yours.
You only need to execute the command once and you can disable it at anytime with: autocombinerewards false

Optional: Encrypt your local wallet to better secure your BTC2

Unless you trust that you never have viruses on your computer and you are sure that no one else ever has access to your computer, you may want to encrypt your local wallet that contains the BTC2 masternode collaterals and that will receive the rewards. The downside is that then your local wallet would not be staking, but you would still get the rewards for running the masternode.

You can do it by clicking Settings, and then Encrypt wallet. Or use your own encryption tool. All your backups would need to be encrypted too for it to be useful.

You may want to make a human readable wallet dump as well with the debug console command dumpwallet, or just dump the private keys one by one with the dumpprivkey command if you only have a few addresses in use. And then encrypting whatever file contains the wallet dump or the private keys. This way you can import just the useful private keys later to another wallet or the web wallet if needed one day.

Optional: How to stake additional BTC2 with your VPS/server/masternode

Please note that the following method is not as safe as staking from your own local wallet usually.
If you want to send extra coins to your server, VPS or masternode in order for it to start staking with them 24/7, you can do it as follows:

On the server/masternode, run: ./bitcoin2-cli getnewaddress

Send whatever amount you want to that address. You can send a test amount like 0.001 BTC2 first.
If you send more than 500 BTC2, then it is better to send it in at least a few transactions in order to maximize staking efficiency.

To make sure that you received the coins, Run: ./bitcoin2-cli getinfo
and look at your balance.

After at least 1 hour and 42 minutes, run:
./bitcoin2-cli stop # In order to restart the wallet with the next command.
./bitcoin2-cli getstakingstatus # This should report true for everything. If so, then you are staking!

And then when you want to send BTC2 from the server/masternode to some address, use: ./bitcoin2-cli sendtoaddress BTC2Address AmountInBTC2

Optional: Speed up your local wallet if it has slowed down too much

If after months of receiving 100s of rewards you notice your wallet.dat file becoming bigger than 20 MB and you feel that your wallet is too slow, you may consider doing these steps to move your BTC2 to a fresh installation with less clutter:

  1. Rename masternode.conf to oldmasternode.conf.
  2. Stop Bitcoin 2 Core.
  3. Create a new Bitcoin 2 installation with -datadir=another data directory specified in a new shortcut to a bitcoin2-qt executable, and copy all the files to it from the old directory, except for backups and wallet.dat.
  4. Launch Bitcoin 2 Core in the new directory.
  5. Get the receiving addresses from it and transfer to them with the old installation. Including transferring to new masternode public addresses. (The masternode private keys made with masternode genkey can stay the same.)
  6. Rename oldmasternode.conf back to masternode.conf in the new directory and edit it to include the new collateral_output_txid and the new collateral_output_index (and aliases if you created different ones.)