diff options
author | Prayank <prayank@tutanota.de> | 2021-12-23 12:55:31 +0100 |
---|---|---|
committer | bitcoindev <bitcoindev@gnusha.org> | 2021-12-23 11:55:35 +0000 |
commit | d14d088d638e2eb1fbab02f5aa0f1988fc5d6c08 (patch) | |
tree | 6c79100ca0eec921a8c9e5d6c94e9791eeae3e95 | |
parent | 669ed24f9025111f3314d9ca5e1ffc4e09dea04f (diff) | |
download | pi-bitcoindev-d14d088d638e2eb1fbab02f5aa0f1988fc5d6c08.tar.gz pi-bitcoindev-d14d088d638e2eb1fbab02f5aa0f1988fc5d6c08.zip |
Re: [bitcoin-dev] [Bitcoin Advent Calendar] Review of Smart Contract Concepts
-rw-r--r-- | a0/d8cbfb864ab0a1fb2448334a1ed8344ff3b41f | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/a0/d8cbfb864ab0a1fb2448334a1ed8344ff3b41f b/a0/d8cbfb864ab0a1fb2448334a1ed8344ff3b41f new file mode 100644 index 000000000..b5abc93d3 --- /dev/null +++ b/a0/d8cbfb864ab0a1fb2448334a1ed8344ff3b41f @@ -0,0 +1,182 @@ +Return-Path: <prayank@tutanota.de> +Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) + by lists.linuxfoundation.org (Postfix) with ESMTP id 46105C0012 + for <bitcoin-dev@lists.linuxfoundation.org>; + 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 <bitcoin-dev@lists.linuxfoundation.org>; + 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 <bitcoin-dev@lists.linuxfoundation.org>; + 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 <bitcoin-dev@lists.linuxfoundation.org>; + 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 <prayank@tutanota.de> +To: Jeremy <jlrubin@mit.edu> +Message-ID: <Mrak4sc--7-2@tutanota.de> +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 <bitcoin-dev@lists.linuxfoundation.org> +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 <bitcoin-dev.lists.linuxfoundation.org> +List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>, + <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe> +List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/> +List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org> +List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help> +List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>, + <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=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 + +<html> + <head> + <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DUTF-8= +"> + </head> + <body> +<div>Hi Jeremy,<br></div><div dir=3D"auto"><br></div><div dir=3D"auto">>= + This post covers some high-level smart contract concepts that different<br= +></div><div dir=3D"auto">opcodes or proposals could have (or not).<br></div= +><div dir=3D"auto">https://rubin.io/bitcoin/2021/12/04/advent-7/<br></div><= +div dir=3D"auto"><br></div><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. <br><= +/div><div dir=3D"auto"><br></div><div dir=3D"auto">> 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></div><div dir=3D"auto"><= +br></div><div dir=3D"auto">Recently asked one dumb question on Stakexchange= + after reading a comment on reddit, maybe you can add anything new in this:= +<br></div><div dir=3D"auto"><br></div><div dir=3D"auto">https://bitcoin.sta= +ckexchange.com/questions/111337/loops-in-bitcoin-scripting<br></div><div di= +r=3D"auto"><br></div><div dir=3D"auto">> 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.<br></div><div dir=3D"auto"><br></div><d= +iv dir=3D"auto">I think this is what I did in the above link where for loop= + was replaced with if-else statements.<br></div><div dir=3D"auto"><br></div= +><div dir=3D"auto">> 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.<br></div><div dir=3D"auto"><br></div><div dir=3D"auto">Agree with limi= +ts and possibility of optimization.<br></div><div dir=3D"auto"><br></div><d= +iv dir=3D"auto">> 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></div><div dir=3D"auto"><br></div><div dir=3D"auto">Interesting<br></div= +><div dir=3D"auto"><br></div><div dir=3D"auto"><div>> Signing the transa= +ction fee rate as a function of locktime<br></div><div><br></div><div>TIL<b= +r></div></div><div dir=3D"auto"><br></div><div><br></div><div>-- <br></div>= +<div>Prayank<br></div><div><br></div><div dir=3D"auto">A3B1 E430 2298 178F<= +br></div> </body> +</html> + +------=_Part_67043_1723523109.1640260531416-- + |