Exonum core and most other Exonum repositories use the Rust programming language and the corresponding toolchain. This document details how to setup development environment for contributing to these projects, testing them, and developing using Exonum.
Currently, you need to compile the core locally for every application that depends on it. Cargo (the Rust package manager) takes care of most things, but you still need to have dependencies installed locally as described below for the core to compile.
In future releases, Exonum will become more modular and will work as a standalone application. See the roadmap for more details.
Exonum depends on the following third-party system libraries:
- RocksDB (persistent storage)
- libsodium (cryptography engine)
- Protocol Buffers (mechanism for serializing structured data)
You can find instructions how to install dependencies in various environments below.
Install the necessary libraries using Homebrew:
brew install libsodium rocksdb pkg-config protobuf
For distributives with
deb-based package managers (such as Debian or Ubuntu),
apt-get install build-essential libsodium-dev libsnappy-dev \ librocksdb-dev pkg-config libprotobuf-dev protobuf-compiler
protobuf installation add the following dependencies:
add-apt-repository ppa:maarten-fonville/protobuf apt install libprotobuf-dev protobuf-compiler
Package names and installation methods may differ in other Linux distributives; use package manager tools to locate and install dependencies.
Depending on the version of your distributive, libsodium, RocksDB and Protobuf may not be present in the default package lists. In this case you may need to install these packages from third-party PPAs, or build them from sources.
Windows support is experimental. In case of any issues, please create an issue on GitHub.
Install the latest version of the following packages:
Use package manager Chocolatey to install Protobuf:
choco install -y protoс
Adding Environment Variables
If your OS contains pre-compiled
you may setup
SNAPPY_LIB_DIR environment variable
to point to a directory with these libraries.
This will significantly reduce compile time.
export ROCKSDB_LIB_DIR=/usr/local/lib export SNAPPY_LIB_DIR=/usr/local/lib
export ROCKSDB_LIB_DIR=/usr/lib/x86_64-linux-gnu export SNAPPY_LIB_DIR=/usr/lib/x86_64-linux-gnu
Exonum repositories use the stable Rust toolchain that can be installed by using the rustup program:
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable
For Windows, download and run
the rustup website instead.
The Rust toolchain includes the Rust compiler (
rustc) and several utilities,
of which the most important one is Cargo, the Rust package manager.
Exonum is guaranteed to be compatible with the latest stable Rust toolchain, which can be obtained as specified above. Other recent toolchains may work too; see the Exonum main repository readme to find out a precise range of supported Rust versions. Older toolchains (for example, those that come with Linux distributions) might cause Exonum compilation to fail, as Exonum uses some new language features. Please use rustup to install a compatible toolchain in this case.
You can verify that you installed dependencies and the Rust toolchain correctly
by cloning the
exonum repository and running its built-in unit test suite:
git clone https://github.com/exonum/exonum.git cd exonum cargo test -p exonum
Notice that running tests may require up to 30 GB free disk space.
Light Client Library
The light client library itself can run both on Node and in browsers.
Developing with Exonum
The Cryptocurrency Tutorial provides a step-by-step guide on how to develop applications on top of the Exonum framework.