
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
cb-streams
Advanced tools
stream-based interface to common-blockchain API
this module is used by Tradle
var through2 = require('through2')
var cbstreams = require('cb-streams')
var Blockchain = require('cb-blockr')
var blockchain = new Blockchain('testnet')
// 1. Specify which blocks to read
// block stream
var blockstream = cbstreams.stream.blocks({
networkName: 'testnet',
api: blockchain
})
.pipe(through2.obj(function (blockInfo, enc, done) {
var block = blockInfo.block
// i want to do bad things to tx
}))
for (var i = 0; i < 10; i++) {
blockstream.write(i) // push block numbers into the stream
}
// tx stream
var txstream = cbstreams.stream.txs({
networkName: 'testnet',
api: blockchain
})
.pipe(through2.obj(function (txInfo, enc, done) {
var tx = txInfo.tx
// i want to do bad things to tx
}))
for (var i = 0; i < 10; i++) {
txstream.write(i) // push block numbers into the stream
}
// similarly you have:
//
// cbstreams.stream.dataTxs which will return only txs with OP_RETURN data
// cbstreams.stream.data which will return wrapped OP_RETURN data:
// {
// data: data,
// tx: tx,
// height: height // block height
// }
// 2. Specify which "addresses" to watch
var stream = cbstreams.stream.txs({
networkName: 'testnet',
api: blockchain,
addresses: [
'mvQx4yPAAzvZipC8mFWK1QUfPz1CNfnaBL',
'mk96Ff5754KUT7EGNKhvnTSdMpaPkuKU1N'
],
// stream will go on forever (as new transactions are put on blockchain)
live: true
})
.pipe(through2.obj(function (txInfo, enc, done) {
var tx = txInfo.tx
// i want to do bad things to tx
}))
FAQs
stream-based interface to common-blockchain APIs
The npm package cb-streams receives a total of 3 weekly downloads. As such, cb-streams popularity was classified as not popular.
We found that cb-streams demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.