Building Fetch.AI Ledger Node

Constellation is a C++ executable which houses several of the ledger components. It includes a transaction processing system, an (optional) block miner, the blockchain system, the “offchain” lanes, and all the networking code that allows it to talk to other running Constellations.

It is written in cross-platform C++11 and should currently compile for MacOS using clang and Linux using either clang or Gnu C++.



We recommend familiarity with the following:

  • Using a command-line development environment.
  • Using the UNIX filesystem.
  • Using the Git source management system.
  • Using a code editor. (The development team use a selection of VIM, CLine and Emacs.)


  1. Install Apple’s XCode via the AppStore - ensure Xcode version is no later than 10.1.
  2. Install brew.
/usr/bin/ruby -e "$(curl -fsSL"

3. Configure the path for OpenSSL.

  • Edit your ~/.bash_profile
  • Add this line to the end of it. Note the BACKTICK ` characters.
export OPENSSL_ROOT_DIR="/usr/local/Cellar/openssl/`ls /usr/local/Cellar/openssl/ | sort | tail -1`"

4. Open a new shell window to pick up the changes or re-login.

5. Install git and add the alias pullall.

brew install git

git config --global alias.pullall '!f(){ git pull "[email protected]" && git submodule sync --recursive && git submodule update --init --recursive; }; f'

6. Make sure you have cmake and OpenSSL .

brew install cmake
brew install openssl

NB: If you have any issues with OpenSSL, run the following:

cmake -DOPENSSL_ROOT_DIR=/usr/local/ssl -DOPENSSL_LIBRARIES=/usr/local/ssl/lib


We recommend that you should be familiar with the following topics:

  • Using a command-line development environment.
  • Using the UNIX filesystem.
  • Using the Git source management system.
  • Using a code editor. (The development team use a selection of VIM and Emacs.)

We recommend that you should:

  • You use Ubuntu.
  • Use BASH as your login shell.

Ubuntu & Mint


  1. Install compilers and the command-line toolchain.
apt-get install build-essential clang git

2. Set environment variables:

export CC=clang
export CXX=clang++

You will need to add these to either the system profile /etc/profile or to your login script.

RedHat & Derivatives


  1. Install compilers and the command-line toolchain.
yum install -y sudo
yum install -y make
yum install -y cmake
yum install -y libpng-devel
yum install -y zlib-devel
yum install -y openssl-devel
yum install -y python-devel
yum install -y clang
yum install -y epel-release
yum install -y python-pip
yum install -y git 
pip install --upgrade pip
pip install --upgrade cldoc
yum install -y autoconf
yum install -y automake
yum install -y wget
yum install -y which
yum install -y tree

Download and Build Fetch.AI Ledger

Download from Git

  1. Get the code:
  • Make a suitable directory for your checkouts.
  • Change into that directory, run git init , and execute the git commands:
git clone [email protected]:fetchai/ledger.git

cd fetch-ledger
mkdir build/

git checkout develop

2. Edit the config file

  • Open fetch-ledger/.git/config in a suitable editor.
  • Make sure the github: is replaced with the “[email protected]:”
  • There may be several of these to replace, or it may already be done for you.

3. Now execute:

git pull
git submodule update --recursive --init

Building the Source Code

Follow these steps:

cd build/
cmake ..
make constellation

If you wish to build the entire library, run:

make -j

Running Constellation

Command Line Arguments

Name Description Default
port The starting port for ledger services 8000
executors The number of executors to configure 4
lanes The number of lanes to be used 4
slices The number of slices to be used 4
peers The comma separated list of addresses to initially connect to
db-prefix The directory or prefix added to the node storage node_storage
network-id The network id 0x10
interface The network id
block-interval Block interval in milliseconds. 5000
bootstrap Bootstrap network address
token The authentication token to be used with bootstrapping the client
mine Enable mining on this node 0
external This node's global IP addr.
host-name The hostname / identifier for this node
config The path to the manifest configuration
processor-threads The number of processor threads Number of cores
verifier-threads The number of verification threads Number of cores in the system
max-peers The number of maximal peers to send to peer requests. 3
transient-peers The number of the peers which will be random in answer sent to peer requests. In milliseconds. 1
peers-update-cycle-ms How fast to do peering changes. 0 (0 means Trust system is disabled)
p2p-process-cycle-ms How fast the p2p inner cycle spins. 1000
p2p-manifest-update-cycle-ms Manifest update cycle. 500
p2p-block-catchup-cycle-ms Block catch up cycle. 1000

Running Several Constellations

First, start a single miner node on port 8000, which can have a maximum of 3 connections. Set the block mining period to 3 seconds. To make the node a miner we add the -mine argument when we start the Constellation:

cd build/
./apps/constellation/constellation -port 8000 -block-interval 3000 -mine

Next, start a second node on port 8020.This node won’t do any mining, so we leave out the -mine argument. To connect this node to the miner node, we pass it the address of the miner node +1. Connecting ports are always defined as +1 the node port to connect to.

./apps/constellation/constellation -port 8020 -peers tcp://

The third node will be on port 8040. This node connects to the first two nodes.

./apps/constellation/constellation -port 8040 -peers tcp://,tcp://

To add more nodes to the network, repeat the previous step using different ports and the same or different peers.


St. John's Innovation Centre,
Cowley Road,
Cambridge, CB4 0WS, UK

Go to map
Technical: [email protected]
Investors: [email protected]