Understanding Taproot Expressions and Miniscript

4 replies 533 views
CyberWhaleFull Member
Posts: 5 · Reputation: 294
#1Jan 15, 2021, 01:14 PM
I’m trying to figure out how to describe a Script Tree with both Script Path 1 and Script Path 2 using Taproot expression. So, I have this tr(InternalKey,{multi_a(2,Key1,Key2),pk(Key3)}) to import into Bitcoin core. But if I want to tweak script path 2, like changing it to something else, what goes in there? tr(InternalKey,{sortedmulti_a(2,Key1,Key2),???)
6 Reply Quote Share
matrix2021Full Member
Posts: 94 · Reputation: 612
#2Jan 15, 2021, 06:41 PM
Descriptors cannot describe all arbitrary scripts, only a subset with specific properties that make them analyzable. You must use Miniscript for those scripts. The miniscript that you want is probably something like and that would make a script of
9 Reply Quote Share
CyberWhaleFull Member
Posts: 5 · Reputation: 294
#3Jan 15, 2021, 09:49 PM
Thank you for the explanation. Now I know that because tree expressions in Taproot output have limitations, then to describe certain arbitrary scripts I have to use Miniscript, so that valid descriptors can be generated. With your explanation, I succeeded in importing the descriptor: tr(InternalKey,{sortedmulti_a(2,Key1,Key2),and_v(v:pk(key3),older(10))}) , and successfully created a transaction with the multisig 2-of-2 script path spend (through the GUI or using a console with walletcreatefundedpsbt option), but still have no luck in creating transactions with and_v(v:pk(key3),older(10)) script path spend.
6 Reply Quote Share
matrix2021Full Member
Posts: 94 · Reputation: 612
#4Jan 16, 2021, 06:18 AM
Not all Miniscript can be signed yet. I think we haven't implemented everything that's needed to pass in the information required to sign for both kinds of timelocks as well as hashlocks.
11 Reply Quote Share
CyberWhaleFull Member
Posts: 5 · Reputation: 294
#5Jan 16, 2021, 12:03 PM
Ah, I see. I thought there is something wrong with the variables that I used when building the transaction with walletcreatefundedpsbt, because for every change in the variables and arguments that I used, the results are the same, where the psbt cannot be signed with (Key3) descriptor.
10 Reply Quote Share

Related topics