开发者社区> 镜像站> NPM> @hyperdivision/btc-transaction-tail
@hyperdivision/btc-transaction-tail
Tails transactions on the Bitcoin blockchain
Last updated a year ago by emilbayes .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @hyperdivision/btc-transaction-tail 
SYNC missed versions from official npm registry.

@hyperdivision/btc-transaction-tail

Build Status

Tails transactions on the Bitcoin blockchain

npm install @hyperdivision/btc-transaction-tail

Usage

const Tail = require('@hyperdivision/btc-transaction-tail')

const tail = new Tail({
  confirmations: 10, // require this many confirmations
  async filter (addr) {
    return isInterestingAddress(addr)
  },
  async transaction (transaction) {
    console.log('found this transaction', transaction)
  },
  async checkpoint (since) {
    // store this since so you can restart from here
  }
})

;(async function () {
  // tail.index is the current block index
  // tail chain since this seq (inclusive)
  await tail.start() // start tailing, will throw if an error is hit
  await tail.scan(424244)
})().catch(console.error)

API

const tail = new Tail(opts)

{
  network: 'main',
  confirmations: 0,
  prefix: null, // Where to store chain data
  // direction can be either IN or OUT symbol
  async filter (addressString, direction) { return true },
  async transaction (bcoin.TX) { },
  async checkpoint (blockHeight) { },
  // Pass options directly to bcoin FullNode
  // May overwrite some of the previous opts
  bcoin: {}
}

Tail.IN

Signals a transaction that has a filtered address in the inputs

Tail.OUT

Signals a transaction that has a filtered address in the output

tail.start()

tail.scan(since = 0)

tail.stop()

Current Tags

  • 2.1.0                                ...           latest (a year ago)

10 Versions

  • 2.1.0                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.5.0                                ...           a year ago
  • 1.4.0                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 10
Dependencies (1)
  • bcoin github:bcoin-org/bcoin#cec3c3e788834d3e9fc3c0b21bc3e340d573dcfd
Dev Dependencies (1)
Dependents (0)
None