summaryrefslogtreecommitdiff
path: root/a0/d8cbfb864ab0a1fb2448334a1ed8344ff3b41f
blob: b5abc93d33a762a76849693b0c2bcd96d6e39e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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">&gt;=
 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">&gt; 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">&gt; 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">&gt; 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">&gt; 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>&gt; 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--