Home

Awesome

blkdat-stream

Version

A lite blk*.dat streaming module, useful for parsing the Bitcoin blockchain

Note: For a high performance C++ parser, see https://github.com/dcousens/fast-dat-parser

Example

// usage: cat blk*.dat | node this.js

var BlockStream = require('blkdat-stream')
var blockStream = new BlockStream() // for testnet3: new BlockStream(0x0709110b)

process.stdin.pipe(new BlockStream()).on('data', function (blockBuffer) {
	// ... now, parse the block data buffer (is an atomic block)
})

To parse the returned block data, use a library such as bitcoinjs-lib or bitcore.