bitcoinerlab / descriptors

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.
https://bitcoinerlab.com/modules/descriptors
41 stars 14 forks source link

Output descriptor with both receiving and change paths #31

Open louneskmt opened 7 months ago

louneskmt commented 7 months ago

Hey! I am trying to use an output descriptor with both the receiving (0) and change (1) paths, as follow: wpkh([284bbfa8/84h/1h/0h]tpubDCe8CRwGAiQ2r3rdChcB3Fp8v4GVjYJqoyKKwBczxGVNnawaK21p7sWh8oiMRo26wmSEhQqHGPVofX7t9BnGaSZjbED9WwRxMt8UeTjF64S/<0;1>/*). It seems that this library does not support this expression <0;1>? I get a Could not parse descriptor error while it seems to work well with 0 instead of <0;1>. Please let me know if I can be of any help implementing this, or the rationale behind not supporting this.

louneskmt commented 7 months ago

Oh okay, it is not directly in the specs but seems like an extension. Would be cool to have this anyway though!

landabaso commented 7 months ago

I believe this format is specific to Ledger. It's a more compact way to represent internal/external keys, making them easier to display on the device. @bigspider may have more insight into this, especially if it has gained wider adoption.

By the way, this library supports Ledger HWW. You can use standard * descriptors, and they are automatically converted to the Ledger format for use on Ledger devices.

bigspider commented 7 months ago

The multipath syntax is not (yet?) a standard (albeit already quite widely adopted by many software wallets, I think). There's a PR to add it to descriptors: https://github.com/bitcoin/bitcoin/pull/22838

Ledger's script wallet accounts are based on the wallet policies BIP proposal, also adopted in BitBox02 and Jade, but not yet standardized either.

louneskmt commented 7 months ago

albeit already quite widely adopted by many software wallets, I think

Yeah, I asked this because I was using an output descriptor from Sparrow for my tests and it is using this multipath syntax.

@landabaso Do you think it would be appropriate to support this syntax in the library, considering its growing adoption?