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

Master key prefix m is added to non-master xpub's path #33

Closed saravanan7mani closed 6 months ago

saravanan7mani commented 7 months ago

Derivation path prefix m is added to xpubs which are not master key and has no origin information. Is it possible to error out if the xpub has parent fingerprint but the key has no origin path?

https://github.com/bitcoinerlab/descriptors/blob/main/src/keyExpressions.ts#L174

landabaso commented 6 months ago

Yes, thank you for the report, @saravanan7mani. I have taken note of the issue. Could you let me know if an immediate fix is required for your use case, or if it is acceptable to include the fix in a next release?

saravanan7mani commented 6 months ago

Thank you for the response @landabaso. next release works fine. May i know the ETA next release?

saravanan7mani commented 6 months ago

https://bitcoin.stackexchange.com/questions/120972/why-do-psbt-and-descriptor-enforce-providing-the-bip32-derivation-path-from-the

I just got this answer from BIP174 author. Relevant to this thread.

landabaso commented 6 months ago

Thank you for the discussion on this issue. Based on the insights shared, it's clear that any key in a derivation path can act as a master key for its children, which aligns with our library's approach of assuming descriptor key expressions are master keys. The use of 'm' is primarily for user clarity in visualizing derivation paths... I think it's ok to keep the current implementation with the 'm' prefix. Do you agree? I welcome any further thoughts or concerns.

saravanan7mani commented 6 months ago

Yes, I agree. It seems those who use bip32.js lib should remove the prefix m to avoid this error