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

@dfx.swiss/bip322-multisig

v0.2.0

Published

Build and sign BIP-322 simple signatures for Bitcoin P2WSH multisig wallets via PSBT

Readme

@dfx.swiss/bip322-multisig

Build and verify BIP-322 simple signatures for Bitcoin P2WSH multisig wallets via PSBT. Provides both a JavaScript / TypeScript library (Node + browser) and CLI binaries.

Installation

npm install @dfx.swiss/bip322-multisig

Requires Node.js ≥ 18 (uses native fetch in the CLI).

CLI

After global install, two commands are available:

npm install -g @dfx.swiss/bip322-multisig

bip322-sign \
  --descriptor 'wsh(sortedmulti(2,[fp1/48h/0h/0h/2h]xpub.../<0;1>/*,...))' \
  --address bc1q...

# Sign the resulting PSBT in Sparrow with the threshold number of cosigners,
# save it as signed.psbt, then:

bip322-finalize --psbt signed.psbt --address bc1q...

Both commands accept --api <baseUrl> (default https://api.dfx.swiss) and bip322-finalize accepts --no-submit to print the signature without contacting the API.

Library

import {
  parseDescriptor,
  findAddress,
  buildBip322Psbt,
  extractBip322Signature,
} from '@dfx.swiss/bip322-multisig';

// Build a BIP-322 to_sign PSBT for a given P2WSH multisig address
const built = buildBip322Psbt({
  message: 'challenge string from server',
  descriptor: 'wsh(sortedmulti(2,[fp1/48h/0h/0h/2h]xpub.../<0;1>/*,...))',
  address: 'bc1q...',
});
// → built.psbtBase64, built.toSpendTxid, built.derived

// After the PSBT has been signed (e.g. by Sparrow + hardware wallets):
const signatureBase64 = extractBip322Signature(signedPsbtBase64);

Scope

| Supported | Not supported | |-----------|---------------| | wsh(sortedmulti(t, …)) descriptors with key origin info | Non-multisig descriptors | | Both h and ' hardened path notations | Miniscript / Taproot policies | | Whitespace and newlines in descriptor input | Testnet / signet (tpub) | | BIP-389 multipath <0;1>/* (receive + change branches) | Multipath with > 2 branches | | Standard OP_M … OP_N OP_CHECKMULTISIG witness scripts | Non-standard witness scripts |

How it works

BIP-322 defines a generic message-signing scheme by constructing two virtual transactions: to_spend commits the message to the address, and to_sign spends to_spend. The simple-format signature is just the witness stack of to_sign's input, base64-encoded.

This package builds to_sign as a regular PSBT with all the BIP32 derivation paths, witness UTXO, witness script, and sighash type that hardware wallets need to sign. Sparrow (or any other coordinator) handles the multisig orchestration via its standard PSBT-signing flow; this package extracts the resulting witness as a BIP-322 simple signature.

License

MIT