# Installing the Mainchain Software

This documentation outlines how to install the Unification Mainchain software, in order to participate and interact with any of the Mainchain networks.

# Contents

# Installing the latest release binaries

The latest pre-compiled binaries are available from https://github.com/unification-com/mainchain/releases.

  • The undcli binary has been compiled for Linux, OSX and Windows.
  • The und binary has been compiled for Linux only.

Simply download the archives for your OS.

Once downloaded, you can verify the SHA256 checksum against those listed in the release's checksums.txt, for example:

$ openssl dgst -sha256 undcli_v1.4.5_linux_x86_64.tar.gz
SHA256(undcli_v1.4.5_linux_x86_64.tar.gz)= 239559182183648379164f5ff0faa0b3fe0e404f5368e1995e56b2269c93ec05

Extract them and copy the binaries to a suitable location - preferably a location in your $PATH environment variable, for example /usr/local/bin, /opt, etc.

Once installed, verify:

$ und version --long
$ undcli version --long

The output should match the latest release version tag.

# Building from Source

The Mainchain binaries can also be built from source.

# Prerequisites

git, curl and make are required to build the binaries. jq is also useful for quickly looking up values in genesis.json

These can all be installed via your package manager:

sudo apt-get install git curl make jq


sudo yum install git curl make jq

# Install Go

Go 1.13+ is required to build the Mainchain binaries

Install go by following the official docs. Once Go is installed, set your $PATH environment variable:

$ mkdir -p $HOME/go/bin
$ echo "export PATH=$PATH:$(go env GOPATH)/bin" >> ~/.bash_profile
$ source ~/.bash_profile

# Build and install the binaries


unless you are contributing to Mainchain development, it is recommended you checkout and build from the latest release tag and not the master branch if you intend to connect to a live, public network (e.g. TestNet/MainNet).

Download the latest tagged Mainchain release from https://github.com/unification-com/mainchain/releases

The [latest-release-tag] required for the command below can also be obtained by running:

curl --silent "https://api.github.com/repos/unification-com/mainchain/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")'
$ git clone -b [latest-release-tag] https://github.com/unification-com/mainchain
$ cd mainchain
$ make install

This will install the two binaries und and undcli into your $HOME/go/bin

# Verify the installation

Run the following commands:

$ und version --long
$ undcli version --long

If they have installed correctly, you should see output similar to the following:

name: UndMainchain
server_name: und
client_name: undcli
version: 1.3.4
commit: 6913d4e349ef99aef9be0dfe3c03e8381dae0d81
build_tags: netgo ledger
go: go version go1.13.3 linux/amd64

# Development

The included Mainchain DevNet network can be used for development and testing of new features and bug fixes locally. To build the binaries for testing without installing, run:

make build

This will output the binaries to the ./build directory located in the repository root.

See the DevNet docs for more information about running DevNet.

# CLI Help

Both the und and undcli commands can have the --help flag passed to output details on what commands are available, and flags enabled for that command:

und --help
undcli --help

Likewise, the --help flag can be passed to subcommands, for example:

undcli query wrkchain --help

# Next

Running Devnet, joining a network

Last Updated: 6/2/2020, 9:42:42 AM