<oembed><type>rich</type><version>1.0</version><author_name>npub1fx98zxt3lzspjs5f4msr0fxysx5euucm29ghysryju7vpc9j0jzqtcl2d8</author_name><author_url>https://nostr.ae/npub1fx98zxt3lzspjs5f4msr0fxysx5euucm29ghysryju7vpc9j0jzqtcl2d8</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-05-07&#xA;📝 Original message:Thanks a lot for the many clarifications.&#xA;Yeah, I forgot it wasn&#39;t OP_CAT alone, but in combination with other things.&#xA;I guess this wouldn&#39;t be a covenants proposal then.&#xA;But simplicity would enable covenants too indeed, no?&#xA;Or did I get that wrong too?&#xA;&#xA;On Sat, May 7, 2022 at 5:06 AM ZmnSCPxj &lt;ZmnSCPxj at protonmail.com&gt; wrote:&#xA;&#xA;&gt; Good morning Jorge,&#xA;&gt;&#xA;&gt; &gt; OP_CAT was removed. If I remember correctly, some speculated that&#xA;&gt; perhaps it was removed because it could allow covenants.I don&#39;t remember&#xA;&gt; any technical concern about the OP besides enabling covenants.Before it was&#xA;&gt; a common opinion that covenants shouldn&#39;t be enabled in bitcoin because,&#xA;&gt; despite having good use case, there are some nasty attacks that are enabled&#xA;&gt; with them too. These days it seems the opinion of the benefits being worth&#xA;&gt; the dangers is quite generalized. Which is quite understandable given that&#xA;&gt; more use cases have been thought since then.&#xA;&gt;&#xA;&gt; I think the more accurate reason for why it was removed is because the&#xA;&gt; following SCRIPT of N size would lead to 2^N memory usage:&#xA;&gt;&#xA;&gt;     OP_1 OP_DUP OP_CAT OP_DUP OP_CAT OP_DUP OP_CAT OP_DUP OP_CAT OP_DUP&#xA;&gt; OP_CAT OP_DUP OP_CAT ...&#xA;&gt;&#xA;&gt; In particular it was removed at about the same time as `OP_MUL`, which has&#xA;&gt; similar behavior (consider that multiplying two 32-bit numbers results in a&#xA;&gt; 64-bit number, similar to `OP_CAT`ting a vector to itself).&#xA;&gt;&#xA;&gt; `OP_CAT` was removed long before covenants were even expressed as a&#xA;&gt; possibility.&#xA;&gt;&#xA;&gt; Covenants were first expressed as a possibility, I believe, during&#xA;&gt; discussions around P2SH.&#xA;&gt; Basically, at the time, the problem was this:&#xA;&gt;&#xA;&gt; * Some receivers wanted to use k-of-n multisignature for improved security.&#xA;&gt; * The only way to implement this, pre-P2SH, was by putting in the&#xA;&gt; `scriptPubKey` all the public keys.&#xA;&gt; * The sender is the one paying for the size of the `scriptPubKey`.&#xA;&gt; * It was considered unfair that the sender is paying for the security of&#xA;&gt; the receiver.&#xA;&gt;&#xA;&gt; Thus, `OP_EVAL` and the P2SH concept was conceived.&#xA;&gt; Instead of the `scriptPubKey` containing the k-of-n multisignature, you&#xA;&gt; create a separate script containing the public keys, then hash it, and the&#xA;&gt; `scriptPubKey` would contain the hash of the script.&#xA;&gt; By symmetry with the P2PKH template:&#xA;&gt;&#xA;&gt;     OP_DUP OP_HASH160 &lt;hash160(pubkey)&gt; OP_EQUALVERIFY OP_CHECKSIG&#xA;&gt;&#xA;&gt; The P2SH template would be:&#xA;&gt;&#xA;&gt;     OP_DUP OP_HASH160 &lt;hash160(redeemScript)&gt; OP_EQUALVERIFY OP_EVAL&#xA;&gt;&#xA;&gt; `OP_EVAL` would take the stack top vector and treat it as a Bitcoin SCRIPT.&#xA;&gt;&#xA;&gt; It was then pointed out that `OP_EVAL` could be used to create recursive&#xA;&gt; SCRIPTs by quining using `OP_CAT`.&#xA;&gt; `OP_CAT` was already disabled by then, but people were talking about&#xA;&gt; re-enabling it somehow by restricting the output size of `OP_CAT` to limit&#xA;&gt; the O(2^N) behavior.&#xA;&gt;&#xA;&gt; Thus, since then, `OP_CAT` has been associated with ***recursive***&#xA;&gt; covenants (and people are now reluctant to re-enable it even with a limit&#xA;&gt; on its output size, because recursive covenants).&#xA;&gt; In particular, `OP_CAT` in combination with `OP_CHECKSIGFROMSTACK` and&#xA;&gt; `OP_CHECKSIG`, you could get a deferred `OP_EVAL` and then use `OP_CAT` too&#xA;&gt; to quine.&#xA;&gt;&#xA;&gt; Because of those concerns, the modern P2SH is now &#34;just a template&#34; with&#xA;&gt; an implicit `OP_EVAL` of the `redeemScript`, but without any `OP_EVAL`&#xA;&gt; being actually enabled.&#xA;&gt;&#xA;&gt; (`OP_EVAL` cannot replace an `OP_NOP` in a softfork, but it is helpful to&#xA;&gt; remember that P2SH was pretty much what codified the difference between&#xA;&gt; softfork and hardfork, and the community at the time was small enough (or&#xA;&gt; so it seemed) that a hardfork might not have been disruptive.)&#xA;&gt;&#xA;&gt; &gt; Re-enabling OP_CAT with the exact same OP would be a hardfork, but&#xA;&gt; creating a new OP_CAT2 that does the same would be a softfork.&#xA;&gt;&#xA;&gt; If you are willing to work in Taproot the same OP-code can be enabled in a&#xA;&gt; softfork by using a new Tapscript version.&#xA;&gt;&#xA;&gt; If you worry about quantum-computing-break, a new SegWit version (which is&#xA;&gt; more limited than Tapscript versions, unfortunately) can also be used,&#xA;&gt; creating a new P2WSHv2 (or whatever version) that enables these opcodes.&#xA;&gt;&#xA;&gt; &gt; As far a I know, this is the covenants proposal that has been&#xA;&gt; implemented for the longest time, if that&#39;s to be used as a selection&#xA;&gt; criteria.And as always, this is not incompatible with deploying other&#xA;&gt; convenant proposals later.&#xA;&gt;&#xA;&gt; No, it was `OP_EVAL`, not `OP_CAT`.&#xA;&gt; In particular if `OP_EVAL` was allowed in the `redeemScript` then it would&#xA;&gt; enable covenants as well.&#xA;&gt; It was just pointed out that `OP_CAT` enables recursive covenenats in&#xA;&gt; combination with `OP_EVAL`-in-`redeemScript`.&#xA;&gt;&#xA;&gt; In particular, in combination with `OP_CAT`, `OP_EVAL` not only allows&#xA;&gt; recursive covenants, but also recursion *within* a SCRIPT i.e. unbounded&#xA;&gt; SCRIPT execution.&#xA;&gt; Thus, `OP_EVAL` is simply not going to fly, at all.&#xA;&gt;&#xA;&gt; &gt; Personally I find the simplicity proposal the best one among all the&#xA;&gt; covenant proposals by far, including this one.But I understand that despite&#xA;&gt; the name, the proposal is harder to review and test than other proposals,&#xA;&gt; for it wouldn&#39;t simply add covenants, but a complete new scripting language&#xA;&gt; that is better in many senses.Speedy covenants, on the other hand, is much&#xA;&gt; simpler and has been implemented for longer, so in principle, it should be&#xA;&gt; easier to deploy in a speedy manner.&#xA;&gt; &gt;&#xA;&gt; &gt; What are the main arguments against speedy covenants (aka op_cat2) and&#xA;&gt; against deploying simplicity in bitcoin respectively?&#xA;&gt; &gt; Sorry if this was discussed before.&#xA;&gt;&#xA;&gt; `OP_CAT`, by itself, does not implement any covenants --- instead, it&#xA;&gt; creates recursive covenants when combined with almost all covenant opcodes.&#xA;&gt;&#xA;&gt; Regards,&#xA;&gt; ZmnSCPxj&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20220507/a95bab51/attachment-0001.html&gt;</html></oembed>