bsv-minimal
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

bsv-minimal

NPM Package

Parse raw bitcoin block and transaction buffers with minimal overhead

Note

You must use node.js v12+

Install

npm i bsv-minimal

Documentation

Basic use

const { Block, Transaction, Header } = require('bsv-minimal')

const block = Block.fromBuffer(yourBlockBuffer)
block.getHash()
block.getTransactions()
block.getHeight()
await block.getTransactionsAsync(({ header, txs, finished }), => {
    for (const {index, tx, offset, size} of txs) {
        console.log(`tx ${tx.getTxid()}`)
    }
})

const header = Header.fromBuffer(yourHeaderBuffer)
header.getHash()

const transaction = Transaction.fromBuffer(yourTransactionBuffer)
transaction.getTxid()
transaction.getCoinbaseHeight()

Tests

npm run test

Package Sidebar

Install

npm i bsv-minimal

Weekly Downloads

71

Version

2.0.1

License

MIT

Unpacked Size

159 kB

Total Files

68

Last publish

Collaborators

  • kevinejohn