JSPM

bitcoin-minimal

1.1.7
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q39930F
  • License MIT

Parse raw bitcoin block and transaction buffers with minimal overhead

Package Exports

  • bitcoin-minimal
  • bitcoin-minimal/lib/index.js
  • bitcoin-minimal/lib/utils
  • bitcoin-minimal/lib/utils/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bitcoin-minimal) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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