- Branches
- Supported Operating Systems
- Binary Installation
- Build and Install from Source
- Bash Autocomplete
Spring is a C++ implementation of the Antelope protocol with support for Savanna consensus. It contains blockchain node software and supporting tools for developers and node operators.
The main
branch is the development branch; do not use it for production. Refer to the release page for current information on releases, pre-releases, and obsolete releases, as well as the corresponding tags for those releases.
We currently support the following operating systems.
- Ubuntu 22.04 Jammy
- Ubuntu 20.04 Focal
Other Unix derivatives such as macOS are tended to on a best-effort basis and may not be full featured. If you aren't using Ubuntu, please visit the "Build Unsupported OS" page to explore your options.
If you are running an unsupported Ubuntu derivative, such as Linux Mint, you can find the version of Ubuntu your distribution was based on by using this command:
cat /etc/upstream-release/lsb-release
Your best bet is to follow the instructions for your Ubuntu base, but we make no guarantees.
This is the fastest way to get started. From the latest release page, download a binary for one of our supported operating systems, or visit the release tags page to download a binary for a specific version of Spring.
Once you have a *.deb
file downloaded for your version of Ubuntu, you can install it as follows:
sudo apt-get update
sudo apt-get install -y ~/Downloads/spring*.deb
Your download path may vary. If you are in an Ubuntu docker container, omit sudo
because you run as root
by default.
Finally, verify Spring was installed correctly:
nodeos --full-version
You should see a semantic version string followed by a git
commit hash with no errors. For example:
v1.0.1-9026a03c09c9b4f93edca696b5eef259f0ab96b3
You can also build and install Spring from source.
You will need to build on a supported operating system.
Requirements to build:
- C++20 compiler and standard library
- CMake 3.16+
- LLVM 7 - 11 - for Linux only
- newer versions do not work
- libcurl 7.40.0+
- git
- GMP
- Python 3
- python3-numpy
- zlib
If you don't have the Spring repo cloned to your computer yet, open a terminal and navigate to the folder where you want to clone the Spring repository:
cd ~/Downloads
Clone Spring using either HTTPS...
git clone --recursive https://github.com/AntelopeIO/spring.git
...or SSH:
git clone --recursive [email protected]:AntelopeIO/spring.git
ℹ️ HTTPS vs. SSH Clone ℹ️
Both an HTTPS or SSH git clone will yield the same result - a folder namedspring
containing our source code. It doesn't matter which type you use.
Navigate into that folder:
cd spring
Choose which release or branch you would like to build, then check it out. If you are not sure, use the latest release. For example, if you want to build release 1.0.1 then you would check it out using its tag, v1.0.1
. In the example below, replace v0.0.0
with your selected release tag accordingly:
git fetch --all --tags
git checkout v0.0.0
Once you are on the branch or release tag you want to build, make sure everything is up-to-date:
git pull
git submodule update --init --recursive
Select build instructions below for a pinned build (preferred) or an unpinned build.
ℹ️ Pinned vs. Unpinned Build ℹ️
We have two types of builds for Spring: "pinned" and "unpinned." A pinned build is a reproducible build with the build environment and dependency versions fixed by the development team. In contrast, unpinned builds use the dependency versions provided by the build platform. Unpinned builds tend to be quicker because the pinned build environment must be built from scratch. Pinned builds, in addition to being reproducible, ensure the compiler remains the same between builds of different Spring major versions. Spring requires the compiler version to remain the same, otherwise its state might need to be recovered from a portable snapshot or the chain needs to be replayed.
⚠️ A Warning On Parallel Compilation Jobs (-j
flag)⚠️
When building C/C++ software, often the build is performed in parallel via a command such asmake -j "$(nproc)"
which uses all available CPU threads. However, be aware that some compilation units (*.cpp
files) in Spring will consume nearly 4GB of memory. Failures due to memory exhaustion will typically, but not always, manifest as compiler crashes. Using all available CPU threads may also prevent you from doing other things on your computer during compilation. For these reasons, consider reducing this value.
🐋 Docker and
sudo
🐋
If you are in an Ubuntu docker container, omitsudo
from all commands because you run asroot
by default. Most other docker containers also excludesudo
, especially Debian-family containers. If your shell prompt is a hash tag (#
), omitsudo
.
The pinned reproducible build requires Docker. Make sure you are in the root of the spring
repo and then run
DOCKER_BUILDKIT=1 docker build -f tools/reproducible.Dockerfile -o . .
This command will take a substantial amount of time because a toolchain is built from scratch. Upon completion, the current directory will contain a built .deb
and .tar.gz
(you can change the -o .
argument to place the output in a different directory). If needing to reduce the number of parallel jobs as warned above, run the command as,
DOCKER_BUILDKIT=1 docker build --build-arg SPRING_BUILD_JOBS=4 -f tools/reproducible.Dockerfile -o . .
The following instructions are valid for this branch. Other release branches may have different requirements, so ensure you follow the directions in the branch or release you intend to build. If you are in an Ubuntu docker container, omit sudo
because you run as root
by default.
Install dependencies:
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
git \
libcurl4-openssl-dev \
libgmp-dev \
llvm-11-dev \
python3-numpy \
file \
zlib1g-dev
On Ubuntu 20.04, install gcc-10 which has C++20 support:
sudo apt-get install -y g++-10
To build, make sure you are in the root of the spring
repo, then run the following command:
mkdir -p build
cd build
## on Ubuntu 20, specify the gcc-10 compiler
cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 ..
## on Ubuntu 22, the default gcc version is 11, using the default compiler is fine
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 ..
make -j "$(nproc)" package
Now you can optionally test your build, or install the *.deb
binary packages, which will be in the root of your build directory.
Spring supports the following test suites:
Test Suite | Test Type | Test Size | Notes |
---|---|---|---|
Parallelizable tests | Unit tests | Small | |
WASM spec tests | Unit tests | Small | Unit tests for our WASM runtime, each short but very CPU-intensive |
Serial tests | Component/Integration | Medium | |
Long-running tests | Integration | Medium-to-Large | Tests which take an extraordinarily long amount of time to run |
When building from source, we recommended running at least the parallelizable tests.
This test suite consists of any test that does not require shared resources, such as file descriptors, specific folders, or ports, and can therefore be run concurrently in different threads without side effects (hence, easily parallelized). These are mostly unit tests and small tests which complete in a short amount of time.
You can invoke them by running ctest
from a terminal in your Spring build directory and specifying the following arguments:
ctest -j "$(nproc)" -LE _tests
The WASM spec tests verify that our WASM execution engine is compliant with the web assembly standard. These are very small, very fast unit tests. However, there are over a thousand of them so the suite can take a little time to run. These tests are extremely CPU-intensive.
You can invoke them by running ctest
from a terminal in your Spring build directory and specifying the following arguments:
ctest -j "$(nproc)" -L wasm_spec_tests
We have observed severe performance issues when multiple virtual machines are running this test suite on the same physical host at the same time, for example in a CICD system. This can be resolved by disabling hyperthreading on the host.
The serial test suite consists of medium component or integration tests that use specific paths, ports, rely on process names, or similar, and cannot be run concurrently with other tests. Serial tests can be sensitive to other software running on the same host and they may SIGKILL
other nodeos
processes. These tests take a moderate amount of time to complete, but we recommend running them.
You can invoke them by running ctest
from a terminal in your Spring build directory and specifying the following arguments:
ctest -L "nonparallelizable_tests"
The long-running tests are medium-to-large integration tests that rely on shared resources and take a very long time to run.
You can invoke them by running ctest
from a terminal in your Spring build directory and specifying the following arguments:
ctest -L "long_running_tests"
Once you have built Spring and tested your build, you can install Spring on your system. Don't forget to omit sudo
if you are running in a docker container.
We recommend installing the binary package you just built. Navigate to your Spring build directory in a terminal and run this command:
sudo apt-get update
sudo apt-get install -y ./spring_*.deb
It is also possible to install using make
instead:
sudo make install
cleos
and spring-util
offer a substantial amount of functionality. Consider using bash's autocompletion support which makes it easier to discover all their various options.
For our provided .deb
packages simply install Ubuntu's bash-completion
package: apt-get install bash-completion
(you may need to log out/in after installing).
If building from source install the build/programs/cleos/bash-completion/completions/cleos
and build/programs/spring-util/bash-completion/completions/spring-util
files to your bash-completion directory. Refer to bash-completion's documentation on the possible install locations.