Bitcoin Full Node and Query Server
C++ M4 Shell Makefile Batchfile Python
Latest commit 6111c4e Feb 28, 2017 @evoskuil evoskuil committed on GitHub Merge pull request #336 from evoskuil/master
Add blockchain broadcast/validate, upgrade fetch_history to v2.
Permalink
Failed to load latest commit information.
builds/msvc Update libsecp256k1 nuget dependency to v0.1.0.14. Feb 9, 2017
console Use network id to indicate testnet genesis block for initichain. Feb 16, 2017
data Replace server.log_requests setting with network.verbose. Feb 16, 2017
include/bitcoin Add blockchain broadcast/validate, upgrade fetch_history to v2. Feb 27, 2017
m4 Stage m4 sources for swig inregration. Mar 18, 2015
scripts Updated Linux logrotate script. Jul 31, 2016
src Add blockchain broadcast/validate, upgrade fetch_history to v2. Feb 27, 2017
test Update copyright/license headers. Feb 9, 2017
.gitignore Correct build error. Jun 12, 2015
.travis.yml Generate appveyor artifacts. Dec 2, 2016
AUTHORS Update GNU default documents. Feb 12, 2017
COPYING Update GNU default documents. Feb 12, 2017
ChangeLog Update GNU default documents. Feb 12, 2017
INSTALL Update GNU default documents. Feb 12, 2017
Makefile.am Integrate notification subscription. Jul 23, 2016
NEWS Update GNU default documents. Feb 12, 2017
README Update GNU default documents. Feb 12, 2017
README.md Update installer links to version3. Feb 10, 2017
appveyor.yml Initialize appveyor with autocrlf. Dec 13, 2016
autogen.sh Change autogen to sh. Mar 20, 2015
build.cmd Bump master branch from v3.0.0 to v4.0.0 and build consensus from mas… Feb 9, 2017
configure.ac Bump master branch from v3.0.0 to v4.0.0 and build consensus from mas… Feb 9, 2017
install.sh Bump master branch from v3.0.0 to v4.0.0 and build consensus from mas… Feb 9, 2017
libbitcoin-server.pc.in Bump master branch from v3.0.0 to v4.0.0 and build consensus from mas… Feb 9, 2017
libbitcoin_server_test_runner.sh Run all tests. Nov 5, 2016

README.md

Build Status

Coverage Status

Libbitcoin Server

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.

Requirements.

At least 100 Gb file storage (SSD preferred), with swap enabled and at least 4Gb RAM (8Gb preferred).

Installation

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.

Debian/Ubuntu

The install script is recommended for installation, however preliminary version2 packages are available for testing.

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.57.0) 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/version3/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 $ bs.

Macintosh

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

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 and wget:

$ brew install autoconf automake libtool pkgconfig wget

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

$ brew install boost

Next download the install script and enable execution:

$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin-server/version3/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 $ bs.

Using MacPorts

First install MacPorts.

Next install the build system and wget:

$ sudo port install autoconf automake libtool pkgconfig wget

Next 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 -python27

Next download the install script and enable execution:

$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin-server/version3/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 $ bs.

Configuration Options

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 bs 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 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

Windows

Visual Studio solutions are maintained for all libbitcoin libraries and dependencies. The supported execution environment is 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 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:

Build Libbitcoin Projects

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 the buildbase.bat of each project.

Build these solutions in order:

  1. libbitcoin/libbitcoin
  2. libbitcoin/libbitcoin-consensus
  3. libbitcoin/libbitcoin-database
  4. libbitcoin/libbitcoin-blockchain
  5. libbitcoin/libbitcoin-network
  6. libbitcoin/libbitcoin-node
  7. libbitcoin/libbitcoin-protocol
  8. 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.

Optional: Build Everything

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:

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 Repository

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 nuget directory as a sibling to your git directory.
  • Create a nuget.config file in the root of your git directory.
  • Ensure there are no other nuget.config files in your git 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).