Skip to content

implement output script descriptors #5694

Open
@SomberNight

Description

We should consider implementing support for output script descriptors.

See:

These would most likely replace the ypubs/zpubs we currently use (deprecate them).
These would allow e.g. importing and spending from p2pk scripts, or non-HD multisig scripts.

Perhaps more importantly however, when handling PSBTs, signers will often want a derivation path prefix for an xpub and the root xpub's fingerprint. This data is not contained in ypubs/zpubs. Hence, e.g. a wallet created from a zpub cannot create a PSBT that a coldcard will sign; and it's even worse in case of multisig wallets (see #5672 (comment)).


Unfortunately Ypubs/Zpubs don't map neatly onto output script descriptors. An output script descriptor describes the whole output script, so e.g. often contains multiple xpubs. Hence a Zpub is basically a partial descriptor.
Further, our wallet code given an xpub always creates an m/0/i, m/1/j hierarchy (where the latter is for change); but this can only be described via two output script descriptors, not one.

The above means we might have to change the wizard (UI) flow, for example.

To illustrate, see example taken from HWI docs:

$ ./hwi.py -f 8038ecd9 getkeypool --wpkh 0 1000
[
  {
    "desc": "wpkh([8038ecd9/84h/0h/0h]xpub6DR4rqx16YnCcfwFqgwvJdKiWrjDRzqxYTY44aoyHwZDSeSB5n2tqt42aYr9qPKhSKUdftPdTjhHrKKD6WGKVbuyhMvGH76VyKKZubg8o4P/0/*)#36sal9a4",
    "internal": false,
    "range": [0, 1000],
    "timestamp": "now",
    "keypool": true,
    "watchonly": true
  },
  {
    "desc": "wpkh([8038ecd9/84h/0h/0h]xpub6DR4rqx16YnCcfwFqgwvJdKiWrjDRzqxYTY44aoyHwZDSeSB5n2tqt42aYr9qPKhSKUdftPdTjhHrKKD6WGKVbuyhMvGH76VyKKZubg8o4P/1/*)#nl2rc26w",
    "internal": true,
    "range": [0, 1000],
    "timestamp": "now",
    "keypool": true,
    "watchonly": true
  }
]

Metadata

Assignees

Labels

topic-wallet 👛related to wallet.py, or maybe address_synchronizer.py/coinchooser.py

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions