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

@asylia/btc-core

v1.0.0

Published

Auditable Bitcoin TypeScript core for native-SegWit P2WSH multisig, BIP-48 derivation, BIP-380 descriptors, PSBT v2, signature verification, and coin selection.

Readme

@asylia/btc-core

Framework-agnostic Bitcoin primitives for the Asylia self-custody platform: native-SegWit P2WSH multisig descriptors, BIP-48 derivation, deterministic address generation, PSBT v2 construction and inspection, signature verification, and coin-selection helpers.

This is the core audit package behind Asylia's wallet. It contains no Vue, DOM, Supabase, browser storage, or product UI code. The same functions can run in the wallet SPA, a future Capacitor signer, Node-based audit tooling, or independent review harnesses.

Keywords: Bitcoin, multisig, P2WSH, wsh(sortedmulti(...)), BIP-48, BIP-380, PSBT v2, BIP-370, descriptor checksum, hardware wallet signing, TypeScript, self-custody.

Maintainer And Support

@asylia/btc-core is maintained by Asylian21.

Support Asylia Bitcoin tooling

If this work helps your wallet, audit, integration, or research, you can support ongoing development with a Bitcoin donation: bc1qrdchup8497xz0972v35q4nr0fx5egghf0z23c3

Status

1.0.0. The package ships the stable Asylia Bitcoin primitive API for the native-SegWit multisig wallet toolkit.

Installation

npm install @asylia/btc-core

Script Policy

@asylia/btc-core supports exactly one wallet script family:

wsh(sortedmulti(N, key1, key2, ...))

Asylia uses the native-SegWit BIP-48 multisig branch:

m/48'/0'/0'/2'

The package does not expose a generic script-type switch. Nested SegWit P2SH-P2WSH (sh(wsh(...))), Taproot, legacy P2PKH, and arbitrary scripts are intentionally out of scope. A single script family keeps descriptor building, address derivation, PSBT construction, hardware-wallet mapping, and audits small enough to reason about carefully.

Public API

Every public export is defined by the source barrel and published from the package root. The most important surfaces are:

| Area | Exports | | --- | --- | | Descriptors | buildWshSortedMultiDescriptor, descriptorChecksum, withChecksum, toCanonicalXpub | | Imports | parseAsyliaVaultConfig, parseCaravanWalletConfig, parseSparrowWalletConfig, parseDescriptorImport | | Vault identity | vaultIdentityKey | | Address derivation | deriveWshSortedMultiAddress, deriveWshSortedMultiAddressBatch, buildWshSortedMultiInstance | | Address parsing | parseBitcoinAddress, describeBitcoinAddressType | | PSBT build/inspect | buildWshSortedMultiPsbt, extractPsbtInputs, inspectPsbtV2, addressFromScript, bip32PathToAddressN | | Signatures | addPartialSignaturesToPsbt, computeBip143SighashAll, verifySegwitV0SignatureAgainstPubkey, findSegwitV0SignatureOwner, findSegwitV0SignatureOwnerForPsbt | | Finalization | countPsbtSigners, collectSignerFingerprints, finaliseAndExtractTransaction | | Coin selection | selectCoinsLargestFirst, selectCoinsLargestFirstFixedFee, maxSpendableSats |

Example

import {
  buildWshSortedMultiDescriptor,
  deriveWshSortedMultiAddress,
} from '@asylia/btc-core';

const keys = [
  {
    fingerprint: 'd34db33f',
    derivationPath: "48'/0'/0'/2'",
    xpub: 'xpub...',
  },
  {
    fingerprint: 'f00dbabe',
    derivationPath: "48'/0'/0'/2'",
    xpub: 'xpub...',
  },
  {
    fingerprint: '8badf00d',
    derivationPath: "48'/0'/0'/2'",
    xpub: 'xpub...',
  },
] as const;

const descriptor = buildWshSortedMultiDescriptor({
  network: 'mainnet',
  requiredSignatures: 2,
  keys,
});

const firstReceive = deriveWshSortedMultiAddress({
  network: 'mainnet',
  requiredSignatures: 2,
  keys,
  chain: 0,
  index: 0,
});

Import Guarantees

Import helpers normalize Asylia, Caravan, Sparrow, raw BIP-380 descriptor, and Bitcoin Core importdescriptors inputs into one ParsedMultisigImport shape. Validation is strict by design:

  • mainnet only,
  • native P2WSH only,
  • valid BIP-380 checksum when supplied,
  • valid fingerprints, derivation paths, and xpub material,
  • deterministic signer ordering for duplicate detection.

Malformed input is rejected at the boundary instead of becoming a broken vault row downstream.

PSBT and Hardware Wallets

The PSBT surface is designed for hardware-wallet adapters:

  • buildWshSortedMultiPsbt creates PSBT v2 spends with witness scripts and per-cosigner BIP-32 derivation metadata.
  • inspectPsbtV2 gives adapters a typed view of inputs, outputs, existing partial signatures, and derivation records.
  • computeBip143SighashAll and findSegwitV0SignatureOwner let adapters verify that a returned signature belongs to the expected cosigner before it is merged.
  • addressFromScript lets adapters recover standard recipient addresses for device prompts.

Not in Scope

This package does not:

  • store seed phrases, private keys, passphrases, or hardware-wallet secrets,
  • fetch blockchain data,
  • broadcast transactions,
  • own wallet persistence,
  • render UI,
  • depend on Vue, Supabase, or any Asylia application module,
  • support scripts outside wsh(sortedmulti(...)).

If a feature needs upstream chain data, use @asylia/blockchain-data-btc. If it needs a device SDK, use @asylia/hw-trezor or @asylia/hw-ledger.

Testing

yarn workspace @asylia/btc-core type-check
yarn workspace @asylia/btc-core test
yarn workspace @asylia/btc-core test:coverage

Versioning and Audit Stance

Stable releases use semantic versioning, changelog entries, git tags, and documented audit scope. Vulnerability disclosure is covered in SECURITY.md.

License

MIT - see LICENSE.