Skip to content

Instantly share code, notes, and snippets.

@sanket1729
Created February 15, 2022 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanket1729/b1ed8ed776c7ac798d5e33e40f5d996d to your computer and use it in GitHub Desktop.
Save sanket1729/b1ed8ed776c7ac798d5e33e40f5d996d to your computer and use it in GitHub Desktop.
Classification of output descriptors

Output Descriptors

Descriptor Trait/Typeclass:

Table of API on along the rows, and columns showing the descriptor type. Each box represents

  • y = always succeeds
  • n = always fails
  • yn = may succeed

All descriptors sh/wsh/shwsh/tr/bare support miniscript descriptors

API vs Desc type bare pk/multi pkh sh sh(wsh/wpkh) wpkh wsh tr rawtr raw addr raw(pkh/wpkh/wsh/shwsh)
address n y y y y y y y n y y
script_pubkey y y y y y y y y y y y
unsigned_script_sig y y y y y y y y y n y
explicit_script y y y y y y n y y n n
satisfy yn yn yn yn yn yn yn yn n n n
max_satisfaction_weight y y yn yn y yn yn yn n n n
script_code y y y y y y n n y n n
  • unsigned_script_sig is only useful in ShWsh transactions.
  • explicit_script is the inner script inside the descriptor excluding all the wrapping(sh/wsh/shwsh) etc. Useful for
  • max_satisfaction_weight returns None when the underlying miniscript is impossible to satisfy.
  • sh/wsh/tr assume miniscript descriptors

Classifications in descriptors

Addressable vs non-addressable

  • Introduce WalletDescriptor descriptors that have address and can used in common scenarios with high level tool (sendtoaddress, QR codes etc). This includes all descriptors but bare(top level) pk, multi.

Taproot descriptors vs pretaproot descriptors

  • Taproot descriptors(tr) no longer have unique inner_script, instead contain a vector of scripts. Taproot descriptors also don't have a script_code, but use a different algorithm to compute sighash

Solvable vs non-solvable

  • Roughly solvable means that we should be able to produce witness for the descriptor given hashlock preimages, timelocks and secret keys.
  • all raw* and addr descriptors, but rawtr are non-solvable. Technically, it is possible to satisfy rawtr using secret key corresponding to the output key.

Partial descriptors vs full descriptors

  • All descriptors with raw* and addr are partial as they hide some information about how the descriptor was constructed. This is not the case for rawtr if the directly created from output key secret key without BIP341 tweaking.
  • The distinction between partial/full and solvable/non-solvable might not be worth it. It is partly confusing because rawtr is both a full descriptor and a partial descriptor
@darosior
Copy link

The distinction between partial/full and solvable/non-solvable might not be worth it.

I agree. Since the descriptor must be specified using the descriptor language, if our satisfaction engine is "complete" then any full descriptor is solvable. And any partial descriptor isn't solvable. Therefore solvability <-> partiality.

It is partly confusing because rawtr is both a full descriptor and a partial descriptor

If you are missing information to tell whether a script path exists, then it is partial. If you don't, then IMO you need to be able to represent it as a non-raw descriptor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment