Skip to content

Conversation

darosior
Copy link
Contributor

This integrates the necessary amendments to the specs to support Miniscript in Tapscript.

This is based on numerous previous discussions with a number of people. I think this gist reflects the latest state of the discussion.

@darosior darosior force-pushed the tapscript_miniscript branch from 8be8095 to d6fd61a Compare March 5, 2023 17:22
multi_a() has the same properties than multi() but 'n' (since all keys
may need to be dissatisfied, the top stack item of a satisfaction may be
the empty vectore). It could also be 'o' when it contains a single key..
But a `multi_a(1,key)` can always be subsituted by a `pk(key)`.
It's worth noting since for instance the hash in a pkh(key) script would
yield a different hash under Tapscript than under P2WSH.
@darosior darosior force-pushed the tapscript_miniscript branch from d6fd61a to 0c247a0 Compare March 14, 2023 14:44
@sipa
Copy link
Owner

sipa commented Mar 15, 2023

ACK 0c247a0

@sipa sipa merged commit 6d89225 into sipa:master Mar 15, 2023
@darosior darosior deleted the tapscript_miniscript branch March 15, 2023 16:55
wrapper applied to the <code>v:</code> wrapper applied to the <code>older</code> fragment for 144 blocks.
wrapper applied to the <code>v:</code> wrapper applied to the <code>older</code> fragment for 144 blocks. Note how
<samp>key</samp> expressions in this table and the followings are implicitly 32 bytes "x-only" public key in Tapscript
and 33 bytes compressed public keys in P2WSH.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe additionally clarify that under P2WSH the hash is generated with ripmed160(sha256(sha256(A))), whereas in taproot it's sha256(sha256(A_x)).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which hashes are you talking about? In Miniscript, if a hash is involved, it'll be written explicitly (hash256(), hash160(), sha256(), or ripemd160()).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In reference to 70fee03: "It's worth noting since for instance the hash in a pkh(key) script would
yield a different hash under Tapscript than under P2WSH."

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, pkh() always uses ripemd160(sha256(pubkey)), in P2WSH-miniscript, Tapscript-Miniscript, and in descriptors in general. It's only the public key encoding that's different in P2TR (because of xonly keys).

@@ -420,7 +420,7 @@ <h4>Correctness properties</h4>
<tr><td><code>a:X</code></td><td><em>X</em> is B</td><td>W</td><td>d=d<sub>X</sub>; u=u<sub>X</sub></td></tr>
<tr><td><code>s:X</code></td><td><em>X</em> is Bo</td><td>W</td><td>d=d<sub>X</sub>; u=u<sub>X</sub></td></tr>
<tr><td><code>c:X</code></td><td><em>X</em> is K</td><td>B</td><td>o=o<sub>X</sub>; n=n<sub>X</sub>; d=d<sub>X</sub>; u</td></tr>
<tr><td><code>d:X</code></td><td><em>X</em> is Vz</td><td>B</td><td>o; n; d</td></tr>
<tr><td><code>d:X</code></td><td><em>X</em> is Vz</td><td>B</td><td>o; n; d; <small>(Tapscript only)</small> u</td></tr>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the gist is says

d: remains available, and corresponds to the same script, but has different typing rules in tapscript miniscript (it always has the u type property)

Maybe add a comment below Then there are 5 type modifiers, which guarantee additional properties:.

For some fragments like andor(X,Y,Z) there's a complicated rule of how d and u are taken from the original. It's non-obvious to me that this guarantees "[d] always has the u type property". Can you clarify that?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by your question. Are you asking about d:, or about andor()? The latter does not always have the u property.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

andor() has rules for both the u and d property. It's unclear how those rules guarantee that any d also has u.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sjors Oh, I see your confusion now. There is both a d: wrapper and a d property, which are unrelated. This change is about the d: wrapper, which under Tapscript always has the u property. The d property in general is unaffected.

@Sjors
Copy link

Sjors commented Mar 17, 2023

The n-ary stuff is not included in this update yet? I'm also not seeing it mentioned in the Bitcoin Core PR (description).

Is the HEXCHAINCODE for unspendable() supposed to be randomly generated (for privacy)? Does that mean that anyone without the "xpriv" (of the HEXCHAINCODE) will not know it's unspendable?

@sipa
Copy link
Owner

sipa commented Mar 17, 2023

@Sjors This PR was just about taproot extensions; it doesn't include musig/unspendable/n-ary/partial descriptors/...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants