How to build a Node on Ubuntu 16.04

RTFM RTFM RTFM RTFM – Ok just read below how to do it.

After we found out why running a Node is important, here is how to run a Node on Linux.

1. Setup your environment.

Setting up your environment properly will allow you to build your node and run it stable in the long run.
You can run a node on a dedicated VPS or like a Virtual Machine on your 24/7 Windows computer. Any way you decide, it is preferable to be on a machine that runs 24/7 and where the node will not stop operating.

Preferred OS will be Ubuntu 16.04. Hardware you need to allocate to your VM is 1 Core, 4GB Ram / 1GB Ram, 20 GB HDD/SSD, 1 NIC. Note that 4GB are needed only for the Build of the Node for some Coins only. Experience shows that for most coins 1GB is enough even for building, while some smaller coins nodes can be run on only 512MB memory. Once you have build the Node you can reduce the memory used and see what is the minimal memory on which the Node will operate.

Install Ubuntu with a SSH server on it, so you connect to it later on. No GUI! Graphical interfaces are for little kids only and you will not be needing it anyway.

After installing Ubuntu, you need to update its packages to their latest versions.
You can use:
sudo apt-get update 
sudo apt-get upgrade 
Don’t do any dist-upgrades or you will move to a different version of Ubuntu.

2. Install your Dependencies.

To do that you need to locate the GitHub of the Coin. Best way is to check the ANN page in Bitcointalk.org or Official Website of the coin. On the Main page you will find the repository of the Coin. Below is how the repository of GunCoin looks like.

So GunCoin is an example of a Coin without a Developer. It was released in 2014 and was not updated any more. Building a Node for this coin will be a good example how to troubleshoot build issues.
Lets go in the Guncoin repository and read the steps from Developer on building the node. You will find just a list of files and no README description. As everything comes from the Bitcoin initial release, you will find instructions on how to build the node in the Doc directory. The build-unix.md is what you need.
Of course, the file is outdated and following its instructions you can’t install all what you need.
That is why a Coin without a Developer soon becomes dead, as new versions of every package on Linux are introduced and there is no one to update the Coin code.

 

Now you can do two things:
1. Follow the build-unix.md file from 2014 and try to build, fixing any issues along the way.
2. Use the script I have created. 🙂
The script below will isntall all you need for the Equihash / NeoScrypt / X11 / etc. coins as of today for Ubuntu 16.04

Do this to create and run the AutoDep script.

sudo touch autodep.sh
sudo chmod 777 autodep.sh
sudo nano autodep.sh

Now Copy/Paste the below in the nano editor.

#!/bin/bash
sudo add-apt-repository -y ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install -y libminiupnpc-dev libboost-program-options1.58-dev libboost-all-dev libqtgui4 libdb++-dev
sudo apt-get install -y libdb4.8-dev libdb4.8++-dev
sudo apt-get install -y build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake
sudo apt-get install -y libssl-dev
sudo apt-get install -y libdb++-dev
sudo apt-get install -y libqrencode-dev

echo $(tput setaf 2) "Build dependancies installed!"
echo $(tput setaf 2) "Now go to https://www.crypto-coinz.net and CLICK CLICK CLICK that banner :)" $(tput setaf 7)

Hit Control+O to Save the file, confirm its name, hit Control+X to exit nano editor.

Now run the script with:
sudo ./autodev.sh

Relax for 20 minutes. All will be installed automatically.

3. Get the Node code and Build it.

You need to clone the code from GitHub and build it. The address to clone is visible once you click the Green Button saying Clone or Download. The address for GunCoin is https://github.com/guncoin/guncoin.git
git clone https://github.com/guncoin/guncoin.git

Now you will find a new directory called guncoin was crated. As you might have seen in the build-unix.md to build the node you need to go in the src directory and run make -f makefile.unix.

cd /guncoin/src
make -f makefile.unix

Now this will take a lot of time. You can monitor the progress and see if there is going to be any error. It’s important that you read what have happened once the process is finished. Errors will be displayed with different colors.

For GunCoin, the the Developer has not maintained the Coin code and you will hit a pretty regular error saying:

/usr/include/boost/variant/get.hpp: In instantiation of ‘typename boost::add_reference::type boost::strict_get(boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>&) [with U = const CScriptID&; T0 = CNoDestination; T1 = CKeyID; T2 = CScriptID; T3 = boost::detail::variant::void_; T4 = boost::detail::variant::void_; T5 = boost::detail::variant::void_; T6 = boost::detail::variant::void_; T7 = boost::detail::variant::void_; T8 = boost::detail::variant::void_; T9 = boost::detail::variant::void_; T10 = boost::detail::variant::void_; T11 = boost::detail::variant::void_; T12 = boost::detail::variant::void_; T13 = boost::detail::variant::void_; T14 = boost::detail::variant::void_; T15 = boost::detail::variant::void_; T16 = boost::detail::variant::void_; T17 = boost::detail::variant::void_; T18 = boost::detail::variant::void_; T19 = boost::detail::variant::void_; typename boost::add_reference::type = const CScriptID&]’:
/usr/include/boost/variant/get.hpp:284:33: required from ‘typename boost::add_reference::type boost::get(boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>&) [with U = const CScriptID&; T0 = CNoDestination; T1 = CKeyID; T2 = CScriptID; T3 = boost::detail::variant::void_; T4 = boost::detail::variant::void_; T5 = boost::detail::variant::void_; T6 = boost::detail::variant::void_; T7 = boost::detail::variant::void_; T8 = boost::detail::variant::void_; T9 = boost::detail::variant::void_; T10 = boost::detail::variant::void_; T11 = boost::detail::variant::void_; T12 = boost::detail::variant::void_; T13 = boost::detail::variant::void_; T14 = boost::detail::variant::void_; T15 = boost::detail::variant::void_; T16 = boost::detail::variant::void_; T17 = boost::detail::variant::void_; T18 = boost::detail::variant::void_; T19 = boost::detail::variant::void_; typename boost::add_reference::type = const CScriptID&]’
rpcrawtransaction.cpp:291:77: required from here
/usr/include/boost/variant/get.hpp:178:5: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE’
BOOST_STATIC_ASSERT_MSG(
^

If you scroll a bit up you will see that the error is generated when building from instructions in rpcrawtransaction.cpp file located in the src folder.

Fix is easy, you have to just change one line in the file.
Line 242 needs to be changed like described in this Error report for Bitcoin.
ERROR REPORT LINK
Save and close the file and start building again.

This time it will finish with spawning a guncoind file. The problems Coins without developers usually get is that the instructions on building the Nodes get outdated and no longer work with the latest versions of the packages they use for the build process.

Now that you have a guncoind file we can copy it to your /usr/bin/ folder so you can access it from anywhere in the Linux box.

cp guncoind /user/bin

Last part is to create a configuration file for the Coin. It is located in hidden directory in your home folder.
If your user is called Dingo, the for GunCoin it will be in /home/Dingo/.guncoin/
In that directory create a file called guncoin.conf and add two lines:

rpcuser=XXX YOUR RANDOM USERNAME XXX
rpcpassword=XXX YOUR RANDOM PASSWORD HERE XXX

This is for the Node to be able to connect to the rest of the network. You don’t need to remember those user and pass.
You can also add some nodes to sync from if you know their addresses with adding lines like below:
addnode=IP ADDRESS OF THE NODE

 

Save the file and start the Node by running sudo guncoind - printtoconsole
Now you will see how the Sync of the node goes.
You can open a new SSH to the VM box and run sudo guncoind getinfo to check up to which block you are synced.

And that’s it. You have running node of your favorite Coin. Congratulations!

If you liked what you just read, please comment in our forum, follow us on twitter or help us keep the light up by donating to the addresses in the footer.