A pre-built BitcoinLib backend adapter.
For example, the current 3.x bitcoinjs preset still allows binding a custom
bitcoinjs-compatible ecc implementation:
import * as ecc from '@bitcoinerlab/secp256k1';
import { DescriptorsFactory, createBitcoinjsLib } from '@bitcoinerlab/descriptors';
const { Output } = DescriptorsFactory(createBitcoinjsLib(ecc));
Takes a string key expression (xpub, xprv, pubkey or wif) and parses it
Constructs the necessary functions and classes for working with descriptors, using either an external elliptic curve (
ecc) library or a core Bitcoin library (e.g. bitcoinjs-lib or @scure/btc-signer).Note: Most users do not need to call
DescriptorsFactory(...)directly.@bitcoinerlab/descriptorsalready provides the bitcoinjs-ready defaults.@bitcoinerlab/descriptors-scurealready provides the scure-ready defaults.This factory is mainly useful for:
3.1.xbitcoinjs usage, andBitcoinLibbackend adapter.It is not the recommended public entry point for users of
@bitcoinerlab/descriptors. It remains in core because the preset packages and their compatibility layers are built on top of it. Future major versions are expected to stop re-exporting it from those preset packages.Notably, it returns the
Outputclass, which provides methods to create, sign, and finalize transactions from descriptor expressions.The factory also returns utility methods like
expand(detailed below) andparseKeyExpression(see KeyExpressionParser).Additionally, for convenience, the factory returns
BIP32andECPair. In bitcoinjs mode, these are the already initialized bitcoinjs factories, equivalent toBIP32 = BIP32Factory(ecc)andECPair = ECPairFactory(ecc). When using scure, prefer scure-native key types (HDKeyandUint8Arrayfor private keys), which do not require key-factory initialization.