1.1.6 • Published 1 year ago

bitcoin-minimal v1.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

bitcoin-minimal

NPM Package

Parse raw bitcoin block and transaction buffers with minimal overhead

Note

You must use node.js v12+

Install

npm i bitcoin-minimal

Documentation

Basic use

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

const block = Block.fromBuffer(yourBlockBuffer)
block.getHash()
block.getTransactions()
block.getHeight()
await block.getTransactionsAsync(({ header, transactions, finished }), => {
    for (const [txIndex, transaction, txPos, txLength] of transactions) {
        console.log(`tx ${transaction.getTxid()}`)
    }
})

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

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

Tests

npm run test