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 🙏

© 2026 – Pkg Stats / Ryan Hefner

chain-utils-siddharthasingh

v0.1.0

Published

Low-level Bitcoin utility library — varint decoding, raw transaction parsing, Merkle root computation, and hash primitives.

Downloads

117

Readme

chain-utils-siddharthasingh

Zero-dependency Bitcoin primitives for Node.js.

I built this because I needed a fast, low-level way to parse raw Bitcoin data for my Chain Lens Bitcoin analyzer project. I didn't want to pull in massive cryptographic libraries just to decode varints or slice up transactions.

Requires Node 18+ (uses built-in crypto for everything).

Install

npm install chain-utils-siddharthasingh

Usage

Transaction Parsing

Decode raw hex into structured JS objects. Supports legacy and segwit formats.

import { parseTx } from 'chain-utils';

const hex = "0100000001...";
const tx = parseTx(hex);

console.log(tx.isCoinbase); // true
console.log(tx.outputs[0].value); // 5000000000n

Merkle Trees

Compute a block's Merkle root from a list of transaction IDs (in natural display order).

import { computeMerkleRoot } from 'chain-utils';

const txids = [
  'f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16',
  'a1075be556d7ce1ce41c0eb7042a3eb17bdcc045d471b05dfbd4c6d04ddb98a8'
];

const root = computeMerkleRoot(txids);
console.log(root); // '09b0eb48c...'

Varints

Read and write variable-length integers (commonly used in P2P protocols).

import { readVarint, writeVarint } from 'chain-utils';

const buf = Buffer.from('fd2002', 'hex');
const { value, size } = readVarint(buf, 0);

console.log(value); // 544
console.log(size); // 3

const encoded = writeVarint(544);

Hashing Constants

Quick wrappers around Node's crypto for standard Bitcoin operations.

import { doubleSha256, hash160, toHex, fromHex, reverseHex } from 'chain-utils';

const data = Buffer.from('hello');
const hash = doubleSha256(data); // sha256(sha256(data))
const pubkeyHash = hash160(data); // ripemd160(sha256(data))

const stringHex = toHex(hash);

chain-utils-