# Installing the Mainchain Software
This documentation outlines how to install the Unification Mainchain und
software as a client, in
order to interact with any of the Mainchain networks to query data/send transactions.
TIP
If you intend to run a node and/or become a validator, follow the Install und with Cosmovisor instead.
# Installing the latest release binaries
IMPORTANT!
If you are upgrading your und
binary from a previous version to v1.8.x, Cosmos SDK v0.46.x uses a new keyring
interface, and your keyring will be migrated the first time you interact with the upgraded und
Please ensure you back up your keystore first, and make sure you have safely copied private keys and written down mnemonics!
On Linux systems, for example, the keyring may be located in
$HOME/.local/share/keyrings/UndMainchain.keyring
Safely backup your keyring and any keyfiles you may be using!
The latest pre-compiled binaries are available for download from https://github.com/unification-com/mainchain/releases (opens new window).
- The
und
binary has been compiled for Linux, OSX and Windows.
Download the latest version of und
- for example, using Linux:
mkdir -p $HOME/tmp && cd $HOME/tmp
wget https://github.com/unification-com/mainchain/releases/download//und__linux_x86_64.tar.gz
wget https://github.com/unification-com/mainchain/releases/download//checksums.txt
Once downloaded, you can verify the SHA256 checksum against those listed in the release's checksums.txt
, for example:
openssl dgst -sha256 ARCHIVE_NAME.tar.gz
Replacing ARCHIVE_NAME.tar.gz
with the archive you downloaded, e.g. und_v1.9.0_linux_x86_64.tar.gz
should output something like:
SHA256(und_v1.9.0_linux_x86_64.tar.gz)= e03079ba9e4484b73e0469e4afc2372be4dca10a7013337fd9505edaa6823082
Extract them and copy the binaries to a suitable location - preferably a location in your $PATH
environment variable,
for example /usr/local/bin
.
tar -zxvf ARCHIVE_NAME.tar.gz
sudo mv und /usr/local/bin/und
Once installed, verify:
which und
should output:
/usr/local/bin/und
and:
und version --log_level=""
The output should be .
# Building from Source
The Mainchain binaries can also be built from source.
# Prerequisites
git
and make
are required dependencies for building. curl
and/or wget
are recommended, and jq
is useful for
quickly looking up values in, for example genesis.json
These can all be installed via your package manager, for example:
sudo apt-get install git curl wget make jq
or
sudo yum install git curl wget make jq
# Install Go
Go 1.22+ is required to build the Mainchain binaries
Install go
by following the official docs (opens new window).
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
IMPORTANT
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 (opens new window)
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.*?(?=")'
Then run:
$ git clone -b [latest-release-tag] https://github.com/unification-com/mainchain
$ cd mainchain
$ make install
This will install the und
binary into your $HOME/go/bin
# Verify the installation
Run the following commands:
und version --long
If und
has been installed correctly, you should see output similar to the following:
name: UndMainchain
server_name: und
version: 1.9.0
...
...snip...
# 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 und
commands can have the --help
flag passed
to output details on what commands are available, and flags enabled for that
command:
und --help
Likewise, the --help
flag can be passed to subcommands, for example:
und query wrkchain --help