How to setup a Machinecoin Masternode using Docker (easier)

Machinecoin Masternode Server Center

How to setup a Machinecoin Masternode using Docker (easier)

Please backup your wallet before doing any of the steps below.
First of all, make sure the requirements for setting up a Masternode are meet
1

Make sure you’ve your 25000 MAC colleteral at your local wallet

2

Make sure your wallet is updated to the latest version (min. 0.16.1.2)

3

Make sure your wallet is fully synced with the network (using txindex)

The guide is splitted into 3 parts
Step 1.1 — Create a text file with the given layout
Masternode:

Private Key:
Address:
Transaction:
Output:
IP:
Step 1.2 — Generate a private key for your Masternode

Open up the console by clicking on “Help” → “Debug window” → “Console”.

Into the console, enter:

masternode genkey

which should output a long string (as you can see on the image on the left).

This is your Masternodes private key, please write it down to your text file into the “Private Key” field.

Step 1.3 — Get the public address of your Masternode

You should still have the console window opened from Step 1.2

Now enter into the console:

getaccountaddress "mymasternode1"

which should output a Machinecoin address (prefixed with a “3” or “9”.

(Feel free to rename “mymasternode1” to anything else)

This is your Masternodes public address, please write it down to your text file into the “Address” field.

Step 1.4 — Transfer your 25000 Machinecoins

Please proceed this step carefully!

You should still have the console window opened from Step 1.2

Now enter into the console:

sendtoaddress "address" 25000

which should output a transaction ID (long string).

(Make sure to replace “address” by the address obtained from Step 1.3)

This is your colleteral transaction ID, please write it down to your text file into the “Transaction” field.

Step 1.5 — Find the right output of your transaction

You should still have the console window opened from Step 1.2

Now enter into the console:

masternode outputs

which should output a list of transaction IDs and a number behind them (long strings).

(You may need to wait for 1 confirmation)

You’ll need to locate your transaction ID from Step 1.4 inside the list and get the number written behind it.

This is your colleteral transaction output, please write it down to your text file into the “Output” field.

Step 2.1 — Setup your remote server

There are many sites out there to rent a server.

I’m going to use a server from Scaleway in this guide with

  • 2 GB RAM
  • 2 CPU cores (x64)

Please make sure to setup a server using Ubuntu Xenial (16.04) as operation system if you want to follow this guide 1:1, since setup instructions can be different for other Linux systems.

Step 2.2 — Obtain the servers IP

Your servers IP address is most likely displayed on it’s dashboard or in the server overview.

For me it’s display in both.

The IP should gave a format like “XXX.XXX.XXX.XXX” or “XX.XX.XXX.XXX”.

Please write it down to your text file into the “IP” field.

Step 2.3 — Connect to your server using SSH

In order to connect to your server, you’ll need a SSH client.

I’m going to use PuTTY in this guide.

(At Scaleway, server authentification is done using SSH keys, but other server providers most likely sent you a mail containing the servers password)

Open up PuTTY and enter the IP obtained in Step 2.2 into the “Hostname / IP” field.

Now click “Open” and you should end up with a black window and a output similar too:

[email protected]:~#

(If you get asked for a username, it’s most likely “root” or provided inside the mail)

Step 2.4 — Prepare the server to run Machinecoin core

Into the SSH shell (this is how the black window is called), enter the following commands in a row:

Those should all work without any errors.

sudo apt-get update
sudo apt-get install git nano python-virtualenv software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce

(Most of those command require to press enter or decide for Yes or No [y/n] followed by an ENTER)

Step 2.5 — Get & run the Machinecoin core image

You should be logged in as user “root“.

Into the SSH shell, enter the following commands in a row:

mkdir /root/machinecoin_data
docker run --name machinecoin_masternode -d \
	--env 'MACHINECOIN_MASTERNODE=1' \
	--env 'MACHINECOIN_MASTERNODE_KEY=PRIVATE_KEY' \
	--env 'MACHINECOIN_MASTERNODE_IP=SERVER_IP' \
	--volume /root/machinecoin_data:/root/.machinecoin \
	-p 40332:40332 -p 40333:40333 \
	machinecoin/machinecoin-core:0.16

(Please replace PRIVATE_KEY by your Masternode private key, and SERVER_IP by your server IP out of the text file you’ve created in part 1 of the guide)

This will output a long string, which is your Docker container ID.

Please be aware, that it’ll take some time for your node to synchronize in the background.

Please wait for the sync to finish, before proceeding to the next step (this should take about 30 minutes). You can take a look at the Machinecoin log files using:

docker logs CONTAINER_ID
Step 2.6 — Setup sentinel and cron

You should still be logged in as user “root“.

Into the SSH shell, enter the following commands in a row:

cd /root/machinecoin_data/sentinel
virtualenv ./venv
./venv/bin/pip install -r requirements.txt

followed by:

crontab -l | { cat; echo "* * * * * cd /root/machinecoin_data/sentinel && ./venv/bin/python bin/sentinel.py >/dev/null 2>&1"; } | crontab -
Step 3.1 — Edit your local Masternode config file

You should now be back at your local PC.

Depending on your operation system, you’ll need to find your Machinecoin Masternode config file.

  • Windows — %appdata%\Machinecoin\masternode.conf
  • Linux — ~/.machinecoin/masternode.conf
  • MacOS — ~/Library/Application Support/Machinecoin/masternode.conf

(Create the file if it doesn’t exist)

Into the file, you’ll need to enter your Masternode details using the following format:

mymasternode1 IP:40333 PRIVATE_KEY TRANSACTION OUTPUT

Example:

mymasternode1 51.15.240.197:40333 6zkQfwtTG8WH56ecgGHMLCXAF9oXEfnwr4DuqVsZGYb8FEmqNxo df3fce788a60a213a02507314b4f337b6a06665ff4727cc785003a80db484a58 1

Save & close the file.

Step 3.2 — Edit your local Machinecoin config file

You should still be back at your local PC.

Depending on your operation system, you’ll need to find your Machinecoin config file.

  • Windows — %appdata%\Machinecoin\machinecoin.conf
  • Linux — ~/.machinecoin/machinecoin.conf
  • MacOS — ~/Library/Application Support/Machinecoin/machinecoin.conf

(Create the file if it doesn’t exist)

Into the file, you’ll need to add the following:

txindex=1

(If you had Machinecoin installed before version 0.16, you’ll need to delete the folders “blocks” and “chainstate” within the directory)

Save & close the file.

Step 3.3 — Start your Masternode

You should still be back at your local PC.

Open up Machinecoin Core and the console window and enter the following.

lockunspent true '[{"txid": "TRANSACTION", "vout": OUTPUT}]'

(replace TRANSACTION and OUTPUT using the fields out of your text file)

This should output:

true

Now close the debug window.

(Make sure the Masternode tab is activated by going to “Settings” → “Options” → “Wallet” and tick the according checkbox)

Now close the options window too and went over to the Masternodes tab inside the wallet.

You should see your Masternode inside the list with the status “MISSING“.

Go ahead and right-click the entry, and select “start-alias“.

 

And that’s it, your Masternode is ready to go!

(You should frequently keep monitoring the status of your Masternode using your local wallet)

Related posts

Leave a comment

8 + nineteen =