<oembed><type>rich</type><version>1.0</version><author_name>npub1g5zswf6y48f7fy90jf3tlcuwdmjn8znhzaa4vkmtxaeskca8hpss23ms3l</author_name><author_url>https://nostr.ae/npub1g5zswf6y48f7fy90jf3tlcuwdmjn8znhzaa4vkmtxaeskca8hpss23ms3l</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-05-07&#xA;📝 Original message:Good morning Jorge,&#xA;&#xA;&gt; Thanks a lot for the many clarifications.&#xA;&gt; Yeah, I forgot it wasn&#39;t OP_CAT alone, but in combination with other things.&#xA;&gt; I guess this wouldn&#39;t be a covenants proposal then.&#xA;&gt; But simplicity would enable covenants too indeed, no?&#xA;&gt; Or did I get that wrong too?&#xA;&#xA;Yes, it would enable covenants.&#xA;&#xA;However, it could also enable *recursive* covenants, depending on what introspection operations are actually implemented (though maybe not? Russell O&#39;Connor should be the one that answers this).&#xA;&#xA;It is helpful to delineate between non-recursive covenants from recursive covenants.&#xA;&#xA;* Even ***with*** `OP_CAT`, the following will enable non-recursive covenants without enabling recursive covenants:&#xA;  * `OP_CTV`&#xA;  * `SIGHASH_ANYPREVOUT`&#xA;* With `OP_CAT`, the following would enable recursive covenants:&#xA;  * `OP_EVAL`&#xA;  * `OP_CHECKSIGFROMSTACK`&#xA;  * `OP_TX`/`OP_TXHASH`&#xA;  * ...possibly more.&#xA;    * It is actually *easier* to *design* an opcode which inadvertently supports recursive covenants than to design one which avoids recursive covenants.&#xA;&#xA;Recursive covenants are very near to true Turing-completeness.&#xA;We want to avoid Turing-completeness due to the halting problem being unsolvable for Turing-complete languages.&#xA;That is, given just a program, we cannot determine for sure if for all possible inputs, it will terminate.&#xA;It is important in our context (Bitcoin) that any SCRIPT programs we write *must* terminate, or else we run the risk of a DoS on the network.&#xA;&#xA;A fair amount of this is theoretical crap, but if you want to split hairs, recursive covenants are *not* Turing-complete, but are instead total functional programming with codata.&#xA;&#xA;As a very rough bastardization, a program written in a total functional programming language with codata will always assuredly terminate.&#xA;However, the return value of a total functional programming language with codata can be another program.&#xA;An external program (written in a Turing-complete language) could then just keep invoking the interpreter of the total functional programming language with codata (taking the output program and running it, taking *its* output program and running it, ad infinitum, thus effectively able to loop indefinitely.&#xA;&#xA;Translated to Bitcoin transactions, a recursive covenant system can force an output to be spent only if the output is spent on a transaction where one of the outputs is the same covenant (possibly with tweaks).&#xA;Then an external program can keep passing the output program to the Bitcoin SCRIPT interpreter --- by building transactions that spend the previous output.&#xA;&#xA;This behavior is still of concern.&#xA;It may be possible to attack the network by eroding its supply, by such a recursive covenant.&#xA;&#xA;--&#xA;&#xA;Common reactions:&#xA;&#xA;* We can just limit the number of opcodes we can process and then fail it if it takes too many operations!&#xA;  That way we can avoid DoS!&#xA;  * Yes, this indeed drops it from Turing-complete to total, possibly total functional programming **without** codata.&#xA;    But if it is possible to treat data as code, it may drop it &#34;total but with codata&#34; instead (i.e. recursive covenants).&#xA;    But if you want to avoid recursive covenants while allowing recursive ones (i.e. equivalent to total without codata), may I suggest you instead look at `OP_CTV` and `SIGHASH_ANYPREVOUT`?&#xA;&#xA;* What is so wrong with total-with-codata anyway??&#xA;  So what if the recursive covenant could potentially consume all Bitcoins, nobody will pay to it except as a novelty!!&#xA;  If you want to burn your funds, 1BitcoinEater willingly accepts it!&#xA;  * The burden of proof-of-safety is on the proposer, so if you have some proof that total-with-codata is safe, by construction, then sure, we can add opcodes that may enable recursive covenants, and add `OP_CAT` back in too.&#xA;&#xA;Regards,&#xA;ZmnSCPxj</html></oembed>