bitcoind-block-stream

2.0.0 • Public • Published

Returns a stream of blocks from given start height to given max height.

Installation

npm install bitcoind-block-stream

Example

var bitcoin = require('bitcoin')
var bs = require('./index')
var level = require('level')
var map = require('through2-map')
 
var client = new bitcoin.Client(require('./bitcoin.json'))
var db = level('testdb')
 
var ws = db.createWriteStream({ valueEncoding: 'json' })
ws.on('error', function (err) {
  console.log('Oh my!', err)
})
ws.on('close', function () {
  console.log('Stream closed')
})
 
bs(client, { from: 4, to: 12 })
  .pipe(map.obj(function (x) { return { key: x.hash, value: x } }))
  .pipe(ws)

Readme

Keywords

none

Package Sidebar

Install

npm i bitcoind-block-stream

Weekly Downloads

3

Version

2.0.0

License

MIT

Last publish

Collaborators

  • czzarr