<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">The issue with that approach without support for the privacy-encouraging wrapper proposed by Greg here is that it encourages adoption halfway and destroys a lot of the value of the apparent-script monoculture for privacy preservation. Greg&#39;s proposal here doesn&#39;t change the format of any specific MAST implementation, but instead adds the privacy wrapper that I always felt was missing in existing proposals, without any real additional overhead in many use-cases!<br>
<br>
Indeed, permissionless innovation is important, but the huge advantage of providing the privacy wrapper by default here is absolutely massive to the ecosystem and should not be handwaved away for vague possibly-advantages.<br>
<br>
Matt<br><br><div class="gmail_quote">On January 23, 2018 2:39:37 PM UTC, Mark Friedenbach &lt;mark@friedenbach.org&gt; wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I had the opposite response in private, which I will share here. As recently as Jan 9th feedback on BIP 117 was shared on this list by Pieter Wuille and others suggesting we adopt native MAST template instead of the user programmable combination of BIPs 116 and 117. Part of my response then was, I quote:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">I havent the hubris to suggest that we know exactly what a templated MAST *should* look like. It's not used in production anywhere. Even if we did have the foresight, the tail-call semantics allow for other constructions besides MAST and for the sake of the future we should allow such permission-less innovation. The proper sequence of events should be to enable features in a generic way, and then to create specialized templates to save space for common constructions. Not the other way around. [1]</div></blockquote><div class=""><div><br class=""></div><div>I take this advance as further evidence in favor of this view. As recently as 24 hours ago if you had asked what a native-MAST template would have looked like, the answer would have been something like Johnson Lau’s BIP 114, with some quibbling over details. Taproot is a clearly superior approach. But is it optimal? I don’t think we can claim that now. Optimality of these constructs isn’t something easily proven, with the nearest substitute being unchanging consensus over extended periods of time.</div><div><br class=""></div><div>Every time we add an output type specialization, we introduce a new codepath in the core of the script consensus that must be maintained forever. Take P2SH: from this point forward there is no reason to use it in new applications, ever. But it must be forever supported. In an alternate universe we could have deployed a native MAST proposal, like BIP 114, only to have Taproot-like schemes discovered after activation. That would have been a sucky outcome. It is still the case that we could go for Taproot right now, and then in six months or a year’s time we find an important tweak or a different approach entirely that is even better, but the activation process had already started. That would be a sucky outcome we haven’t avoided yet.</div><div><br class=""></div><div>This is not an argument against template specialization for common code paths, especially those which increase fungibility of coins. I do think we should have a native MAST template eventually, using Taproot or something better. However if I may be allowed I will make an educated guess about the origin of Taproot: I think it’s no coincidence that Greg had this insight and/or wrote it up simultaneous with a push by myself and others for getting MAST features into bitcoin via BIPs 98, 116, and 117, or 114. Cryptographers tend to only think up solutions to problems that are on their minds. And the problems on most people’s minds are primarily those that are deployable today, or otherwise near-term applicable.</div><div><br class=""></div><div>BIPS 116 and 117 each provide a reusable component that together happens to enable a generic form of MAST. Even without the workarounds required to avoid CLEANSTACK violations, the resulting MAST template is larger than what is possible with specialization. However let’s not forget that (1) they also enable other applications like honeypots, key trees, and script delegation; and relevant to this conversation (2) they get the MAST feature available for use in production by the wider community. I don’t think I’d personally be willing to bet that we found the optimal MAST structure in Greg’s Taproot until we have people doing interesting production work like multisig wallets, lightning protocol, and the next set of consensus features start putting it into production and exploring edge cases. We may find ways Taproot can be tweaked to enable other applications (like encoding a hash preimage as well) or simplify obscure corner cases.</div><div><br class=""></div><div>I feel quite strongly that the correct approach is to add support for generic features to accomplish the underlying goal in a user programmable way, and THEN after activation and some usage consider ways in which common use cases can be made more efficient through output specialization. To take a more obvious example, lightning protocol is still an active area or research and I think it is abundantly clear that we don’t know yet what the globally optimal layer-2 caching protocol will be, even if we have educated guesses as to its broad structure. A proposal right now to standardize a more compact lightning script type would be rightly rejected. It is less obvious but just as true that the same should hold for MAST.</div><div><br class=""></div><div>I have argued these points before in favor of permission less innovation first, then application specialization later, in [1] and at the end of the rather long email [2]. I hope you can take the time to read those if you still feel we should take a specialized template approach instead of the user programmable BIPSs 116 and 117.</div><div><br class=""></div><div>[1]&nbsp;<a href="https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-January/015537.html" class="">https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-January/015537.html</a></div><div>[2]&nbsp;<a href="https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-September/015029.html" class="">https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-September/015029.html</a></div><div><br class=""></div><div><blockquote type="cite" class=""><div class="">On Jan 22, 2018, at 6:51 PM, Matt Corallo via bitcoin-dev &lt;<a href="mailto:bitcoin-dev@lists.linuxfoundation.org" class="">bitcoin-dev@lists.linuxfoundation.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Thanks Greg!<br class="">
<br class="">
I'd be hesitant to deploy a MAST proposal without this clever application of pay-to-contract-hash now! Looks like the overhead over a more-naive MAST construction is rather trivial, too!<br class="">
<br class="">
Matt<br class=""><br class=""><div class="gmail_quote">On January 23, 2018 12:30:06 AM UTC, Gregory Maxwell via bitcoin-dev &lt;<a href="mailto:bitcoin-dev@lists.linuxfoundation.org" class="">bitcoin-dev@lists.linuxfoundation.org</a>&gt; wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Interest in merkelized scriptPubKeys (e.g. MAST) is driven by two main<br class="">areas: efficiency and privacy. Efficiency because unexecuted forks of<br class="">a script can avoid ever hitting the chain, and privacy because hiding<br class="">unexecuted code leaves scripts indistinguishable to the extent that<br class="">their only differences are in the unexecuted parts.<br class=""><br class="">As Mark Friedenbach and others have pointed out before it is almost<br class="">always the case that interesting scripts have a logical top level<br class="">branch which allows satisfaction of the contract with nothing other<br class="">than a signature by all parties.  Other branches would only be used<br class="">where some participant is failing to cooperate. More strongly stated,<br class="">I believe that _any_ contract with a fixed finite participant set<br class="">upfront can be and should be represented as an OR between an N-of-N<br class="">and whatever more complex contract you might want to represent.<br class=""><br class="">One point that comes up while talking about merkelized scripts is can<br class="">we go about making fancier contract use cases as indistinguishable as<br class="">possible from the most common and boring payments. Otherwise, if the<br class="">anonymity set of fancy usage is only other fancy usage it may not be<br class="">very large in practice. One suggestion has been that ordinary<br class="">checksig-only scripts should include a dummy branch for the rest of<br class="">the tree (e.g. a random value hash), making it look like there are<br class="">potentially alternative rules when there aren't really.  The negative<br class="">side of this is an additional 32-byte overhead for the overwhelmingly<br class="">common case which doesn't need it.  I think the privacy gains are<br class="">worth doing such a thing, but different people reason differently<br class="">about these trade-offs.<br class=""><br class="">It turns out, however, that there is no need to make a trade-off.  The<br class="">special case of a top level "threshold-signature OR<br class="">arbitrary-conditions" can be made indistinguishable from a normal<br class="">one-party signature, with no overhead at all, with a special<br class="">delegating CHECKSIG which I call Taproot.<br class=""><br class="">Let's say we want to create a coin that can be redeemed by either<br class="">Alice &amp;&amp; Bob   or by CSV-timelock &amp;&amp; Bob.<br class=""><br class="">Alice has public A, Bob has pubkey B.<br class=""><br class="">We compute the 2-of-2 aggregate key C = A + B.  (Simplified; to<br class="">protect against rogue key attacks you may want to use the MuSig key<br class="">aggregation function [1])<br class=""><br class="">We form our timelock script S =  "&lt;timeout&gt; OP_CSV OP_DROP B OP_CHECKSIGVERIFY"<br class=""><br class="">Now we tweak C to produce P which is the key we'll publish: P = C + H(C||S)G.<br class=""><br class="">(This is the attack hardened pay-to-contract construction described in [2])<br class=""><br class="">Then we pay to a scriptPubKey of [Taproot supporting version] [EC point P].<br class=""><br class="">Now Alice and Bob-- assuming they are both online and agree about the<br class="">resolution of their contract-- can jointly form a 2 of 2 signature for<br class="">P, and spend as if it were a payment to a single party (one of them<br class="">just needs to add H(C||S) to their private key).<br class=""><br class="">Alternatively, the Taproot consensus rules would allow this script to<br class="">be satisfied by someone who provides the network with C (the original<br class="">combined pubkey), S, and does whatever S requires-- e.g. passes the<br class="">CSV check and provides Bob's signature. With this information the<br class="">network can verify that C + H(C||S) == P.<br class=""><br class="">So in the all-sign case there is zero overhead; and no one can tell<br class="">that the contract alternative exists. In the alternative redemption<br class="">branch the only overhead is revealing the original combined pubkey<br class="">and, of course, the existence of the contract is made public.<br class=""><br class="">This composes just fine with whatever other merkelized script system<br class="">we might care to use, as the S can be whatever kind of data we want,<br class="">including the root of some tree.<br class=""><br class="">My example shows 2-of-2 but it works the same for any number of<br class="">participants (and with setup interaction any threshold of<br class="">participants, so long as you don't mind an inability to tell which<br class="">members signed off).<br class=""><br class="">The verification computational complexity of signature path is<br class="">obviously the same as any other plain signature (since its<br class="">indistinguishable). Verification of the branch redemption requires a<br class="">hash and a multiplication with a constant point which is strictly more<br class="">efficient than a signature verification and could be efficiently fused<br class="">into batch signature validation.<br class=""><br class="">The nearest competitor to this idea that I can come up with would<br class="">supporting a simple delegation where the output can be spent by the<br class="">named key, or a spending transaction could provide a script along with<br class="">a signature of that script by the named key, delegating control to the<br class="">signed script. Before paying into that escrow Alice/Bob would<br class="">construct this signature. This idea is equally efficient in the common<br class="">case, but larger and slower to verify in the alternative spend case.<br class="">Setting up the signature requires additional interaction between<br class="">participants and the resulting signature must be durably stored and<br class="">couldn't just be recomputed using single-party information.<br class=""><br class="">I believe this construction will allow the largest possible anonymity<br class="">set for fixed party smart contracts by making them look like the<br class="">simplest possible payments. It accomplishes this without any overhead<br class="">in the common case, invoking any sketchy or impractical techniques,<br class="">requiring extra rounds of interaction between contract participants,<br class="">and without requiring the durable storage of other data.<br class=""><br class=""><br class="">[1] <a href="https://eprint.iacr.org/2018/068" class="">https://eprint.iacr.org/2018/068</a><br class="">[2] <a href="https://blockstream.com/sidechains.pdf" class="">https://blockstream.com/sidechains.pdf</a> Appendix A<br class=""><hr class=""><br class="">bitcoin-dev mailing list<br class=""><a href="mailto:bitcoin-dev@lists.linuxfoundation.org" class="">bitcoin-dev@lists.linuxfoundation.org</a><br class=""><a href="https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" class="">https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev</a><br class=""></pre></blockquote></div></div>_______________________________________________<br class="">bitcoin-dev mailing list<br class=""><a href="mailto:bitcoin-dev@lists.linuxfoundation.org" class="">bitcoin-dev@lists.linuxfoundation.org</a><br class="">https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev<br class=""></div></blockquote></div><br class=""></div></blockquote></div></body></html>