Node.js clients for a qbit Core node you run. They complement the official
SDK, @qbit-oss/api,
which talks to block explorers, not to qbitd. Nothing here is specific to one
application.
-
@qbit-oss/rpc: a typed JSON-RPC client. Read chain and wallet state, fund and sign PSBTs with the node's wallet, and broadcast, behind capabilities you opt into and a check that the node is on the expected chain. No runtime dependencies.npm install @qbit-oss/rpc
-
@qbit-oss/zmq: a subscriber forqbitd's ZMQ notifications (new blocks, mempool changes), which tells you when you missed some. It uses the nativezeromqaddon, an optional peer dependency you install beside it.npm install @qbit-oss/zmq zeromq@^6.8.0
A service that reacts to blocks usually wants both: ZMQ to wake up, RPC to read what changed.
Both are verified against qbit Core v1.0.1 on regtest, with fault injection; not yet against mainnet or testnet4 (network verification).
Wake up on each new block and read its header, from a testnet4 node on the same machine:
import { QbitRpcClient } from '@qbit-oss/rpc'
import { QbitZmqSubscriber } from '@qbit-oss/zmq'
const rpc = new QbitRpcClient({
url: 'http://127.0.0.1:48352/',
auth: { cookieFile: '/home/qbit/.qbit/testnet4/.cookie' },
expectedChain: 'testnet4',
})
// qbitd -testnet4 -zmqpubhashblock=tcp://127.0.0.1:28332
const zmq = new QbitZmqSubscriber({ url: 'tcp://127.0.0.1:28332', topics: ['hashblock'] })
for await (const event of zmq) {
if (event.kind === 'gap') console.log('missed notifications: re-read the chain')
if (event.kind === 'message' && event.message.topic === 'hashblock') {
const header = await rpc.getBlockHeader(event.message.hash)
console.log(`block ${header.height}: ${header.hash}`)
}
}Node.js ^22.13.0 || ^24.0.0 || >=26.0.0, and qbit Core 1.0.x releases,
tested against v1.0.1. The type declarations need TypeScript 5.0 or later and
@types/node 22.0.0 or later. Neither package runs in a browser. See
Compatibility for what CI tests, and
Limits.
Both packages share one version. Below 1.0, a minor release (0.1 → 0.2)
can break and a patch cannot, apart from the behaviour changes
RELEASING.md lists. Release candidates are on npm's
candidate dist-tag.
@qbit-oss/rpcand@qbit-oss/zmq: install and quick startdocs/: configuration, methods, capabilities, the chain guard, errors, remote nodes, payments, wallets, mining, ZMQ health and connection handling, packaging and limits- API reference: every export and member of both packages, with its doc comment (where it is published)
examples/: a payout, a deposit watcher and a header walk, which CI compiles against the packed packages- CHANGELOG.md: changes, breaking ones included, for both packages
Development, checks and the regtest smoke test are in CONTRIBUTING.md. Report vulnerabilities as SECURITY.md describes, not in a public issue.
What the packages protect, and what they leave to you, is in the threat model.