npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@node-lightning/bitcoind

v0.28.0

Published

Basic bitcoind JSONRPC and ZMQ client

Downloads

81

Readme

@node-lightning/bitcoind

This package provides connectivity to a bitcoind node by enabling RPC functions and Zeromq streaming.

This package has an external dependency on the zeromq package.

Example Usage

You can connect to a bitcoind instance by providing rpc and zeromq options.

const bitciondOptions = {
  host: "127.0.0.1",
  port: 8333,
  rpcuser: "user",
  rpcpassword: "pass",
  zmqpubrawtx: "tcp://127.0.0.1:18332"
  zmqpubrawblock: "tcp://127.0.0.1:18333";
}
const client = new BitcoindClient(bitcoindOptions);

You can subscribe to raw transactions and blocks emitted by zeromq:

client.subscribeRawTx();
client.on("rawtx", (rawtx: Buffer) => {
    // deserialize and do something
});
client.subscribeRawBlock();
client.on("rawblock", (rawblock: Buffer) => {
    // deserialize and do something
});

You can call RPC functions:

// blockchain info
await client.getBlockchainInfo();

// returns the block hash for a height
await client.getBlockHash(0);

// returns a BlockSummary
await client.getBlock("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");

// returns a Buffer
await client.getRawBlock("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");

// returns a Transaction
await client.getTransaction("aa5f3068b53941915d82be382f2b35711305ec7d454a34ca69f8897510db7ab8");

// returns a Buffer
await client.getRawTransaction("aa5f3068b53941915d82be382f2b35711305ec7d454a34ca69f8897510db7ab8");

// returns a Utxo
await client.getUtxo("aa5f3068b53941915d82be382f2b35711305ec7d454a34ca69f8897510db7ab8", 0);