This tutorial describes how to install and configure a Chaincoin masternode inside a Docker container on an Amazon Web Services virtual private server running Ubuntu 14.04 in three easy steps (okay so some of the steps are a bit involved).
Much of the configuration work is automated by the dockerfile, but you will still have to manually configure certain things. In the future I may try to update it by automating even more of the setup. This tutorial assumes a basic understanding of the command line, however non-technical folks should be able to follow along. If at any time you see something that you don't understand, Google search is your friend. Additionally, the fine folks in the Chaincoin slack can be very helpful if you ask questions in the masternode or support channels. Finally as a general disclaimer, never share any passwords or private keys with anyone, even if claim to be helping. That is a sure way to lose all your coins. With that out of the way, lets get started.
1. Set up Your Server on AWS
Creating your Instance
Log into your Amazon Web Services (AWS) management console (if you do not have an account you can create one here).
From the management console click on the EC2 icon and then the 'Launch Instance' button. Scroll down the listed AMIs to select your OS - the rest of this tutorial assumes that you choose the option 'Ubuntu Server 14.04 LTS (HVM), SSD Volume Type (64-bit).' Now chose your instance type. For our purposes the default t2.mirco instance - with 1 vCPU and 1 GB of memory - should be sufficient (as an added benefit this instance type is eligible for AWS free tier). Select that option and click 'Next: Configure Instance Details'. If you have existing networks set up in your VPC adjust these settings to your liking, otherwise you can stick to the defaults. Now click 'Next: Add Storage' and increase the storage size to 25 GiB (you can leave the volume type as General Purpose SSD). Click 'Next: Add Tags' to tag your instance with whatever keywords you like (these are meant to help you keep your account organized, and while not necessary can be helpful). Click the 'Review and Launch' button, check that everything looks right, and launch your instance. When given the option generate and download key pair. Make sure you save the private keys in a safe place and back them up, without your private keys you'll lose access to your server. Again, do not share these keys with anybody.
Now scroll down in the left-hand menu until you see 'Elastic IPs'. Click into here and select 'Allocate new address'. Once created associate it with your new instance. This is important as it will give your server a fixed IP address rather than one that can change over time.
Using your the private keys from the previous step, log into your server over SSH. If you are on a Mac or Linux computer you can SSH directly from the terminal. If you are on Windows machine the easiest way to do this is by installing and running Putty.
Preparing your Environment
Now that you are on your server you will want to do a few things to set up your server environment. While not strictly necessary (since if you have followed these steps so far you will not be logged in as the root user), you may choose to create a user on the server to interact with your masternode. To do so enter the following commands (obviously replacing with you chosen name). The first command creates the user, the second grants it the super user access it will need to complete actions on the site.
adduser
usermod -aG sudo
The one GB of memory on the server may not be sufficient to compile the CHC masternode. Therefore, you need to create a swap file so your server can borrow memory from storage if required. Note that at any time you can run the command free
to see how much free memory is on the system. Run these commands to make a swapfile:
sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
sudo mkswap /var/swap.img
sudo swapon /var/swap.img
Setting the Firewall
You will also want to set your firewall using the Ubuntu's built in firewall service (UFW) in order to disallow all unwanted traffic to your site. You should leave SSH access (port 22), port 8333 (the Bitcoin port - Chaincoin is built on top of some Bitcoin protocols), port 11994 (the Chaincoin port), and port 2376 (Docker) open to incoming traffic. All other ports should be closed to increase security. To do so enter the following commands:
sudo ufw allow OpenSSH
sudo ufw allow 8333
sudo ufw allow 11994
sudo ufw allow 2376
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable
Note port 2376 only needs to be left open for the Docker pull. It can be closed after the installation of the masternode by running sudo ufw deny 2376
. Now that your server is properly configured, you can install the Chaincoin software.
Step 2. Create your Docker container
Before setting up your Docker container you have to install Docker.
Install Docker
sudo apt-get install apt-transport-https
sudo apt-get install ca-certificates
sudo apt-get install curl
sudo apt-get install 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/dists/trusty/stable/"
Install Chaincoin
Now that Docker is installed pull down the Chaincoin Docker image (unofficial, written by me - source code can be found here) and install the masternode by typing:
sudo docker pull mrewers/chc-node
.
Once the image is saved to your server you can create a container with the command: sudo docker run -p 8333:80 -p 11994:80 -t mrewers/chc-node
(note that the -p flags pin port 80 of your container to ports 8333 and 11994 of your server allowing outside traffic to get passed through to your masternode). Now that you have started the container, notice that the username in the terminal window will change from yourname@your_ip_address to root@string_of_characters. Do not be alarmed. This just shows that you are essentially running a second command line terminal for the container, nested inside of your server's terminal. Any changes you make here will only affect the contents of the container. The rest of the steps in this tutorial will take place within the container.
You can leave your container and go back to the server terminal by simple typing exit
. At any time you can check which Docker containers are running on your server by using the command sudo docker ps
. This will list all running containers as well as their ids and random two-word name assigned to the container. You can use either the id or the name of the container in place of 'docker_name' in any command listed below.
To see information about your container enter sudo docker inspect docker_name
. You will need this to find the IP address for you container (which we will be using in the Chaincoin config file). To enter your container type sudo docker exec -it docker_name bash
.
Step 3. Configure your masternode
Start up your container (
sudo docker exec -it docker_name bash
) and enter the Chaincoin directory: cd chaincoin/
.
Now run the script ./autogen.sh
and once that is complete run ./configure --without-gui
. (Initially, when trying to run ./autogen.sh and ./configure the command was not executing. I kept getting the error message: hexdump is required for tests
and the Makerfile was not being generated. Installing bsdmainutils corrected the issue, so I've added it to the Dockerfile's list of dependencies, which you prevent you from experiencing the same issue.)
Once the two above scripts are done, run make
. This process may take a while so be patient while it compiles. Finally run sudo make install
to complete the installation.
Configure chaincoin.conf File
Edit the chaincoin.conf file using either vim (
sudo vi chaincoin.confsudo nano chaincoin.conf
). Both of these programs are common terminal text editors. Nano is much easier for beginners since vim requires a number of somewhat unintuitive commands to operate. Your server may not have nano installed by default, if so to get it simply run sudo apt-get install nano
.
Enter the following lines into the chaincoin.conf file replacing the values in the <> with whatever you like.
rpcuser=[name of your choosing]
rpcpassword=[password - make it secure]
server=1
Save the changes and start up the Chaincoin program with: chaincoind --daemon
.
Run chaincoind getaccountaddress 0
and take down the the result. This is the wallet associated with your masternode.
Next run chaincoind masternode genkey
to generate a private key for your account. Take this down and keep it safe.
Stop the program with chaincoind stop
.
Reopen the chaincoin.conf file and add the following lines to you chaincoin.conf file.
listen=1
maternode=1
masternodeprivkey= masternodeaddr=:11994
Now restart the prgram with: chaincoind --daemon
.
Transfer the Funds
Transfer in exactly 1000 CHC in one transaction to your masternode wallet. (At the time of writing, the best place to acquire CHC is the exchange Cryptopia). The first time around I started with a 5 CHC transfer to make sure everything worked right, and followed it up with the rest. This caused problems and I kept receiving the message
not capable masternode: Could not find suitable coins!
when I tried to start up the masternode even though I has 1000 CHC confirmed in the wallet. When I re-did everything sending the full amount in one transaction (make sure you account for transaction fees).Interacting with your Masternode
Two useful commands at this point will be:
chaincoind getinfo
chaincoind listtransactions
The first one will provide important details about your account including the balance of CHC in your wallet and the blocks upchaincoind getinfo to which your instance is synced. The second will list all transaction into and out of your wallet along with the number of confirmations for each transaction. You can also confirm transactions by looking up your CHC wallet address in the Chaincoin block explorer.
Once you see that your deposit of 1000 CHC has at least 15 confirmations, run chaincoind masternode start
. Your masternode should now be online, you can run chaincoind masternodelist status your_ip_address
to check. If it says ENABLED
you should be good to go and start receiving payments in about 24-48 hours.
Finally, if you run into problems at any point and can't figure out what is going on run tail -f ~/.chaincoin/debug.log
. This will open a scrolling debug log in you terminal where you will see any error messages as they come in. Enter Ctrl + C
to exit the scrolling log (Command + C
on Mac).
Hope this guide helps. If you enjoyed it, please consider contributing to one of the addresses below:
Chaincoin - CKv8p9MuaxT4p4wU4vWhFJbnSSUwgB8Jar
Bitcoin - 1PXaiBU21ecqrmvf2mjLZc4qaTtu1abcGJ
I think you might have saved my life, compiled $EXCL, $ENT, $ARC $MUE and like 10 other wallets, but for some reason the chaincoin soure breaks for me on 5 or 6 different environments, all exactly the same way, was litterally going to nerd rage start smashing things till I found this.... dont quote me yet where still compiling but so far... Im happy
Edit: Confirmed working and quite happy, I cant tell you how bad I was beating my head against a brick wall, and it gets even better now with containers!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @mrewers! You have received a personal award!
Click on the badge to view your Board of Honor.
Do not miss the last post from @steemitboard!
Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @mrewers! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit