Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

GreenAddress C/C++ SDK

GDK is a cross-platform, cross-language library for Blockstream Green wallets.

Read the API documentation at

Build Status

Meson/Ninja build:

Build dependencies:

For Debian Stretch:

sudo apt update && sudo apt install build-essential python3-pip ninja-build clang wget autoconf pkg-config libtool swig (optional)
sudo pip3 install -r tools/requirements.txt or pip3 install --user -r tools/requirements.txt

For Mac OSX:

Install Xcode and brew if not installed, then

brew update && brew install ninja automake autoconf libtool gnu-sed python3 wget pkg-config swig (optional) gnu-getopt gnu-tar
pip3 install --user meson
xcode-select --install

Install rust dependencies (Optional):

  1. Install rustup: curl --proto '=https' --tlsv1.2 -sSf | sh

  2. Install default rust toolchain: rustup install 1.49.0

  3. Install additional rust targets: rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android x86_64-pc-windows-gnu aarch64-apple-ios x86_64-apple-ios

You may also need to change your PATH environment variable to add $HOME/Library/Python/3.6/bin

If you want to target Android you will need to download the NDK and set the ANDROID_NDK env variable to the directory you uncompress it to, for example

export ANDROID_NDK=$HOME/Downloads/ndk

or you can add it to your bash profile ~/.bash_profile

JAVA bindings can be built by installing swig as explained above and setting JAVA_HOME to the location of the JDK.

To build:

tools/ <options>

Options exist to build for a particular configuration/platform (flags in squared brackets are optional):

--ndk [armeabi-v7a arm64-v8a x86 x86_64]
--iphone [static]

for example

tools/ --gcc

Build output is placed in build-<target>, e.g. build-clang, build-gcc sub-directories.

You can quickly run a single targets build from the build-<target> sub-directory using:


To clean:


Docker based deps & build

This doesn't require any of the previous steps but requires docker installed; it will build the project

docker build -t greenaddress_sdk - < tools/Dockerfile
docker run -v $PWD:/sdk greenaddress_sdk

This will build the sdk with clang by default

if you want to change it for example to ndk armeabi-v7a:

docker run -v $PWD:/sdk greenaddress/ci bash -c "cd /sdk && ./tools/ --ndk armeabi-v7a"

Extra build options

Debug builds

By default the build type is release. A debug build can specified as

tools/ --buildtype=debug --clang


tools/ --buildtype=debugoptimized --clang

for a debug optimized build.

Rust-Electrum support

Pass --enable-rust to build the rust-electrum single signature support as used by e.g. Aqua.

Disable LTO

By default builds use link time optimisation. It can be disabled when invoking For example

tools/ --lto=false --clang

Clang Analyzer

To build using clang-analyzer use

tools/ --analyze --clang

Clang tidy

The clang-tidy targets are enabled if found in the PATH. Extra options exist to specify version of it,

tools/ --clang-tidy-version=7 --clang

then use as follows

ninja src/clang-tidy


A sanitizer build can be invoked using

tools/ --sanitizer=<type> --gcc

where <type> is any available sanitizer of your choice and available on the toolchain being used.

Compiler versions

A different compiler version can be specified as

tools/ --compiler-version=<version>

which allows for multiple side by side installs of compilers in common linux distributions.

Build examples

Use clang-5.0, no LTO, enable clang-tidy and debug build

./tools/ --compiler-version=5.0 --buildtype=debug --lto=false --clang-tidy-version=5.0 --clang

Use address sanitizer with gcc-7, no LTO, enable clang-tidy and debug build

./tools/ --compiler-version=7 --buildtype=debug --lto=false --sanitizer=address --clang-tidy-version=5.0 --gcc

Use clang-analyzer (it'll analyze GDK and its direct dependencies)

./tools/ --analyze --clang

Upgrading dependencies

Use tools/, for example to upgrade wally

./tools/ -l libwally-core -s 987575025520d18bac31e6e2d27c8c936d812c64 -u

Java and Python wrappers

Java and Python wrappers are available if SWIG is installed.

If JAVA_HOME is set while the library is built, a Java wrapper is built exposing the API.

Similarly, if --python-version is passed to tools/ a Python wrapper is built, for example:

./tools/ --install $PWD --gcc --python-version 3.7

Swift wrapper

A swift wrapper is available at GreenAddress.swift.