MultiversX Tracker is Live!

How would one turn a Miniscript tree into a Taproot tree with Taproot'd Miniscript?

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 154 Views

A Taproot tree is a Merkle (binary) tree of (Tap)scripts. Every node (an intermediate state in the process of hashing the leaves up to the root) has at most 2 child nodes and every leaf script (at the bottom of the tree) is hashed before being hashed again with the concatenation of its hash and its sibling's hash.

A Miniscript tree doesn't do any hashing as it is just restructuring a single (possibly very large) script into fragments. The root of the Miniscript tree is the whole expression. Every subexpression is a node in the tree. The leaves are the expressions which don't have subexpressions, like pk() or older(). A node on the tree can have more than 2 children. For example, a node of the Miniscript tree could contain a thresh() which contains more than 2 subexpressions (e.g. a 2-of-3 threshold would contain three subexpressions). A node could also only have 1 child (e.g. if it contains one of the Miniscript wrappers a:, d: or l:).

The Taproot tree would be constructed at the Policy level rather than the Miniscript level as each (Tap)script on the leaves of the Taproot tree may be represented as an individual Miniscript (Miniscript only encodes a subset of Script in its entirety). But if we think about how a Taproot tree of policies might be constructed, if the "root" (highest level) of the Policy tree contained a or(A,B,C) this is easily deconstructed into a Taproot tree with leaves A, B and C. If the Policy root contained an and the whole Policy may need to go into a single leaf but there are possible exceptions (if there are disjunctions below it e.g. and(or(A,B),C) is equivalent to or(and(A,C),and(B,C)). If the Policy root contained a thresh (e.g. 2-of-3) it could be reconstructed as an or() of 3 2-of-2s as explained in this blog post for 2-of-3 threshold signature.

Thanks to individual(s) for answering my questions on IRC. Any mistakes are my own.


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments