Bitcoin Forum
May 28, 2024, 11:54:42 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help with understanding Taproot tree expression  (Read 109 times)
punk.zink (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 402


Rollbit.com - Crypto Futures


View Profile
March 15, 2024, 05:28:41 PM
Merited by ABCbits (2)
 #1

As far as I know, to describe Script Tree with Script Path 1:
Code:
<Key1> OP_CHECKSIG <Key2> OP_CHECKSIGADD OP_2 OP_NUMEQUAL

and Script Path 2:
Code:
<Key3> OP_CHECKSIG 

I have to use Taproot expression: tr(InternalKey,{multi_a(2,Key1,Key2),pk(Key3)}), so that the descriptor can be imported into Bitcoin core with private key disabled.

However, for example, if I want to change script path 2 as
Code:
OP_10 OP_CHECKSEQUENCEVERIFY OP_DROP <Key3> OP_CHECKSIG

I don't know what kind of expression to use?

tr(InternalKey,{sortedmulti_a(2,Key1,Key2),???)})

R


▀▀▀▀▀▀▀██████▄▄
████████████████
▀▀▀▀█████▀▀▀█████
████████▌███▐████
▄▄▄▄█████▄▄▄█████
████████████████
▄▄▄▄▄▄▄██████▀▀
LLBITCRYPTO
FUTURES
[
1,000x
LEVERAGE
][
.
COMPETITIVE
FEES
][
INSTANT
EXECUTION
]██████
██
██
██
██
██
██
██
██
██
██
██
██████
████████████████████████████████████████████████████████
.
TRADE NOW
.
████████████████████████████████████████████████████████
██████
██
██
██
██
██
██
██
██
██
██
██
██████
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


View Profile WWW
March 17, 2024, 04:31:27 AM
Merited by LoyceV (6), ABCbits (4), punk.zink (2)
 #2

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
Code:
and_v(v:pk(key3),older(10))
and that would make a script of
Code:
<key3> OP_CHECKSIGVERIFY 10 OP_CHECKSEQUENCEVERIFY

punk.zink (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 402


Rollbit.com - Crypto Futures


View Profile
March 17, 2024, 03:25:29 PM
Merited by ABCbits (2)
 #3

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
Code:
and_v(v:pk(key3),older(10))
and that would make a script of
Code:
<key3> OP_CHECKSIGVERIFY 10 OP_CHECKSEQUENCEVERIFY

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.

R


▀▀▀▀▀▀▀██████▄▄
████████████████
▀▀▀▀█████▀▀▀█████
████████▌███▐████
▄▄▄▄█████▄▄▄█████
████████████████
▄▄▄▄▄▄▄██████▀▀
LLBITCRYPTO
FUTURES
[
1,000x
LEVERAGE
][
.
COMPETITIVE
FEES
][
INSTANT
EXECUTION
]██████
██
██
██
██
██
██
██
██
██
██
██
██████
████████████████████████████████████████████████████████
.
TRADE NOW
.
████████████████████████████████████████████████████████
██████
██
██
██
██
██
██
██
██
██
██
██
██████
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


View Profile WWW
March 17, 2024, 04:23:23 PM
Merited by ABCbits (1)
 #4

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.

punk.zink (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 402


Rollbit.com - Crypto Futures


View Profile
March 18, 2024, 01:30:33 PM
 #5

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.

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.

R


▀▀▀▀▀▀▀██████▄▄
████████████████
▀▀▀▀█████▀▀▀█████
████████▌███▐████
▄▄▄▄█████▄▄▄█████
████████████████
▄▄▄▄▄▄▄██████▀▀
LLBITCRYPTO
FUTURES
[
1,000x
LEVERAGE
][
.
COMPETITIVE
FEES
][
INSTANT
EXECUTION
]██████
██
██
██
██
██
██
██
██
██
██
██
██████
████████████████████████████████████████████████████████
.
TRADE NOW
.
████████████████████████████████████████████████████████
██████
██
██
██
██
██
██
██
██
██
██
██
██████
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!