Bitcoin Command Line Tool
C++ M4 Shell Makefile Batchfile
Latest commit d4af8a8 Jan 11, 2017 @evoskuil evoskuil committed on GitHub Merge pull request #428 from betachen/patch-1
Update parser.cpp
Permalink
Failed to load latest commit information.
builds/msvc Update boost to 1.57.0.0. Nov 5, 2016
console Move default log initialization to bc::log. Oct 14, 2016
data Update tests back into working shape Nov 8, 2016
img Update documentation graphical models in light of command changes. Oct 4, 2015
include/bitcoin Adds support for the 'individual' algorithm for utxo selection via the Dec 20, 2016
m4 Remove boost-chrono check (covered by libbitcoin). Mar 25, 2015
model Adds support for the 'individual' algorithm for utxo selection via the Dec 20, 2016
src Update parser.cpp Jan 11, 2017
test Remove dead validate test. Jan 11, 2017
.gitignore - incorporate some feedback from evoskuil Jan 24, 2016
.travis.yml Generate appveyor artifacts. Dec 2, 2016
AUTHORS - adds initial implementation of BIP39 (english language supported wi… Feb 27, 2015
COPYING install license, readme and install text files. Jul 24, 2013
ChangeLog Documentation. Sep 3, 2014
INSTALL Documentation. Sep 3, 2014
Makefile.am Adds bx-testnet configuration to install target (resolves #372) Jun 19, 2016
NEWS Documentation. Sep 3, 2014
README Documentation. Sep 3, 2014
README.md Update readme.MD for boost bump to 1.57.0 (fixes log rotation). Nov 9, 2016
appveyor.yml Initialize appveyor with autocrlf. Dec 13, 2016
autogen.sh Add generated test runner. Mar 20, 2015
build.cmd Remove crlf line endings, rely on autocrlf git setting. Dec 13, 2016
configure.ac Regenerate build artifacts. Oct 27, 2016
install.sh Updates installer zlib download URL Jan 3, 2017
libbitcoin-explorer.pc.in Use package config for chained dependencies. Apr 2, 2016
libbitcoin_explorer_test_runner.sh Generate appveyor artifacts. Dec 2, 2016

README.md

Build Status

Coverage Status

The automated build often fails on generating test metrics due to performance limits on Travis.

Bitcoin Explorer

The Bitcoin Command Line Tool

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 Explorer

BX is a command line tool for working with Bitcoin. 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. BX exposes over 80 commands and supports network communication with libbitcoin-server or its predecessor Obelisk, and the P2P Bitcoin network. BX is well documented and supports simple and advanced scenarios, including stealth and multisig.

Installation

BX can be built from sources or downloaded as a signed portable single file executable.

On Linux and Macintosh BX is built using Autotools as follows and depends on libbitcoin-client.

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

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

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

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-explorer/version2/install.sh
$ chmod +x install.sh

Finally install BX:

$ sudo ./install.sh

Bitcoin Explorer is now installed in /usr/local/bin and can be invoked as $ bx.

Macintosh

The OSX installation differs from Linux in the installation of the compiler and packaged dependencies. BX 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.

BX 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-explorer/version2/install.sh
$ chmod +x install.sh

Finally install BX:

$ ./install.sh

Bitcoin Explorer is now installed in /usr/local/bin and can be invoked as $ bx.

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-explorer/version2/install.sh
$ chmod +x install.sh

Finally install BX:

$ ./install.sh

Bitcoin Explorer is now installed in /usr/local/bin and can be invoked as $ bx.

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 --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 --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 BX 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 BX 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-protocol
  3. libbitcoin/libbitcoin-client
  4. libbitcoin/libbitcoin-network
  5. libbitcoin/libbitcoin-explorer

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-client
        -libbitcoin-explorer
            -builds
                -msvc
                    -vs2013
                        +bx
                        -libbitcoin-explorer
                            libbitcoin-explorer.vcxproj
                            packages.config
                        +libbitcoin-explorer-test
                        libbitcoin-explorer.sln
        -libbitcoin-protocol
    -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_locale-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).