Instructions: Setting up a 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
    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.
    <h2>What you need</h2>
    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.
    <h2>Step 1: On Your Local Computer</h2>
    a) Open the console of your wallet (Help -&gt; Debug window -&gt; Console).
    b) Create a new BRO address to hold your collateral: getnewaddress MN1. Copy the address to your notepad. Node that &quot;MN1&quot; is a random name that you can choose yourself.
    c) Back up the private key for this address: dumpprivkey &lt;the address output above&gt;. Store the private key somewhere safe, e.g. in an encrypted password vault (or use whatever method you prefer to backup your private keys).
    d) Now send exactly 2500 BRO to the collateral address: sendtoaddress &lt;the address output above&gt; 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.
    <h2>Step 2: On Amazon AWS</h2>
    a) Log into the AWS management console and go to the EC2 service. Click Instance -&gt; Instances.
    b) Hit Launch Instance. We will be creating a bigger instance first, because we need this to compile the Bitradio daemon. We will later downsize the instance to a cheaper variant.
    c) On the OS list that now comes up, select Ubuntu 16.04 LTS.
    d) On the next screen, select a t2.medium instance. Don't hit Review and Launch, but rather Next: Configure Instance Details to get to the next screen.
    e) On the next screen, Step 3, don't change anything, just hit Next: Add Storage.
    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 &quot;Review and Launch&quot; 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.
    k) Now build Bitradiod according to the instructions found here: You can either trial-error your way through the dependencies (this will take about an hour or two), or you can be cleverer than me and learn about the dependencies here:…/master/doc/, then install them first.
    l) When you have finally managed to build Bitradiod, you can launch it by simply entering ./Bitradiod in the Bitradio/src directory. This will generate an error first.
    m) Now the daemon should have created a hidden directory in ~/.Bitradio. Go in there and update Bitradio.conf. E.g. by using nano Bitradio.conf.

    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 &amp;. 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 &lt;the private key to the collateral wallet&gt;. 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 &quot;blocks&quot; 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.
    <h2>Step 3: Activation, Back on Your Local Computer</h2>
    a) Whew, almost there. You an now launch your masternode from your local computer. Go to Masternodes -&gt; 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., 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.
    <h2>Step 4: Verification</h2>
    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.
    <h2>Step 5: Downsize</h2>
    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 -&gt; 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.
    Thanks to @primus,…i-masternody-bitradio-bro, for providing some of the info presented here.