Instructions: Setting up a Bitrad.io Masternode on Amazon AWS

Goal: let's set up a masternode for Bitradio on a AWS EC2 "nano" instance. Hosting fees will be roughly 5$ per month.

Caution: this is not for the faint of the heart, or the inexperienced. You can loose your BRO this way, and probably mess up part of the matrix too. Don't come blaming me if anything goes wrong. Don't expect support. If you are looking for a painless way to stack BROs, buy some masternode shares directly on Bitrad.io.

Caution 2: at least my masternode is not very profitable ATM, just staking my BRO in a wallet that is permanently open actually seems to earn me more.

Caution 3: right now, this needs the private key for the collateral wallet to be on the server. This is an additional risk to loose 2500 BRO. See my other question in this forum for a possible fix.

What you need

2500 BRO for the collateral, a few BROs more for transaction fees.

An account on Amazon AWS (free).

A synced BRO wallet on your local computer.

Step 1: On Your Local Computer

a) Open the console of your wallet (Help -> Debug window -> Console).

b) Create a new BRO address to hold your collateral: getnewaddress MN1. Copy the address to your notepad. Node that "MN1" is a random name that you can choose yourself.

d) Now send exactly 2500 BRO to the collateral address: sendtoaddress <the address output above> 2500. This can take a long time, up to several hours in my experience. Wait until you have at least one confirmation for this transaction in your transaction list. Copy paste the transaction hash that you got from the sendto command to your notepad.

e) Once the transaction has confirmed, go to the console again and enter masternode genkey. This will create an unique key for your masternode. Store it somewhere safe, treating it like you would treat a private key.

f) Now enter masternode outputs and try to find the above transaction in the list that you get. Write down the small number (0 or 1) next to the transaction.

g) You are done on your local computer for now. Let's set up the server next.

f) The storage that Amazon now suggests (8GB SSD) is fine for now, don't change anything and just hit Next: Add Tags. You don't need to add any tags either, so just hit Next: Configure Security Group.

g) On the Security Group screen, choose Create a new group

f) You need two rules: SSH (TCP), Port 22, My IP. This rule will limit SSH access to the computer and IP address that you are currently on. It's an important security measure. If later you need access from another IP, just add another SSH rule for this IP. The second rule: Custom TCP, Port 32454, Anywhere. This will be the access to your masternode.

g) Now click through to "Review and Launch" and launch the instance. AWS will create a SSH key for you that you need to access the instance. Install this key in the .ssh directory of your local computer. Do some research if you have never done this before.

h) Back on the instance list, you should see your instance starting up now. Wait until it is running.

i) Now go to Elastic IP and create a fixed IP address. Assign this address to your running instance. Write down the address.

j) Back in the instance list, right-click on the instance entry and select Connect to learn how to connect to your instance. SSH into your instance following the Connect instructions.

n) Now set up a job to launch the daemon on system startup. Enter crontab -e and choose Nano as the editor. Enter a single line at the bottom of the file: @reboot /home/ubuntu/Bitradio/src/Bitradiod. Or another address if you moved the Bitradiod. Save the file.

o) Back on the command line, start the daemon again, entering ./Bitradiod &. The daemon should now start properly.

p) Now comes the thing I would want to avoid. Once the daemon runs, go back to the command line and enter ./Bitradiod importprivkey <the private key to the collateral wallet>. Log out of the machine by entering exit and immediately log back in again. Delete .bash_history in your home directory to avoid leaking your private key. Now enter sudo reboot (this will terminate your session).

q) Log back into your machine and check whether the launch of Bitradiod on reboot worked. Go to Bitradio/src and enter ./Bitradiod getinfo. This should give you some info on the daemons status and synchronization with the network. It might take a long time for the blockchain to sync. Wait until "blocks" corresponds to the actual number of blocks. Because you have imported the collateral private key, getinfo should also show you 2500 BRO in collateral once the blockchain has fully synced.

Step 3: Activation, Back on Your Local Computer

a) Whew, almost there. You an now launch your masternode from your local computer. Go to Masternodes -> My Masternodes and hit Create....

b) In the window that pops up, enter the info that you gathered above. Any name that you like as an alias, the elastic IP address INCLUDING the port, e.g. 33.33.33.33:32454, the private key that you got from masternode genkey (not the one for the collateral), the transaction hash and the small 0 or 1 number that you got from masternode outputs.

c) Now hit OK and back on the overview, hit Start all.

d) Your masternode should now start up and you should soon see Masternode is Running next to its entry in the list.

Step 4: Verification

a) SSH back into your server. In Bitradio/src, enter ./Bitradiod masternode status. This should give you some info and an EMPTY string next to notCapableReason. If you got some error info there, you'll need to debug.

Step 5: Downsize

a) We can now downsize the masternode machine to save hosting fees. Go to the EC2 Instance list again, and create an Image of the instance by right-clicking on it.

b) Go to Images -> AMIs and wait until your image is finished. Make sure to wait, or you'll destroy your setup.

c) Go back to the instance list and terminate the running instance.

d) Set up a new instance like you did above, only this time: you choose the image you created unter My Amis instead of Ubuntu, and you also don't have to recreate the security group and your SSH key since you can use the old ones. On the instance type selection, make sure to select a nano instance. This will work, but only cost about $5 bucks in hosting costs per month.

Congrats! If you got that far without too many errors, you should now have a BRO masternode up and running.

Make sure to research some info about securing your AWS instance and about monitoring its performance to get the best out of your masternode and to prevent the loss of your BRO.

If this was helpful, please send me a few BRO: BeSckzFdAjpENmxpcUP7LtVMnvboGfepJh, and contribute back to this post by reporting any errors and omissions.