oktoshi / libbitcoin

Bitcoin Cross-Platform C++ Development Toolkit

Home Page:https://libbitcoin.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

Coverage Status

Libbitcoin

The Bitcoin Development Library

License Overview

All files in this repository fall under the license specified in COPYING. The project is licensed as AGPL with a lesser clause. It may be used within a proprietary project, but the core library and any changes to it must be published online. Source code for this library must always remain free for everybody to access.

About Libbitcoin

The libbitcoin toolkit is a set of cross platform C++ libraries for building bitcoin applications. The toolkit consists of several libraries, most of which depend on the foundational libbitcoin library. Each library's repository can be cloned and built using common automake 1.14+ instructions. There are no packages yet in distribution however each library includes an installation script (described below) which is regularly verified in the automated build.

Installation

On Linux and Macintosh libbitcoin is built using Autotools as follows.

$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig

Detailed instructions are provided below.

Debian/Ubuntu

Libbitcoin requires a C++11 compiler, currently minimum GCC 4.8.0 or Clang based on LLVM 3.5.

To see your GCC version:

$ g++ --version
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If necessary, upgrade your compiler as follows:

$ sudo apt-get install g++-4.8
$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
$ sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.8 50

Next install the build system (Automake minimum 1.14):

$ sudo apt-get install build-essential autoconf automake libtool pkg-config

Next install the Boost (minimum 1.55.0 for GCC or 1.54.0 for Clang) development package:

$ sudo apt-get install libboost-all-dev

Next download the install script and enable execution:

$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version2/install.sh
$ chmod +x install.sh

Finally, install libbitcoin:

$ sudo ./install.sh

Libbitcoin is now installed in /usr/local/.

Macintosh

The OSX installation differs from Linux in the installation of the compiler and packaged dependencies. Libbitcoin supports both Homebrew and MacPorts package managers. Both require Apple's Xcode command line tools. Neither requires Xcode as the tools may be installed independently.

Libbitcoin compiles with Clang on OSX and requires C++11 support. Installation has been verified using Clang based on LLVM 3.5. This version or newer should be installed as part of the Xcode command line tools.

To see your Clang/LLVM version:

$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

If required update your version of the command line tools as follows:

$ xcode-select --install

Using Homebrew

First install Homebrew. Installation requires Ruby and cURL, which are pre-installed on OSX.

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

You may encounter a prompt to install the Xcode command line developer tools, in which case accept the prompt.

Next install the build system (Automake minimum 1.14) and wget:

$ brew install autoconf automake libtool pkgconfig wget

Next install the Boost (1.54.0 or newer) development package:

$ brew install boost

Next download the install script and enable execution:

$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version2/install.sh
$ chmod +x install.sh

Finally install libbitcoin:

$ ./install.sh

Libbitcoin is now installed in /usr/local/.

Using MacPorts

First install MacPorts.

Next install the build system (Automake minimum 1.14) and wget:

$ sudo port install autoconf automake libtool pkgconfig wget

Next install the Boost (1.54.0 or newer) development package. The - options remove MacPort defaults that are not Boost defaults:

$ sudo port install boost -no_single -no_static -python27

Next download the install script and enable execution:

$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version2/install.sh
$ chmod +x install.sh

Finally install libbitcoin:

$ ./install.sh

Libbitcoin is now installed in /usr/local/.

Notes

The install script itself is commented so that the manual build steps for each dependency can be inferred by a developer.

You can run the install script from any directory on your system. By default this will build libbitcoin in a subdirectory named build-libbitcoin and install it to /usr/local/. The install script requires sudo only if you do not have access to the installation location, which you can change using the --prefix option on the installer command line.

The build script clones, builds and installs two unpackaged repositories, namely:

The script builds from the head of their version3 and version2 branches respectively. The master branch is a staging area for changes. The version branches are considered release quality.

Build Options

Any set of ./configure options can be passed via the build script, for example:

$ ./install.sh CFLAGS="-Og -g" --prefix=/home/me/myprefix

Compiling for Testnet

Currently libbitcoin cannot work with both testnet and mainnet. This restriction will be lifted in a future version. In order to work with testnet in the interim libbitcoin must be recompiled with the testnet option:

$ ./install.sh --enable-testnet

Compiling with ICU (International Components for Unicode)

Since the addition of BIP-39 and later BIP-38 support, libbitcoin conditionally incorporates ICU. To use the BIP-38 and BIP-39 passphrase normalization features libbitcoin must be compiled with ICU support. Currently [libbitcoin-explorer] is the only other library that accesses this feature, so if you do not intend to use passphrase normalization ICU can be avoided:

$ ./install.sh --with-icu

Building ICU and/or Boost

The installer can download and install ICU and/or Boost. These are large dependencies that are not typically preinstalled at a sufficient level. It is recommended to use a prefix directory when building these components.

$ ./install.sh --with-icu --build-icu --build-boost --prefix=/home/me/myprefix

Windows

Visual Studio solutions are maintained for all libbitcoin libraries and dependencies.

The libbitcoin execution environment supports Windows XP Service Pack 2 and newer.

Upgrade Compiler

Libbitcoin requires a C++11 compiler, which means Visual Studio 2013 minimum. Additionally a pre-release compiler must be installed as an update to Visual Studio. Download and install the following tools as necessary. Both are available free of charge:

Create Local NuGet Repository

Dependencies apart from the libbitcoin libraries are available as NuGet packages. The libbitcoin solution files are configured with references to these packages. To avoid redundancies these references expect a NuGet.config in a central location.

The required set of NuGet packages can be viewed using the NuGet package manager from the libbitcoin solution. The NuGet package manager will automatically download missing packages, either from the build scripts or after prompting you in the Visual Studio environment. For your reference these are the required packages:

Build Libbitcoin Projects

After cloning the the repository the libbitcoin build can be performed manually (from within Visual Studio) or using the buildall.bat script provided in the builds\msvc\build\ subdirectory. The scripts automatically download the required NuGet packages.

Tip: The buildall.bat script builds all valid configurations. The build time can be significantly reduced by disabling all but the desired configuration in buildbase.bat.

The libbitcoin dynamic (DLL) build configurations do not compile, as the exports have not yet been fully implemented. These are currently disabled in the build scripts but you will encounter numerous errors if you build then manually.

Optional: Building secp256k1

The secp256k1 package above is maintained using the same Visual Studio template as all libbitcoin libraries. If so desired it can be built locally, in the same manner as libbitcoin. The repository of secp256k1 used by libbitcoin is forked from bitcoin/secp256k1 in order to control for changes and to incorporate the necessary Visual Studio build and cross-compile compatibility fixes:

This change is properly accomplished by disabling the "NuGet Dependencies" in the Visual Studio properties user interface and then importing secp256k1.import.props, which references secp256k1.import.xml.

About

Bitcoin Cross-Platform C++ Development Toolkit

https://libbitcoin.org/

License:Other


Languages

Language:C++ 99.1%Language:Shell 0.7%Language:Python 0.1%Language:Batchfile 0.1%Language:C 0.0%