4

Can output descriptors be used to describe an arbitrary script?

Say I had a script something like the following:

OP_IF
  1737417600 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 <pubKeyHashD> OP_EQUALVERIFY OP_CHECKSIG
OP_ELSE
  2 <PubKeyA> <PubKeyB> <PubKeyC> 3 OP_CHECKMULTISIG
OP_ENDIF

That's a two-branch script that either allows a 2-of-3 multisig or a single-address retrieval after a set amount of time. Is there a way to convert that into descriptor that I could then use to derive addresses?

wsh seems focused on set types of scripts, while trying raw on a 32-bit hash of a script gives me Descriptor does not have a corresponding address.

4

Output script descriptors do not currently support any arbitrary script. However once extended by Miniscript, descriptors will be able to support any script logically. Minscript is an extension of descriptors which allows for arbitrary scripts, within certain parameters. While you cannot specify any arbitrary script, you can use Minscript to create an arbitrary script that does what you want. This will not necessarily be the same as an arbitrary script that you come up with, but it will be logically identical.

1
  • Thanks, Andrew! I'd seen that the functionality looked possible in miniscript, I appreciate the pointer that it's the way to go.
    – Shannon A.
    May 26 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.