@owstack/hapi-blockchain

1.0.17 • Public • Published

hapi-blockchain

NPM Package Build Status Coverage Status

This is a Hapi.js plugin for connecting to a cluster of Bitcoin, Bitcoin Cash, or Litecoin services via RPC and ZeroMQ.

This plugin binds to the hapi server and emits events on incoming blocks, transactions, or address txids.

This plugin also provides an API of helper functions for working with blockchain data.

configuration

This plugin expects a configuration object with the following properties. Supported currency options: 'BTC', 'BCH', or 'LTC'

zmqpubrawtx and zmqpubhashblock are required to be the same value.

{
    "currency": "BTC",
    "nodes": [
        {
            "protocol": "http",
            "host": "127.0.0.1",
            "port": 12345,
            "user": "someUsername",
            "pass": "somePassword",
            "zmqpubrawtx": "tcp://127.0.0.1:28332",
            "zmqpubhashblock": "tcp://127.0.0.1:28332"
        }
    ]
}

If multiple nodes are provided, then round-robin load-balancing is used;

credits

This code and tests were adapted from code in the bitcore-node package by BitPay.

Package Sidebar

Install

npm i @owstack/hapi-blockchain

Weekly Downloads

0

Version

1.0.17

License

MIT

Unpacked Size

225 kB

Total Files

10

Last publish

Collaborators

  • ajp8164
  • niahmiah