From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 46105C0012 for ; Thu, 23 Dec 2021 11:55:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2DAA760EF0 for ; Thu, 23 Dec 2021 11:55:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -0.2 X-Spam-Level: X-Spam-Status: No, score=-0.2 tagged_above=-999 required=5 tests=[BAYES_40=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=tutanota.de Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qnuR4xpMPD7f for ; Thu, 23 Dec 2021 11:55:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from w1.tutanota.de (w1.tutanota.de [81.3.6.162]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0DCDC60DCA for ; Thu, 23 Dec 2021 11:55:33 +0000 (UTC) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w1.tutanota.de (Postfix) with ESMTP id 6A493FBF84E; Thu, 23 Dec 2021 11:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1640260531; s=s1; d=tutanota.de; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=gu3Xr+MwI+QaGaA22QlfDvwEQSRBNa8UnlxIIoYeGBE=; b=MxnLPVaNHk1im9mjtM658PF5IsRrH7lLGT9WGe7Sgpj0pkfbhZN0Pfz/63JuEiok fkM3TakBwnfrUltxvozr0+dYnHfIKKrT6nWfL7bEaN1a9jdERD0PHR/NKvLuieilhDL 66YM1HI1whwHr/Ki5ATulkJOiYOBNSXO8Jvr0i1bZgdOXj9y5HD+ca+4uTjsLhgukH1 bI6JJANQaGfsUM3wZPu3Z1Q3fqtbQ4msrxOItAYIPpjlQ90udTndqZMDw/RJUeNi6sy zonN5J/f/t3TDlKICHged/CeskDXG0zqu31md6rhrjb/YeFYCBXMdhywQDnL7ECe4mT He1Tzs9UnQ== Date: Thu, 23 Dec 2021 12:55:31 +0100 (CET) From: Prayank To: Jeremy Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_67043_1723523109.1640260531416" X-Mailman-Approved-At: Thu, 23 Dec 2021 17:38:21 +0000 Cc: Bitcoin Dev Subject: Re: [bitcoin-dev] [Bitcoin Advent Calendar] Review of Smart Contract Concepts X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Dec 2021 11:55:35 -0000 ------=_Part_67043_1723523109.1640260531416 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Jeremy, > This post covers some high-level smart contract concepts that different opcodes or proposals could have (or not). https://rubin.io/bitcoin/2021/12/04/advent-7/ Interesting post. I love the concept of recursion in programming. There is = one Indian movie called 'Karthik calling Karthik' which is one of the ways = I remember this concept.=20 > Recursive is pretty much just a fancy way of saying =E2=80=9Cloops=E2=80= =9D. This is sometimesalso called =E2=80=9CTuring Complete=E2=80=9D. Recently asked one dumb question on Stakexchange after reading a comment on= reddit, maybe you can add anything new in this: https://bitcoin.stackexchange.com/questions/111337/loops-in-bitcoin-scripti= ng > Here, the contract terminates after one canceled request by moving the co= inelsewhere. It=E2=80=99s possible to emulate recursive behavior a limited= amount by=E2=80=9Cunrolling=E2=80=9D a loop. I think this is what I did in the above link where for loop was replaced wi= th if-else statements. > However, unrolling has it=E2=80=99s limits. When choices(action A or B) a= re introduced, unrolling can be less effective since you haveand exponentia= l blowup (that means unrolling even like 32 steps might be toomany). Howeve= r, there are some tricks that can be employed by a clever andcareful progra= mmer to reduce this complexity through, for example, memoization. Agree with limits and possibility of optimization. > The key difference being that in the fully enumerated case we must know t= he exact specifics of the contract and how it will execute, and in the open= ended contract case there are bits and pieces we can dynamically specify. = If Alice is paid 1 BTC by December 25th, 2021 Midnight, then transfer 100 t= okensto one of Bob=E2=80=99s Address B1, B2, or B3 at Bob=E2=80=99s discret= ion. Interesting > Signing the transaction fee rate as a function of locktime TIL --=20 Prayank A3B1 E430 2298 178F ------=_Part_67043_1723523109.1640260531416 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Jeremy,

>= This post covers some high-level smart contract concepts that different
opcodes or proposals could have (or not).
https://rubin.io/bitcoin/2021/12/04/advent-7/
<= div dir=3D"auto">
Interesting post. I love the c= oncept of recursion in programming. There is one Indian movie called 'Karth= ik calling Karthik' which is one of the ways I remember this concept.
<= /div>

> Recursive is pretty= much just a fancy way of saying =E2=80=9Cloops=E2=80=9D. This is sometimes also called =E2=80=9CTuring Complete=E2=80=9D.
<= br>
Recently asked one dumb question on Stakexchange= after reading a comment on reddit, maybe you can add anything new in this:=

https://bitcoin.sta= ckexchange.com/questions/111337/loops-in-bitcoin-scripting

> Here, the contract terminates a= fter one canceled request by moving the coin elsewhere. It=E2=80=99s possible to emulate recursive behavior a limited a= mount by =E2=80=9Cunrolling=E2=80=9D a loop.

I think this is what I did in the above link where for loop= was replaced with if-else statements.

> However, unrolling has it=E2=80=99s limits. When ch= oices (action A or B) are introduced, unrolling can be less effective since you h= ave and exponential blowup (that means unrolling even like 32 steps might be to= o many). However, there are some tricks that can be employed by a clever and careful programmer to reduce this complexity through, for example, memoizat= ion.

Agree with limi= ts and possibility of optimization.

> The key difference being that in the fully enumerated = case we must know the exact specifics of the contract and how it will execu= te, and in the open ended contract case there are bits and pieces we can dy= namically specify. If Alice is paid 1 BTC by December 25th, 2021 Midnight, = then transfer 100 tokens to one of Bob=E2=80=99s Address B1, B2, or B3 at Bob=E2=80=99s discretion.<= br>

Interesting

> Signing the transa= ction fee rate as a function of locktime

TIL


--
=
Prayank

A3B1 E430 2298 178F<= br>
------=_Part_67043_1723523109.1640260531416--