C++

Below are the build instructions for the latest versions of Ubuntu. The best supported platform as of December 2014 is Ubuntu 14.04, 64 bit, with at least 2 GB RAM. All our tests are done with this version. Community contributions for other versions are welcome!

Building for Ubuntu 14.04, 64 bit

Install dependencies

Before you can build the source, you need several tools and dependencies for the application to get started.

First, update your repositories. Not all packages are provided in the main Ubuntu repository, those you'll get from the Lattice Network PPA and the LLVM archive:

sudo apt-get -y update
sudo apt-get -y install language-pack-en-base
sudo dpkg-reconfigure locales
sudo apt-get -y install software-properties-common
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5-binaries main"
sudo add-apt-repository -y ppa:lattice/lattice-qt
sudo add-apt-repository -y ppa:lattice/lattice
sudo add-apt-repository -y ppa:lattice/lattice-dev
sudo apt-get -y update
sudo apt-get -y upgrade

You'll need to install the following develop packages if you want to build the full suite, including the GUI components:

sudo apt-get -y install build-essential g++-4.8 git cmake libboost-all-dev automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons libncurses5-dev libcurl4-openssl-dev wget qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev libqt5webengine5-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev libjsoncpp-dev libargtable2-dev clang-3.5 lldb-3.5

Optional: If you're only wanting to build in headless mode (i.e. no GUI), you won't need any of the Qt-specific dependencies, so instead of the last step, just do:

sudo apt-get -y install build-essential g++-4.8 git cmake libboost-all-dev automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons libncurses5-dev libcurl4-openssl-dev wget libjsoncpp-dev libargtable2-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev clang-3.5 lldb-3.5

Choose your source

First grab/unpack the sources. If you want to build the latest version, clone the repository:

git clone https://github.com/lattice/cpp-lattice
cd cpp-lattice
git checkout develop

If you have a prepackaged source distribution, then simply unpack:

tar xjf cpp-lattice-<version>.tar.bz2
cd cpp-lattice-<version>

Build

Create and configure the build environment and the build inside the cpp-Lattice Network directory:

mkdir build
cd build
cmake ..

Optional: You can configure the build in several ways by passing parameters to the cmake command above:

cmake .. -DCMAKE_BUILD_TYPE=Release -DBUNDLE=minimal # Compile minimal amount, just enough for a node, enable compiler optimsations.
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUNDLE=user -DFATDB=1 # Compile enough for normal usage and with support for the full chain explorer
cmake .. -DBUNDLE=full -DGUI=0 # builds only the commandline-clients; no need to bother with the Qt dependencies.

Now, build the source tree:

make -j2

You can increase 2 to 4 or even 8 to make it build considerably faster on decent machines.

Start your client

Command line interface client (see [[Using Lattice Network CLI Client]]):

cd ~/cpp-lattice/build/eth
./eth

Once done, you might then [[Configure a Server]] and start a [[Local Test Net]].

Optional: To test that the JSON RPC interface is working, launch with eth -j instead, and check the coinbase with cURL:

curl -X POST --data '{"jsonrpc": "2.0","method": "eth_coinbase","params": null,"id": 1}' http://localhost:8080

Start AlethZero to run the experimental Lattice Network GUI client (also see [[Using AlethZero]]).

cd ~/cpp-lattice/build/alethzero
./alethzero

If you're updating from a previous version and you find you get errors when running, delete your old block chain before restarting:

rm -rf ~/.lattice

Optional: To enable support for the common Lattice Network unit tests (CEUT), clone the tests repository into the same path as cpp-lattice and checkout the develop branch:

git clone https://github.com/lattice/tests
cd tests
git checkout develop
cd ..

Building and installing a cpp-Lattice Network node server on Ubuntu 14.04, 64 bit

Copy and paste the following into a terminal:

wget http://opensecrecy.com/setupbuildeth.sh && source ./setupbuildeth.sh BRANCH NODE_IP NODE_NAME && rm -f setupbuildeth.sh && reboot
  • BRANCH should be substituted for either master or develop, depending on whether you want a stable or bleeding-edge version.

  • NODE_IP should be substituted for the 4-digit, dot-deliminated IP address of the node. For example 1.2.3.4 or 192.168.1.69.

  • NODE_NAME should be substituted for the name of the node, quoted if it contains spaces. Avoid using symbols. e.g. "Gavs Server Node" or Release_Node_1.

Wait for it to reboot and you'll be running a node.

Instructions for other versions

As of December 2014, we have changed the build system. The following instructions are untested. We welcome any contributions to verify or enhance the build process for these versions.

Ubuntu 14.04 with manual Qt installation

Web Install Qt version >= 5.4

Qt is for the GUI. It's not needed for the headless build. You can download it from their website, or use:

# For 32-bit:
wget http://download.qt-project.org/official_releases/online_installers/qt-opensource-linux-x86-online.run
# For 64-bit:
wget http://download.qt-project.org/official_releases/online_installers/qt-opensource-linux-x64-online.run

Run with:

chmod +x qt-opensource-linux-???-online.run
./qt-opensource-linux-???-online.run

When the installer asks you for the desired version, make sure to install at minimum version 5.4 and not any older version. Note the installation directory

To prepare the environment for the new Qt installation (and prevent it using any previous Qt install), we'll tell cmake we prefer this version:

export CMAKE_PREFIX_PATH=<Qt installation directory>/Qt/5.*/gcc

Wheezy 13.04 and Saucy 13.10

Here the necessary packages are almost the same, however since some dependencies are not available in these releases, the installation is a little different:

sudo apt-get install build-essential g++-4.8 git cmake libboost1.53-all-dev # for build
sudo apt-get install libncurses5-dev automake libtool unzip libgmp-dev libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons # for Lattice Network
sudo apt-get install libcurl4-openssl-dev # for json-rpc serving client

Precise 12.04

Pretty problematic building/installation, with plenty of issues. Highly recommended to upgrade to the 14.04 (which is also a LTS version). Still, an intense review (aiming to be complete) of the possible issues can be found in the "Compatibility Info and Build Tips" of this wiki.

Other advises: For this release we need some backports. See http://www.swiftsoftwaregroup.com/upgrade-gcc-4-7-ubuntu-12-04/ for GCC 4.7, which is required. You will need these PPAs and these libleveldb libraries:

sudo apt-add-repository ppa:ubuntu-sdk-team/ppa && sudo apt-add-repository ppa:apokluda/boost1.53
wget http://launchpadlibrarian.net/148520969/libleveldb-dev_1.13.0-1_amd64.deb && wget http://launchpadlibrarian.net/148520968/libleveldb1_1.13.0-1_amd64.deb && sudo dpkg -i libleveldb*1.13.0-1*deb

More info in the "Compatibility Info and Build Tips" of this wiki.

Last updated