Bitcoin full node and query server
Documentation is available on the wiki.
Downloads are available for Linux, Macintosh and Windows.
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 on-line. 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 instructions.
About Libbitcoin Server
A full Bitcoin peer-to-peer node, Libbitcoin Server is also a high performance blockchain query server. It can be built as a single portable executable for Linux, OSX or Windows and is available for download as a signed single executable for each. It is trivial to deploy, just run the single process and allow it about two days to synchronize the Bitcoin blockchain.
Libbitcoin Server exposes a custom query TCP API built based on the ZeroMQ networking stack. It supports server, and optionally client, identity certificates and wire encryption via CurveZMQ and the Sodium cryptographic library.
The API is backward compatible with its predecessor Obelisk and supports simple and advanced scenarios, including stealth payment queries. The libbitcoin-client library provides a calling API for building client applications. The server is complimented by libbitcoin-explorer (BX), the Bitcoin command line tool and successor to SX.
Libbitcoin Server can be built from sources or downloaded as a signed portable single file executable.
On Linux and Macintosh Libbitcoin Server is built using Autotools as follows.
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install # optional
$ sudo ldconfig # optional
Detailed instructions are provided below.
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
Next install the build system:
$ sudo apt-get install build-essential autoconf automake libtool pkg-config
Next install the Boost (minimum 1.49.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-server/version2/install.sh
$ chmod +x install.sh
Finally install Libbitcoin Server:
$ sudo ./install.sh
Libbitcoin Server is now installed in /usr/local/bin
and can be invoked as $ bitcoin_server
.
The OSX installation differs from Linux in the installation of the compiler and packaged dependencies. Libbitcoin Server 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 Server 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
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 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-server/version2/install.sh
$ chmod +x install.sh
Finally install Libbitcoin Server:
$ ./install.sh
Libbitcoin Server is now installed in /usr/local/bin
and can be invoked as $ bitcoin_server
.
First install MacPorts.
Next install the build system 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-server/version2/install.sh
$ chmod +x install.sh
Finally install Libbitcoin Server:
$ ./install.sh
Libbitcoin Server is now installed in /usr/local/bin
and can be invoked as $ bitcoin_server
.
Any set of ./configure
options can be passed via the build script, several examples follow.
Building for minimum size and with debug symbols stripped:
$ sudo ./install.sh CXXFLAGS="-Os -s"
The
-s
option is not supported by the Clang compiler. Instead use the command$ strip bitcoin_server
after the build.
Building with NDEBUG (no debug assertions) defined:
$ sudo ./install.sh --enable-ndebug
Building without building tests:
$ sudo ./install.sh --without-tests
Building for testnet:
$ sudo ./install.sh --enable-testnet
Building from a specified directory, such as /home/me/mybuild
:
$ sudo ./install.sh --build-dir=/home/me/mybuild
Building into a directory other than /usr/local
, such as /home/me/myprefix
:
$ ./install.sh --prefix=/home/me/myprefix
Building and linking with a private copy of the Boost dependency:
$ ./install.sh --build-boost --prefix=/home/me/myprefix
Building a statically-linked executable:
$ ./install.sh --disable-shared --build-boost --prefix=/home/me/myprefix
Building a small statically-linked executable most quickly:
$ ./install.sh CXXFLAGS="-Os -s" --enable-ndebug --without-tests --disable-shared --build-boost --prefix=/home/me/myprefix
Building with bash-completion support:
If your target system does not have it pre-installed you must first install the bash-completion package. Packages are available for common package managers, including apt-get, homebrew and macports.
$ sudo ./install.sh --with-bash-completion-dir
Visual Studio solutions are maintained for all libbitcoin libraries and dependencies. The supported execution environment is Windows XP Service Pack 2
and newer.
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:
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 and conflicts across libbitcoin repositories these references expect a NuGet.config in a central location. Despite flexibility in locating NuGet.config, NuGet writes the individual package paths into project files. As such the central repository should be configured in the same relative location as indicated by these paths within the project files. See NuGet Repository below.
The required set of NuGet packages can be viewed using the NuGet package manager from the Libbitcoin Server 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:
- Packages maintained by sergey.shandar
- Packages maintained by evoskuil
To build Libbitcoin Server you must also download and build its libbitcoin dependencies, as these are not yet packaged. The builds can be performed manually (from within Visual Studio) or using the buildall.bat
script provided in the builds\msvc\build\
subdirectory of each repository. The scripts automatically download the required NuGet packages.
Tip: The
buildall.bat
scripts build all valid configurations. The build time can be significantly reduced by disabling all but the desired configuration in thebuildbase.bat
of each project.
Build these solutions in order:
- libbitcoin/libbitcoin
- libbitcoin/libbitcoin-blockchain
- libbitcoin/libbitcoin-node
- libbitcoin/libbitcoin-server
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.
Configuration options are exposed in the Visual Studio property pages.
The non-boost packages above are all sourced from GitHub repositories maintained using the same Visual Studio template as the libbitcoin libraries. If so desired each of these can be built locally, in the same manner as the libbitcoin libraries above. This allows you to avoid using the pre-built NuGet packages. The repositories for each dependency are as follows:
- Cryptography
- Zero Message Queue
This change is properly accomplished by disabling the "NuGet Dependencies" in the Visual Studio properties user interface for each libbitcoin project and then importing the .import.props
file(s) for the corresponding dependencies.
NuGet packages are downloaded to a local file systems repository. By default the NuGet Package Manager uses a repository path within the solution. This can complicate source control and results in multiple repositories across solutions.
A better configuration is to centralize the NuGet repository outside of your git
directory, for example:
-me
-git
nuget.config
-libbitcoin
-libbitcoin-blockchain
-libbitcoin-node
-libbitcoin-server
-builds
-msvc
-vs2013
-bitcoin-server
bitcoin-server.vcxproj
packages.config
libbitcoin-server.sln
-nuget
repositories.config
+boost.1.56.0.0
+boost_chrono-vc120.1.56.0.0
+boost_date_time-vc120.1.56.0.0
+boost_filesystem-vc120.1.56.0.0
+boost_program_options-vc120.1.56.0.0
+boost_regex-vc120.1.56.0.0
+boost_system-vc120.1.56.0.0
+boost_unit_test_framework-vc120.1.56.0.0
+czmq_vc120.2.2.0.8
+czmqpp_vc120.1.0.0.10
+libsodium_vc120.1.0.0.0
+libzmq_vc120.4.1.0.7
+secp256k1_vc120.0.1.0.3
If properly configured the NuGet Package Manager will share this NuGet repository across all solutions within the git
directory. There are three steps required in this configuration:
- Create a
nuget
directory as a sibling to yourgit
directory. - Create a
nuget.config
file in the root of yourgit
directory. - Ensure there are no other
nuget.config
files in yourgit
directory.
The nuget.config
should have the documented structure and should refer to the relative nuget
directory ..\nuget
as follows:
<configuration>
<config>
<!-- Allows you to install the NuGet packages in the specified folder,
instead of the default "$(Solutiondir)\Packages" folder. -->
<add key="repositoryPath" value="..\nuget" />
</config>
<solution>
<!-- Disable source control integration for the "Packages" folder. -->
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="false" />
<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="false" />
</packageRestore>
<packageSources>
<!-- Allows you to specify the list of sources to be used while looking for packages. -->
<add key="NuGet official package source" value="https://nuget.org/api/v2/" />
</packageSources>
<disabledPackageSources>
<!-- "DisabledPackageSources" has the list of sources which are currently disabled. -->
</disabledPackageSources>
<activePackageSource>
<!-- "ActivePackageSource" points to the currently active source.
Specifying "(Aggregate source)" as the source value would imply that
all the current package sources except for the disabled ones are active. -->
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSourceCredentials>
<!-- Allows you to set the credentials to access the given package source. -->
<!-- <feedName>
<add key="Username" value="foobar" />
<add key="ClearTextPassword" value="secret" />
</feedName> -->
</packageSourceCredentials>
</configuration>
With this configuration in place you should experience the following behavior. When you open one of these Visual Studio projects and then open the Package Manager, you may be informed that there are missing packages. Upon authorizing download of the packages you will see them appear in the nuget
directory. You will then be able to compile the project(s).