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.
c) Back up the private key for this address:
dumpprivkey <the address output above>. 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 <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
sendtocommand 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 outputsand 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.
Step 2: On Amazon AWS
a) Log into the AWS management console and go to the EC2 service. Click
Instance -> Instances.
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.mediuminstance. Don't hit
Review and Launch, but rather
Next: Configure Instance Detailsto 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 "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 IPand 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
Connectto learn how to connect to your instance. SSH into your instance following the
k) Now build Bitradiod according to the instructions found here: https://github.com/thebitradio/Bitradio. 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: https://github.com/thebitradio/Bitradio/blob/master/doc/build-unix.md, then install them first.
l) When you have finally managed to build Bitradiod, you can launch it by simply entering
Bitradio/srcdirectory. 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
rpcuser=Bitradiorpc rpcpassword=<random long password> rpcallowip=127.0.0.1 daemon=1 server=1 listen=1 longtimestamps=1 maxconnections=256 masternode=1 masternodeprivkey=<the masternode key you generated earlier> externalip=<the elastic IP>
n) Now set up a job to launch the daemon on system startup. Enter
crontab -eand 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
exitand immediately log back in again. Delete
.bash_historyin 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
./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 Masternodesand hit
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. 22.214.171.124: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
c) Now hit OK and back on the overview, hit
d) Your masternode should now start up and you should soon see
Masternode is Runningnext 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 -> AMIsand 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 Amisinstead 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
nanoinstance. 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, https://golos.io/ru--kriptovalyuty/@primus/instrukciya-kak-nastroit-i-zapustit-masternodu-poshagovoe-rukovodstvo-na-primere-ustanovki-masternody-bitradio-bro, for providing some of the info presented here.