Multiple Masternodes - Single VPS

How to run multiple Masternodes daemons of the same coin on a single VPS

Coin Project: CTSC

Backgroud Info: The native installer script installs the required files as user "root" and copies important files as follows:

Binaries in /usr/local/bin/

Wallet files in /root/.ctsc/

The native installer enables the built-in software firewall and opens port tcp/CHANGE.

The MN daemon does not support running on a TCP port other than it's native port as there would be no way for other nodes on the network to know what port your are on, therefore you must obtain a secondary IP for your VPS.

The default MN daemon is installed as a service, hence it runs automatically every time the system reboots and is controlled using service call commands.

The additional secondary daemons will run manually. Running the additional daemons as services, performing further automation and health checks is beyond the scope of this guide.

If you get lost in the directory / folder structure while using the command line, use "cd ~" to return to the home directory, use "pwd" to display your current directory location. The home directory for user "root" is "/root".

Pre-requisites:

  • Each instance of a masternode daemon consumes memory and cpu. If you plan to run multiple masternodes a VPS with a minimum of 2 vCPUs and 4Gb RAM is recommended.

  • Make sure your default masternode is working properly and that you are receiving rewards.

  • Obtain a secondary public IP for your VPS and set it up per your provider's instructions. Make sure you can ping the new IP from your local computer.

  • Perform the following in the windows wallet just as you did when setting up the original masternode:

    • Create a new receiving address such as Masternode02 via the debug console with the command "getaccountaddress Masternode02"

    • Send the required number of CTSC to that address and wait for the required 6 confirmations!!

    • Open the debug console and type: (from Tools menu)

      • masternode genkey (copy & paste into notepad)

      • masternode outputs (you should see 2 outputs, copy & paste into notepad)

  • Open the Masternode configuration file: (from Tools menu)

  • Add the following line at the end of the file:

    • Masternode02 :31832 <-- make sure is not the same one as Masternode01

  • Save & exit.

  • Exit wallet and launch it again.

  • Once wallet is up you should see a new entry in the "Masternodes" tab with the status of MISSING.

  1. Login to your VPS as "root".

  2. Make necessary modifications to your mn wallet configuration file:

    • cd ~/.ctsc

    • cp ctsc.conf ctsc.conf.old <-- make a copy of your original config file just in case

    • nano ctsc.conf

  3. Modify the file to look like this:

    listen=0

    #bind= to bind=

  4. Save your changes and exit:

    • Ctrl + X, YES, Enter

  5. Stop the default instance of the masternode:

    • systemctl stop CTSC.service (wait a few seconds)

  6. Start your default mn instance and make sure it successfully started: (this will start the mn with the new changes)

    • systemctl start CTSC.service (wait a few seconds)

    • ctsc-cli masternode status

    • If MN does not start after a few minutes go back and verify the ctsc.conf file for typos.

  7. Stop once again the default instance of the masternode:

    • systemctl stop CTSC.service

  8. Copy the wallet files to a new directory:

    • cd ~

    • cp -r .ctsc .ctsc2/

  9. Start again your default MN and make sure it runs successfully:

    • systemctl start CTSC.service

    • ctsc-cli masternode status

  10. Now we will make changes to the second wallet:

    • cd ~/.ctsc2

    • nano ctsc.conf

  11. Modify the following lines:

    rpcport=41526 <-- choose a port other than the original, this port must be unique for the entire VPS.

    port=41526 <-- Do NOT change this, this must remain as the original coin port

    bind= <-- The new secondary IP you acquired for your VPS

    externalip=

    masternodeprivkey=

  12. Exit & save:

    • Ctrl + X, YES, Enter

  13. Go back to your home folder/directory:

    • cd ~

  14. Start the new masternode & wait for the blocks sync:

    • ctscd -datadir=/root/.ctsc2 <-- starts daemon in second wallet

    • ctsc-cli -datadir=/root/.ctsc2 getinfo <-- verify & wait for blocks to synch with your windows wallet

    • ctsc-cli -datadir=/root/.ctsc2 masternode status <-- result should show "Hot node, waiting for remote activation."

  15. Back in the windows wallet, highlight the new masternode and click on "Start alias"

  16. Back in the VPS check the secondary masternode status again:

    • ctsc-cli -datadir=/root/.ctsc2 masternode status <-- result should now show "Masternode successfully started"

  17. type crontab -e , select nano for preferred editor then at bottom of file add the following:

    @reboot ctscd -datadir=/root/.ctsc2

  18. To stop the secondary masternode:

    • ctsc-cli -datadir=/root/.ctsc2 stop

Congratulations! You are all set.

You can setup additional nodes by repeating the previous steps with a new number. You should stop adding nodes when the CPU and/or Memory utilization on your VPS reaches an average of 80%. Also note that there may be a limit on the number of secondary IPs you can have.

To check the status of the masternodes:

  • ctsc-cli masternode status <-- operates on the first/default masternode

  • ctsc-cli -datadir=/root/.ctsc masternode status

  • ctsc-cli -datadir=/root/.ctscX masternode status <-- operates on the secondary "X" masternode