Getting started with Voyager
Search articles

Getting started with Voyager

Shawn Butchart

A Websocket and REST server for querying Libbitcoin Server. It is written in Elixir using the Cowboy HTTP Server and connects to Libbitcoin Server via a ZeroMQ C-Port process pool.



All configuration takes place in the config/config.exs file. You must supply the libbitcoin server URI and optionally a heartbeat, block, and transaction subscription URIs. If a subscription URI is given then a single supervised connection will be automatically started for each available endpoint.

config :bitcoin_voyager,
  port: 9090,
  bind: '',
  uri: "tcp://",
  heartbeat_uri: "tcp://",
  block_uri: "tcp://",
  transaction_uri: "tcp://",
  pool: [size: 4],
  pidfile: "/tmp/"

Getting Started

You must install Erlang R18+ and Elixir 1.2.0+

You must install also libbitcoin 3.0 and include it in your LD_LIBRARY_PATH when running. See libbitcoin-nif for more info.

bash --prefix=/usr/local/libbitcoin-master
mix deps.get
LD_LIBRARY_PATH=/usr/local/libbitcoin-master/lib mix test

Building a Release

To make a release run the following commands

MIX_ENV=prod mix compile
MIX_ENV=prod mix release
LD_LIBRARY_PATH=/usr/local/libbitcoin-master/lib ./rel/bitcoin_voyager/bin/bitcoin_voyager start
./rel/bitcoin_voyager/bin/bitcoin_voyager stop


All requests are over standard HTTP with no rate limiting and api keys required.

➜ curl

Websocket API

The websocket api uses a serialization format simmilar to libbitcoin server ZMQ requests. All requests must contain a semi-random unique ID, a command, and a set of parameters for the command.

Example querying for the latest known block height from javascript:

function id() {
  return Math.floor(Math.random() * 4294967296)

var websocket = new WebSocket("wss://")

websocket.onmessage = function(event) {
  var message = JSON.parse(

websocket.onopen = function(event) {
  var request = JSON.stringify({
    id: id(),
    command: "blockchain.last_height",
    params: {}


The response will include the ID that was sent with the request along with an result or an error value.

{id: id(), error: }
{id: id(), result: }

For more information and a full list of commands, visit the Voyager Github Repository.