Compiling an ExclusiveCoin daemon from source

In this tutorial, we will compile a ExclusiveCoin deamon from its Github sources (Linux).

Posted by crypto101 5 months ago

This document is part of the Masternode Installation Guide for ExclusiveCoin.

If you want to run an ExclusiveCoin Masternode, you could in theory use a regular QT-version of the wallet (the version with a user interface). But that would be pretty useless, since there is nothing to 'see': the wallet contains no funds and there will be no transactions to look at.

Most people run their masternode on a (Linux-based) Virtual Private Server (VPS), which has no graphical user interface, just a command-line interface.

So, we'll need a headless (=no user interface) version of the wallet and run it as a daemon (=background) process.

For the lazy (and trusting) among us, 'bumbacoin' release a precompiled version of the Linux deamon. You can download it here. But because we are non-trusting and adventurous, we will compile the deamon from its Github sources.

1. Prepare your environment

To compile the daemon, you will need:

  • A development environment;
  • The ExclusiveCoin sources;
  • The Boost library;
  • The Berkely DB 4.2 Database library (for the wallet file);
  • The MiniUPnP library (to use uPnP);
  • The GMP library;
  • The OpenSSL library.

1.1 Prepare your system for compiling c++ sources

To build the sources, we will need some development tools:

$ sudo apt-get update
$ sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev
$ sudo apt-get install make automake
$ sudo apt-get install g++

Also, we need Git to get the sources from Github:

$ sudo apt-get install git

1.2 Download the sources

Create a folder to download the sources to, eg '~\sources' and download the sources from GIT:

$ cd ~
$ mkdir sources
$ cd sources
$ git clone https://github.com/exclfork/ExclusiveCoin

This will give you an ExclusiveCoin directory with the sources.

1.3 Install Boost

To install the Boost library libboost, the following should be enough (haven't tried it though):

$ sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev

If it's not, you can also install all of it (like I did):

$ sudo apt-get install libboost-all-dev

1.4 Install Berkely DB 4.8

BerkeleyDB is required for the wallet.

Ubuntu and Debian have their own libdb-dev and libdb++-dev packages, but these will install BerkeleyDB 5.1 or later, which break binary wallet compatibility with the distributed executables which are based on BerkeleyDB 4.8.

For Ubuntu only: db4.8 packages are available here. You can add the repository and install using the following commands:

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:bitcoin/bitcoin
$ sudo apt-get update
$ sudo apt-get install libdb4.8-dev libdb4.8++-dev

1.5 Install MiniUPnP

$ sudo apt-get install libminiupnpc-dev

1.6 Install GMP

$ sudo apt-get install libgmp-dev

1.7 Install openSSL

$ sudo apt-get install libssl-dev

2. Compile the sources

Now, we're ready to compile the sources.

2.1 Use make to compile

There is a Makefile (makefile.unix) to build a headless version:

$ cd ~\sources\ExclusiveCoin\src
$ sudo make -f makefile.unix 

This might take quite some time. But if all goes well, you'll end up with an exclusivecoind file in your directory.

If you get errors, see the FAQ below. I'll try to collect errors + solutions there.

2.1 strip the executable

It will be quite a big file (about 111MB) but you can strip unnecessary symbols from it with strip. It will become about 5MB then.

$ strip exclusivecoind

3. Install the deamon

Congratulations, you have a personally-compiled the exclusivecoind daemon for your system!

Finally, copy the file to a folder that's on your PATH, e.g. /usr/local/bin:

$ sudo cp exclusivecoind /usr/local/bin

4. Use it

From now on, you can start the deamon process as follows:

To start the deamon process:

$ exclusivecoind -deamon

To stop the deamon process:

$ exclusivecoind stop

To interact with it:

$ exclusivecoind getinfo
{
    "version" : "v1.2.0.0-61404",
    "blocks"  : 137863,
    ...
}

Useful resources

Frequently Asked Questions

FAQ 1: I get an error virtual memory exhausted: Cannot allocate memory

you don't have enough physical memory to compile. Adding a swap file usually helps. For instructions, see here

Feedback

If you find any errors or have suggestions to improve this document, please let me know!

Just send me a mail: email

I'm also in the exclusivecoin slack group @relaxcl.