{"id":22756585,"url":"https://github.com/bitcoinerlab/descriptors","last_synced_at":"2025-04-05T02:09:20.256Z","repository":{"id":65464905,"uuid":"589723536","full_name":"bitcoinerlab/descriptors","owner":"bitcoinerlab","description":"A TypeScript library for parsing Bitcoin Descriptors, including Miniscript-based ones. Streamlines creating Partially Signed Bitcoin Transactions (PSBTs) from Descriptors. Features BIP32, single-signature, and Hardware Wallet signing capabilities, and facilitates finalizing transactions.","archived":false,"fork":false,"pushed_at":"2025-03-12T20:07:58.000Z","size":4814,"stargazers_count":52,"open_issues_count":6,"forks_count":14,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T01:11:16.488Z","etag":null,"topics":["bitcoin","descriptors","miniscript"],"latest_commit_sha":null,"homepage":"https://bitcoinerlab.com/modules/descriptors","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitcoinerlab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-16T19:35:20.000Z","updated_at":"2025-03-17T23:37:33.000Z","dependencies_parsed_at":"2023-10-11T16:42:30.075Z","dependency_job_id":"2f06d10e-5fdc-4a19-bf1c-e6b4a827db85","html_url":"https://github.com/bitcoinerlab/descriptors","commit_stats":{"total_commits":177,"total_committers":2,"mean_commits":88.5,"dds":0.005649717514124242,"last_synced_commit":"8fe1bc0052297c6101d55d78320c26967015722d"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoinerlab%2Fdescriptors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoinerlab%2Fdescriptors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoinerlab%2Fdescriptors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoinerlab%2Fdescriptors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitcoinerlab","download_url":"https://codeload.github.com/bitcoinerlab/descriptors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276164,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","descriptors","miniscript"],"created_at":"2024-12-11T07:14:24.216Z","updated_at":"2025-04-05T02:09:20.223Z","avatar_url":"https://github.com/bitcoinerlab.png","language":"TypeScript","readme":"# Bitcoin Descriptors Library\n\nThis library is designed to parse and create Bitcoin Descriptors, including Miniscript, and generate Partially Signed Bitcoin Transactions (PSBTs). It also provides PSBT signers and finalizers for single-signature, BIP32, and Hardware Wallets.\n\n## Features\n\n- Parses and creates [Bitcoin Descriptors](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md) (including those based on the [Miniscript language](https://bitcoinerlab.com/modules/miniscript)).\n- Generates Partially Signed Bitcoin Transactions (PSBTs).\n- Provides PSBT finalizers and signers for single-signature, BIP32, and Hardware Wallets (currently supports Ledger devices; more devices are planned).\n\n## Concepts\n\nThis library has two main capabilities related to Bitcoin descriptors. Firstly, it can generate `addresses` and `scriptPubKeys` from descriptors. These `addresses` and `scriptPubKeys` can be used to receive funds from other parties. Secondly, the library is able to sign transactions and spend unspent outputs described by those same descriptors. In order to do this, the descriptors must first be set into a PSBT.\n\nIf you are not familiar with _Bitcoin descriptors_ and _partially signed Bitcoin transactions (PSBTs)_, click on the section below to expand and read more about these concepts.\n\n\u003cdetails\u003e\n  \u003csummary\u003eConcepts\u003c/summary\u003e\n\n### Descriptors\n\nIn Bitcoin, a transaction consists of a set of inputs that are spent into a different set of outputs. Each input spends an output in a previous transaction. A Bitcoin descriptor is a string of text that describes the rules and conditions required to spend an output in a transaction.\n\nFor example, `wpkh(02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9)` is a descriptor that describes a pay-to-witness-public-key-hash (P2WPKH) type of output with the specified public key. If you know the corresponding private key for the transaction for which this descriptor is an output, you can spend it.\n\nDescriptors can express much more complex conditions, such as multi-party cooperation, time-locked outputs, and more. These conditions can be expressed using the Bitcoin Miniscript language, which is a way of writing Bitcoin Scripts in a structured and more easily understandable way.\n\n### Partially Signed Bitcoin Transactions (PSBTs)\n\nA PSBT (Partially Signed Bitcoin Transaction) is a format for sharing Bitcoin transactions between different parties.\n\nPSBTs come in handy when working with descriptors, especially when using scripts, because they allow multiple parties to collaborate in the signing process. This is especially useful when using hardware wallets or other devices that require separate signatures or authorizations.\n\n\u003c/details\u003e\n\n## Usage\n\nBefore we dive in, it's worth mentioning that we have several comprehensive guides available covering different aspects of the library. These guides provide explanations and code examples in interactive playgrounds, allowing you to see the changes in the output as you modify the code. This hands-on learning experience, combined with clear explanations, helps you better understand how to use the library effectively. [Check out the available guides here](https://bitcoinerlab.com/guides).\n\nFurthermore, we've meticulously documented our API. For an in-depth look into Classes, functions, and types, head over [here](https://bitcoinerlab.com/modules/descriptors/api).\n\nTo use this library (and accompanying libraries), you can install them using:\n\n```bash\nnpm install @bitcoinerlab/descriptors\nnpm install @bitcoinerlab/miniscript\nnpm install @bitcoinerlab/secp256k1\n```\n\nThe library can be split into four main parts:\n\n- The `Output` class is the central component for managing descriptors. It facilitates the creation of outputs to receive funds and enables the signing and finalization of PSBTs (Partially Signed Bitcoin Transactions) for spending UTXOs (Unspent Transaction Outputs).\n- PSBT signers and finalizers, which are used to manage the signing and finalization of PSBTs.\n- `keyExpressions` and `scriptExpressions`, which provide functions to create key and standard descriptor expressions (strings) from structured data.\n- Hardware wallet integration, which provides support for interacting with hardware wallets such as Ledger devices.\n\n### Output class\n\nThe `Output` class is dynamically created by providing a cryptographic secp256k1 engine as shown below:\n\n```javascript\nimport * as ecc from '@bitcoinerlab/secp256k1';\nimport * as descriptors from '@bitcoinerlab/descriptors';\nconst { Output } = descriptors.DescriptorsFactory(ecc);\n```\n\nOnce set up, you can obtain an instance for an output, described by a descriptor such as a `wpkh`, as follows:\n\n```javascript\nconst wpkhOutput = new Output({\n  descriptor:\n    'wpkh(02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9)'\n});\n```\n\nFor miniscript-based descriptors, the `signersPubKeys` parameter in the constuctor becomes particularly important. It specifies the spending path of a previous output with multiple spending paths. Detailed information about the constructor parameters, including `signersPubKeys`, can be found in [the API documentation](https://bitcoinerlab.com/modules/descriptors/api/classes/_Internal_.Output.html#constructor) and in [this Stack Exchange answer](https://bitcoin.stackexchange.com/a/118036/89665).\n\nThe `Output` class [offers various helpful methods](https://bitcoinerlab.com/modules/descriptors/api/classes/_Internal_.Output.html), including `getAddress()`, which returns the address associated with the descriptor, `getScriptPubKey()`, which returns the `scriptPubKey` for the descriptor, `expand()`, which decomposes a descriptor into its elemental parts, `updatePsbtAsInput()` and `updatePsbtAsOutput()`.\n\n The library supports a wide range of descriptor types, including:\n - Pay-to-Public-Key-Hash (P2PKH): `pkh(KEY)`\n - Pay-to-Witness-Public-Key-Hash (P2WPKH): `wpkh(KEY)`\n - Pay-to-Script-Hash (P2SH): `sh(SCRIPT)`\n - Pay-to-Witness-Script-Hash (P2WSH): `wsh(SCRIPT)`\n - Pay-to-Taproot (P2TR) with single key: `tr(KEY)`\n - Address-based descriptors: `addr(ADDRESS)`, including Taproot addresses\n\n These descriptors can be used with various key expressions, including raw public keys, BIP32 derivation paths, and more.\n\nThe `updatePsbtAsInput()` method is an essential part of the library, responsible for adding an input to the PSBT corresponding to the UTXO  described by the descriptor. Additionally, when the descriptor expresses an absolute time-spending condition, such as \"This UTXO can only be spent after block N\", `updatePsbtAsInput()` adds timelock information to the PSBT.\n\nTo call `updatePsbtAsInput()`, use the following syntax:\n\n```javascript\nimport { Psbt } from 'bitcoinjs-lib';\nconst psbt = new Psbt();\nconst inputFinalizer = output.updatePsbtAsInput({ psbt, txHex, vout, rbf });\n```\n\nHere, `psbt` refers to an instance of the [bitcoinjs-lib Psbt class](https://github.com/bitcoinjs/bitcoinjs-lib). The parameter `txHex` denotes a hex string that serializes the previous transaction containing this output. Meanwhile, `vout` is an integer that marks the position of the output within that transaction. Finally, `rbf` is an optional parameter (defaulting to `true`) used to indicate whether the transaction uses Replace-By-Fee (RBF). When RBF is enabled, transactions can be replaced while they are in the mempool with others that have higher fees. Note that RBF is enabled for the entire transaction if at least one input signals it. Also, note that transactions using relative time locks inherently opt into RBF due to the `nSequence` range used.\n\nThe method returns the `inputFinalizer()` function. This finalizer function completes a PSBT input by adding the unlocking script (`scriptWitness` or `scriptSig`) that satisfies the previous output's spending conditions. Bear in mind that both `scriptSig` and `scriptWitness` incorporate signatures. As such, you should complete all necessary signing operations before calling `inputFinalizer()`. Detailed [explanations on the `inputFinalizer` method](#signers-and-finalizers-finalize-psbt-input) can be found in the Signers and Finalizers section.\n\nConversely, `updatePsbtAsOutput` allows you to add an output to a PSBT. For instance, to configure a `psbt` that sends `10,000` sats to the SegWit address `bc1qgw6xanldsz959z45y4dszehx4xkuzf7nfhya8x`:\n\n```javascript\nconst recipientOutput = \n new Output({ descriptor: `addr(bc1qgw6xanldsz959z45y4dszehx4xkuzf7nfhya8x)` });\nrecipientOutput.updatePsbtAsOutput({ psbt, value: 10000 });\n```\n\nFor further information on using the `Output` class, refer to the [comprehensive guides](https://bitcoinerlab.com/guides) that offer explanations and playgrounds to help learn the module. For specific details on the methods, refer directly to [the API](https://bitcoinerlab.com/modules/descriptors/api/classes/_Internal_.Output.html). For insights into the constructor, especially regarding the `signersPubKeys` parameter, as well as the usage of `updatePsbtAsInput`, `getAddress`, and `getScriptPubKey`, see this detailed [Stack Exchange answer](https://bitcoin.stackexchange.com/a/118036/89665).\n\n#### Parsing Descriptors with `expand()`\n\nThe `expand()` function serves as a mechanism to parse Bitcoin descriptors, unveiling a detailed breakdown of the descriptor's content. There are two main pathways to utilize this function:\n\n##### 1. Directly from an `Output` Instance\n\nIf you have already instantiated the `Output` class and created an output, you can directly use the [`expand()` method](https://bitcoinerlab.com/modules/descriptors/api/classes/_Internal_.Output.html#expand) on that `Output` instance. This method provides a straightforward way to parse descriptors without the need for additional utilities.\n\n```javascript\nconst output = new Output({ descriptor: \"your-descriptor-here\" });\nconst result = output.expand();\n```\n\n##### 2. Through the `DescriptorsFactory`\n\nIf you haven't instantiated the `Output` class or simply prefer a standalone utility, the `DescriptorsFactory` provides an `expand()` function that allows you to directly parse the descriptor. For a comprehensive understanding of all the function arguments, refer to [this reference](https://bitcoinerlab.com/modules/descriptors/api/functions/DescriptorsFactory.html#DescriptorsFactory). Here's how you can use it:\n\n```javascript\nconst { expand } = descriptors.DescriptorsFactory(ecc);\nconst result = expand({\n  descriptor: \"sh(wsh(andor(pk(0252972572d465d016d4c501887b8df303eee3ed602c056b1eb09260dfa0da0ab2),older(8640),pk([d34db33f/49'/0'/0']tpubDCdxmvzJ5QBjTN8oCjjyT2V58AyZvA1fkmCeZRC75QMoaHcVP2m45Bv3hmnR7ttAwkb2UNYyoXdHVt4gwBqRrJqLUU2JrM43HippxiWpHra/1/2/3/4/*))))\"\n});\n```\n\nRegardless of your chosen pathway, the outcome from `expand()` grants an insightful exploration into the descriptor's structure. For an exhaustive list of return properties, you can refer to [the API](https://bitcoinerlab.com/modules/descriptors/api/types/Expansion.html).\n\nFor illustration, given the descriptor above, the corresponding `expandedExpression` and a section of the `expansionMap` would appear as:\n\n```javascript\n{\n    expandedExpression: 'sh(wsh(andor(pk(@0),older(8640),pk(@1))))',\n    expansionMap: {\n      '@0': {\n        keyExpression:\n          '0252972572d465d016d4c501887b8df303eee3ed602c056b1eb09260dfa0da0ab2'\n      },\n      '@1': {\n        keyExpression:\n          \"[d34db33f/49'/0'/0']tpubDCdxmvzJ5QBjTN8oCjjyT2V58AyZvA1fkmCeZRC75QMoaHcVP2m45Bv3hmnR7ttAwkb2UNYyoXdHVt4gwBqRrJqLUU2JrM43HippxiWpHra/1/2/3/4/*\",\n        keyPath: '/1/2/3/4/*',\n        originPath: \"/49'/0'/0'\",\n        path: \"m/49'/0'/0'/1/2/3/4/*\",\n        // Other relevant properties returned: `pubkey`, `ecpair` \u0026 `bip32` interfaces, `masterFingerprint`, etc.\n      }\n    }\n    //...\n}\n```\n\n### Signers and Finalizers\n\nThis library encompasses a PSBT finalizer as well as three distinct signers: ECPair for single-signatures, BIP32, and Ledger (specifically crafted for Ledger Wallet devices, with upcoming support for other devices planned).\n\nTo incorporate these functionalities, use the following import statement:\n\n```javascript\nimport { signers } from '@bitcoinerlab/descriptors';\n```\n\nFor signing operations, utilize the methods provided by the [`signers`](https://bitcoinerlab.com/modules/descriptors/api/modules/signers.html):\n\n```javascript\n// For Ledger\nawait signers.signLedger({ psbt, ledgerManager });\n\n// For BIP32 - https://github.com/bitcoinjs/bip32\nsigners.signBIP32({ psbt, masterNode });\n\n// For ECPair - https://github.com/bitcoinjs/ecpair\nsigners.signECPair({ psbt, ecpair }); // Here, `ecpair` is an instance of the bitcoinjs-lib ECPairInterface\n```\n\nDetailed information on Ledger integration will be provided in subsequent sections.\n\n\u003ca name=\"signers-and-finalizers-finalize-psbt-input\"\u003e\u003c/a\u003e\n\n#### Finalizing the `psbt`\n\nWhen finalizing the `psbt`, the [`updatePsbtAsInput` method](https://bitcoinerlab.com/modules/descriptors/api/classes/_Internal_.Output.html#updatePsbtAsInput) plays a key role. When invoked, the `output.updatePsbtAsInput()` sets up the `psbt` by designating the output as an input and, if required, adjusts the transaction locktime. In addition, it returns a `inputFinalizer` function tailored for this specific `psbt` input.\n\n##### Procedure:\n\n1. For each unspent output from a previous transaction that you're referencing in a `psbt` as an input to be spent, call the `updatePsbtAsInput` method:\n\n   ```javascript\n   const inputFinalizer = output.updatePsbtAsInput({ psbt, txHex, vout });\n   ```\n\n2. Once you've completed the necessary signing operations on the `psbt`, use the returned finalizer function on each input:\n\n   ```javascript\n   inputFinalizer({ psbt });\n   ```\n\n##### Important Notes:\n\n- The finalizer function returned from `updatePsbtAsInput` adds the necessary unlocking script (`scriptWitness` or `scriptSig`) that satisfies the `Output`'s spending conditions. Remember, both `scriptSig` and `scriptWitness` contain signatures. Ensure that all necessary signing operations are completed before finalizing.\n\n- When using `updatePsbtAsInput`, the `txHex` parameter is crucial. For Segwit inputs, you can choose to pass `txId` and `value` instead of `txHex`. However, ensure the accuracy of the `value` to avoid potential fee attacks. When unsure, use `txHex` and skip `txId` and `value`.\n\n- Hardware wallets require the [full `txHex` for Segwit](https://blog.trezor.io/details-of-firmware-updates-for-trezor-one-version-1-9-1-and-trezor-model-t-version-2-3-1-1eba8f60f2dd).\n\n### Key Expressions and Script Expressions\n\nThis library also provides a series of function helpers designed to streamline the generation of `descriptor` strings. These strings can serve as input parameters in the `Output` class constructor. These helpers are nested within the `scriptExpressions` module. You can import them as illustrated below:\n\n```javascript\nimport { scriptExpressions } from '@bitcoinerlab/descriptors';\n```\n\nWithin the `scriptExpressions` module, there are functions designed to generate descriptors for commonly used scripts. Some examples include `pkhBIP32()`, `shWpkhBIP32()`, `wpkhBIP32()`, `pkhLedger()`, `shWpkhLedger()`, and `wpkhLedger()`. Refer to [the API](https://bitcoinerlab.com/modules/descriptors/api/modules/scriptExpressions.html#expand) for a detailed list and further information.\n\nWhen using BIP32-based descriptors, the following parameters are required for the `scriptExpressions` functions:\n\n```javascript\npkhBIP32(params: {\n  masterNode: BIP32Interface; //bitcoinjs-lib BIP32 - https://github.com/bitcoinjs/bip32\n  network?: Network; //A bitcoinjs-lib network\n  account: number;\n  change?: number | undefined; //0 -\u003e external (receive), 1 -\u003e internal (change)\n  index?: number | undefined | '*';\n  keyPath?: string; //You can use change \u0026 index or a keyPath such as \"/0/0\"\n  isPublic?: boolean; //Whether to use xpub or xprv\n})\n```\n\nFor functions suffixed with *Ledger* (designed to generate descriptors for Ledger Hardware devices), replace `masterNode` with `ledgerManager`. Detailed information on Ledger integration will be provided in the following section.\n\nThe `keyExpressions` category includes functions that generate string representations of key expressions for public keys.\n\nThis library includes the following `keyExpressions`: [`keyExpressionBIP32`](https://bitcoinerlab.com/modules/descriptors/api/functions/keyExpressionBIP32.html) and [`keyExpressionLedger`](https://bitcoinerlab.com/modules/descriptors/api/functions/keyExpressionLedger.html). They can be imported as follows:\n\n```javascript\nimport {\n  keyExpressionBIP32,\n  keyExpressionLedger\n} from '@bitcoinerlab/descriptors';\n```\n\nThe parameters required for these functions are:\n\n```javascript\nfunction keyExpressionBIP32({\n  masterNode: BIP32Interface; //bitcoinjs-lib BIP32 - https://github.com/bitcoinjs/bip32\n  originPath: string;\n  change?: number | undefined; //0 -\u003e external (receive), 1 -\u003e internal (change)\n  index?: number | undefined | '*';\n  keyPath?: string | undefined; //In the case of the Ledger, keyPath must be /\u003c1;0\u003e/number\n  isPublic?: boolean;\n});\n```\n\nFor the `keyExpressionLedger` function, you'd use `ledgerManager` instead of `masterNode`.\n\nBoth functions will generate strings that fully define BIP32 keys. For example:\n```text\n[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/1/*\n```\nRead [Bitcoin Core descriptors documentation](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md) to learn more about Key Expressions.\n\n### Hardware Wallet Integration\n\nThis library currently provides integration with Ledger wallets. Support for more devices is planned.\n\nBefore we dive in, note that, in addition to the documentation below, it is highly recommended to visit the [Ledger Playground](https://bitcoinerlab.com/guides/ledger-programming) with an interactive code sandbox of this lib interacting with a Ledger device.\n\nTo use this library with Ledger devices, you must first install Ledger support:\n\n```bash\nnpm install ledger-bitcoin\n```\n\nFor Ledger device signing, import the necessary functions as follows:\n\n```javascript\nimport Transport from '@ledgerhq/hw-transport-node-hid'; //or hw-transport-web-hid, for web\nimport { AppClient } from 'ledger-bitcoin';\nimport { ledger } from '@bitcoinerlab/descriptors';\n```\n\nThen, use the following code to assert that the Ledger app is running Bitcoin Test version 2.1.0 or higher, and to create a new Ledger client:\n\n```javascript\nconst transport = await Transport.create();\n//Throws if not running Bitcoin Test \u003e= 2.1.0\nawait ledger.assertLedgerApp({\n  transport,\n  name: 'Bitcoin Test',\n  minVersion: '2.1.0'\n});\n\nconst ledgerClient = new AppClient(transport);\nconst ledgerManager = { ledgerClient, ledgerState: {}, ecc, network };\n```\n\nHere, `transport` is an instance of a Transport object that allows communication with Ledger devices. You can use any of the transports [provided by Ledger](https://github.com/LedgerHQ/ledger-live#libs---libraries).\n\nTo register the policies of non-standard descriptors on the Ledger device, use the following code:\n\n```javascript\nawait ledger.registerLedgerWallet({\n  ledgerManager,\n  descriptor: wshDescriptor,\n  policyName: 'BitcoinerLab'\n});\n```\n\nThis code will auto-skip the policy registration process if it already exists. Please refer to [Ledger documentation](https://github.com/LedgerHQ/app-bitcoin-new/blob/develop/doc/wallet.md) to learn more about their Wallet Policies registration procedures.\n\nFinally, `ledgerManager.ledgerState` is an object used to store information related to Ledger devices. Although Ledger devices themselves are stateless, this object can be used to store information such as xpubs, master fingerprints, and wallet policies. You can pass an initially empty object that will be updated with more information as it is used. The object can be serialized and stored for future use.\n\nThe [API reference for the ledger module](https://bitcoinerlab.com/modules/descriptors/api/variables/ledger.html) provides a comprehensive list of functions related to the Ledger Hardware Wallet, along with detailed explanations of their parameters and behavior.\n\n\u003ca name=\"documentation\"\u003e\u003c/a\u003e\n\n## Additional Resources\n\nFor more information, refer to the following resources:\n\n- **[Guides](https://bitcoinerlab.com/guides)**: Comprehensive explanations and playgrounds to help you learn how to use the module.\n- **[API](https://bitcoinerlab.com/modules/descriptors/api)**: Dive into the details of the Classes, functions, and types.\n- **[Stack Exchange answer](https://bitcoin.stackexchange.com/a/118036/89665)**: Focused explanation on the constructor, specifically the `signersPubKeys` parameter, and the usage of `updatePsbtAsInput`, `getAddress`, and `getScriptPubKey`.\n- **[Integration tests](https://github.com/bitcoinerlab/descriptors/tree/main/test/integration)**: Well-commented code examples showcasing the usage of all functions in the module.\n- **Local Documentation**: Generate comprehensive API documentation from the source code:\n\n  ```bash\n  git clone https://github.com/bitcoinerlab/descriptors\n  cd descriptors/\n  npm install\n  npm run docs\n  ```\n\n  The generated documentation will be available in the `docs/` directory. Open the `index.html` file to view the documentation.\n\n## Authors and Contributors\n\nThe project was initially developed and is currently maintained by [Jose-Luis Landabaso](https://github.com/landabaso). Contributions and help from other developers are welcome.\n\nHere are some resources to help you get started with contributing:\n\n### Building from source\n\nTo download the source code and build the project, follow these steps:\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/bitcoinerlab/descriptors.git\n```\n\n2. Install the dependencies:\n\n```bash\nnpm install\n```\n\n3. Build the project:\n\n```bash\nnpm run build\n```\n\nThis will build the project and generate the necessary files in the `dist` directory.\n\n### Testing\n\nBefore committing any code, make sure it passes all tests. First, make sure that you have a Bitcoin regtest node running and that you have set up [this Express-based bitcoind manager](https://github.com/bitcoinjs/regtest-server) running on 127.0.0.1:8080.\n\nThe easiest way to set up these services is to use a Docker image that comes preconfigured with them. You can use the following commands to download and run the Docker image:\n\n```bash\ndocker pull bitcoinerlab/tester\ndocker run -d -p 8080:8080 -p 60401:60401 -p 3002:3002 bitcoinerlab/tester\n```\n\nThis will start a container running a Bitcoin regtest node and the bitcoind manager on your machine. Once you have your node and manager set up, you can run the tests using the following command:\n\n```bash\nnpm run test\n```\n\nAnd, in case you have a Ledger device:\n\n```bash\nnpm run test:integration:ledger\n```\n\n### License\n\nThis project is licensed under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoinerlab%2Fdescriptors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitcoinerlab%2Fdescriptors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoinerlab%2Fdescriptors/lists"}