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, macOS 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.
At least 100 Gb file storage (SSD preferred), with swap enabled and at least 4Gb RAM (8Gb preferred).
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 # optionalDetailed instructions are provided below.
The install script is recommended for installation.
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++ --versiong++ (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 50Next install the build system:
$ sudo apt-get install build-essential autoconf automake libtool pkg-configNext install the Boost (minimum 1.57.0) development package:
$ sudo apt-get install libboost-all-devNext download the install script and enable execution:
$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin-server/version3/install.sh
$ chmod +x install.shFinally install Libbitcoin Server with default build options:
$ sudo ./install.shLibbitcoin Server is now installed in /usr/local/bin and can be invoked as $ bs.
The macOS 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 macOS 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++ --versionYou may encounter a prompt to install the Xcode command line developer tools, in which case accept the prompt.
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 --installFirst install Homebrew.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"Next install the build system and wget:
$ brew install autoconf automake libtool pkgconfig wgetNext install the Boost (1.57.0 or newer) development package:
$ brew install boostNext download the install script and enable execution:
$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin-server/version3/install.sh
$ chmod +x install.shFinally install Libbitcoin Server with default build options:
$ ./install.shLibbitcoin Server is now installed in /usr/local/bin and can be invoked as $ bs.
Instead of building, libbitcoin-server can be installed from a formula:
$ brew install libbitcoin-serveror
$ brew install bsFirst install MacPorts.
Next install the build system and wget:
$ sudo port install autoconf automake libtool pkgconfig wgetNext install the Boost (1.57.0 or newer) development package. The - options remove MacPort defaults that are not Boost defaults:
$ sudo port install boost -no_single -no_static -python27Next download the install script and enable execution:
$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin-server/version3/install.sh
$ chmod +x install.shFinally install Libbitcoin Server with default build options:
$ ./install.shLibbitcoin Server is now installed in /usr/local/bin and can be invoked as $ bs.
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
-soption is not supported by the Clang compiler. Instead use the command$ strip bsafter the build.
Building without NDEBUG (i.e. with debug assertions) defined:
$ sudo ./install.sh --disable-ndebugBuilding without building tests:
$ sudo ./install.sh --without-testsBuilding from a specified directory, such as /home/me/mybuild:
$ sudo ./install.sh --build-dir=/home/me/mybuildBuilding into a directory other than /usr/local, such as /home/me/myprefix:
$ ./install.sh --prefix=/home/me/myprefixBuilding and linking with a private copy of the Boost dependency:
$ ./install.sh --build-boost --prefix=/home/me/myprefixBuilding a statically-linked executable:
$ ./install.sh --disable-shared --build-boost --prefix=/home/me/myprefixBuilding a small statically-linked executable most quickly:
$ ./install.sh CXXFLAGS="-Os -s" --without-tests --disable-shared --build-boost --prefix=/home/me/myprefixBuilding 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-dirVisual 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.batscripts build all valid configurations. The build time can be significantly reduced by disabling all but the desired configuration in thebuildbase.batof each project.
Build these solutions in order:
- libbitcoin/libbitcoin
- libbitcoin/libbitcoin-consensus
- libbitcoin/libbitcoin-database
- libbitcoin/libbitcoin-blockchain
- libbitcoin/libbitcoin-network
- libbitcoin/libbitcoin-node
- libbitcoin/libbitcoin-protocol
- 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-consensus
-libbitcoin-database
-libbitcoin-blockchain
-libbitcoin-network
-libbitcoin-node
-libbitcoin-protocol
-libbitcoin-server
-builds
-msvc
-vs2013
-bitcoin-server
bitcoin-server.vcxproj
packages.config
libbitcoin-server.sln
-nuget
repositories.config
+boost.1.57.0.0
+boost_chrono-vc120.1.57.0.0
+boost_date_time-vc120.1.57.0.0
+boost_filesystem-vc120.1.57.0.0
+boost_iostreams-vc120.1.57.0.0
+boost_log-vc120.1.57.0.0
+boost_program_options-vc120.1.57.0.0
+boost_regex-vc120.1.57.0.0
+boost_system-vc120.1.57.0.0
+boost_thread-vc120.1.57.0.0
+boost_unit_test_framework-vc120.1.57.0.0
+libzmq_vc120.4.2.2.0
+secp256k1_vc120.0.1.0.13
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
nugetdirectory as a sibling to yourgitdirectory. - Create a
nuget.configfile in the root of yourgitdirectory. - Ensure there are no other
nuget.configfiles in yourgitdirectory.
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).