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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
|
Delivery-date: Tue, 18 Mar 2025 19:28:31 -0700
Received: from mail-oi1-f191.google.com ([209.85.167.191])
by mail.fairlystable.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
(Exim 4.94.2)
(envelope-from <bitcoindev+bncBCQ2LBONTACBBRWX5C7AMGQE4DSVS2Y@googlegroups.com>)
id 1tujAU-0004P6-UF
for bitcoindev@gnusha.org; Tue, 18 Mar 2025 19:28:31 -0700
Received: by mail-oi1-f191.google.com with SMTP id 5614622812f47-3f9ce53ab0bsf5551856b6e.2
for <bitcoindev@gnusha.org>; Tue, 18 Mar 2025 19:28:31 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1742351305; cv=pass;
d=google.com; s=arc-20240605;
b=MpUAb0l1KX211N6tR+nVSVtuyLCgcOGNRORi17AQtsn+h6M4srUMtL3TzlgxAdHUyy
UhluUNFbbjID6aDvD46gL38ek5EuaugPgIhPTyrvUkA7A/GBxDkE8HeBADn6u9YtKKQf
WiN+ZfGwtPYPSmy96XfQvRk2SypH3IzgPuJl9+9Xs6q4z+MQuRKN6R673mtXAc0SYwb1
N6cgXSCyQBep7rDyppQ6WVXRMjSXAuzwL19enc2WQVuly4cqHLS8e5oVQkehSKE47lKi
jPCPPz7W3lNvm1pYPaWx644RWMLMeBh6x/e52rVxsm1DkL9mYdhCpA1n0V5BeMRL4YIX
Xbxg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:sender:dkim-signature
:dkim-signature;
bh=jdjjZrAwYEZj0Zv7KLg/BdituB++L6Gi3+qsRRrIB8w=;
fh=mQhQR9WxicsbSsSpg3ZDkkemsNwPUcEA7+/xLD+RRwI=;
b=I7OTHKFVt38O+IhFG9m0HzcXaSsfYn5dd5FOKKpIfQfdGUOCl1hsDsleASjUOieYe1
axrdWcr+86q9GNvFIQqq94vp3uQbzcdVZXpcBomAD4LYr5a00f0uGRO++U5DaNusC93f
jEj0zQap3+T1vmAmb8ViZ3Tc3v2znGctMVoEeW1cWs3ausGdndcdjEoB1kJCOIfpTluX
yUMutTL79J8O0EX3cKO4h5QgqUa5hO81lgxZqU49bTpK/ecN/D2oHmrXz/+0dKYE+zK5
+J7HASDTjIWkJ6vdo/gPBCwhjj/72FUdgMdBycP6TVFmOSm1cmMhZIL4mERRfipBFHJg
DnSQ==;
darn=gnusha.org
ARC-Authentication-Results: i=2; gmr-mx.google.com;
dkim=pass header.i=@gmail.com header.s=20230601 header.b=euzvv+5F;
spf=pass (google.com: domain of rot13maxi@gmail.com designates 2a00:1450:4864:20::632 as permitted sender) smtp.mailfrom=rot13maxi@gmail.com;
dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com;
dara=pass header.i=@googlegroups.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlegroups.com; s=20230601; t=1742351305; x=1742956105; darn=gnusha.org;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-authentication-results
:x-original-sender:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:sender:from:to:cc:subject:date:message-id
:reply-to;
bh=jdjjZrAwYEZj0Zv7KLg/BdituB++L6Gi3+qsRRrIB8w=;
b=EkgzwAr03hO7FA8bdOVryCq03tCXgGHH8tzZa5JQFoSzxWgdKQWZRJQj+IIp6vLkPk
yGcUjlJRR+tFOnin4Dqbg//vjXcmjRWKuZ9cSvGTQ6i0J+/LUA77D8S5QyN5mhGIFWU1
GE3OeJLiC4VFsxMd2UcBtyaG44qtCld2J1KkmDFmfDcMsZpCE4MIegQ63L6zIwW/L5jT
ZpUXL7UmzOGJ2KTOXe9zoWGZbZmvpBhYVvpgCtz+s8eTLek7OcBT2r98RUrTtwW9nWSu
F1Ks0OpvVvQHXYxyqUVXoG5VrE0hIsicesHnzfAwPxQlIA/Vv39A9knMDTu8QMoMS5bn
pnpA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1742351305; x=1742956105; darn=gnusha.org;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-authentication-results
:x-original-sender:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=jdjjZrAwYEZj0Zv7KLg/BdituB++L6Gi3+qsRRrIB8w=;
b=M/COj3Kq8L7MHjA1pI5YX5HocK17dg9wvVxCaf9GLxh0JD5WdKJVC1rWa7xaxOyvBt
uYb6Kcvjq8PevsFOd/I4i/wTN+RjbfUeACtvbtl+T8HxqTq2Z6rj3Wi1fvvUw5dC4AOh
hx43hhWugdXySHykRo8+5DYbIVw8kyDW+6GK24cPCTqIclK3CadQwaIWWMm8moaokcbv
x194xJbB43F6DEp1bTILfbstu7DU5OumqJlf6EYmtI8eIHGZjnX0xJpNc+bjHR1/1TXA
nP3O+hdxnx3wzF38u5mMeBuhFzpJ2FO/o5iTvtCqtR2DuvJdsaIdyZsf6cO9GFv7f8EY
6Tkg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742351305; x=1742956105;
h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
:list-id:mailing-list:precedence:x-original-authentication-results
:x-original-sender:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:x-beenthere:x-gm-message-state:sender:from
:to:cc:subject:date:message-id:reply-to;
bh=jdjjZrAwYEZj0Zv7KLg/BdituB++L6Gi3+qsRRrIB8w=;
b=bs3CusSc1W+IFVVz//PSqFCmuJ0WJewyY277jnls8KtrgGu4GNR9HFBp4ZXNjEmOAp
Aum8KsW82ekV0Grm8jG7qWkEcEAWXE/AYl6FGH6rmBVAhx8aqjWyM43XKknX2t+mSJMI
L8YPjngahkRvKJrWVWmPJo+9khw9b7JaER0LKaaVrfzsEgFC1k3S8v3QL+Yun7t6WBuc
ICW5nw68Llc+KpG18Jmyhe0LVCs4DoA19DAcsVXZI+RQ+gj/y1Y0rNLOrKyrxd0BB7qb
pXGYcUI8NJVlRuYXQ/MHVi8Po8FmP7X4KLWIQjrcoihKszyyQ5EGVrjSbSnlqhVt950j
pjhw==
Sender: bitcoindev@googlegroups.com
X-Forwarded-Encrypted: i=2; AJvYcCVOYC8yaSUTzYqtV3V15goFQj7sJbksLSG4g8XHorvm1Y6WFUV4rEAfQKkv4eHtCAMQufZ/hgSZasnm@gnusha.org
X-Gm-Message-State: AOJu0YyFJ9tFoF1t+5Lxse5P8ThSQpMiq4Kk3oBMzKmEGXxgXa5O+adv
0CmS7/KUegPkajVyhE6eJV1JSJlOEU9dY/lzaeR1Xx+thh9yt9Z5
X-Google-Smtp-Source: AGHT+IHI+CSjLqQROHUK9sdDngEn7i3CjA4Szi+TP+SAUqQcv+YyTXEZ7DwFWzSE+kYZR41i8RDRww==
X-Received: by 2002:a05:6808:16a8:b0:3fc:1f7b:c3a2 with SMTP id 5614622812f47-3fead59213amr700762b6e.17.1742351305170;
Tue, 18 Mar 2025 19:28:25 -0700 (PDT)
X-BeenThere: bitcoindev@googlegroups.com; h=ARLLPAIHtauat2kUKVZi9/eFT3ihTu7eg5NUr9ke4wyzU4O74w==
Received: by 2002:a4a:e50e:0:b0:600:5d08:133f with SMTP id 006d021491bc7-6021b748228ls257004eaf.0.-pod-prod-03-us;
Tue, 18 Mar 2025 19:28:22 -0700 (PDT)
X-Received: by 2002:a05:6808:23c2:b0:3fa:53b5:6f87 with SMTP id 5614622812f47-3fead610777mr740283b6e.34.1742351302474;
Tue, 18 Mar 2025 19:28:22 -0700 (PDT)
Received: by 2002:a05:6402:2293:b0:5e6:412b:7fe with SMTP id 4fb4d7f45d1cf-5eb8049a833msa12;
Tue, 18 Mar 2025 14:33:50 -0700 (PDT)
X-Received: by 2002:a17:907:96a8:b0:ac1:e1da:8744 with SMTP id a640c23a62f3a-ac3b7ed0692mr15319566b.38.1742333628990;
Tue, 18 Mar 2025 14:33:48 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1742333628; cv=none;
d=google.com; s=arc-20240605;
b=K/eOxB47cJZ/Nvc8a1oz7WwAyvkvWZ1m1PsYu8cZbl5hyOj4Qg/R428oc+0ZG1ftQ6
mKkoCpJTOxsIwvsKcirL9/Ty8uNxNWTSJc1HuoSPeo7kfiYhmAC+jdS6IW9aLAqA9ORM
t8nwoLVLfgO0djTkl+ol0znv25a42wjw/MeqfgNVwhlajvGv5yPZ3b2kw42TeGq4Rx/A
7buJ4f9rOh/5dMKWOoUMd/sjDo8FZvoAwxQx8vU7Dlv3dAxnhus/dm9KkS7jqtGd2wgs
HqCElXr08t160bQmfusXg8Y/pVDAP/Vav5rCXzWac67hI8/zWBzT/IekIKC8Kxsr5Xtc
An6g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:dkim-signature;
bh=6tZw5D5zTe02zx0uoxDSgbb4npBwawbWYKNIz6Iyh/w=;
fh=ZezIQ4DPobkbkSLZGiZg2aqbrl+dlXwRCknPDPYULyQ=;
b=EcopE3qq0Ak8BWq/J4bmdvOXca+QDXtkvNx1uzzm8hoITqdAxigV08w2DI4+x6FQy+
3M0jWQ8BIQE/6//OQgtaWcOkzZxvRQVzA30Busth+ab2RTREY3jFSGNRlWUdJ+acxHon
H2RSm2lXh3Y4UPZhoCxWCrGikkPKDrNgVKYaTme3xiCA7dWtEWwZGxGSaHR7T/JrJRjf
NSsUGav2br+MqvZMh4+OgPRDf8JjAYVl6HKXxO4YUWZ+ozo+nwtPxYRRU2e0ZLtO4HnF
fpAOIi+QHXfggLWw/0xbm3H5gy8bagOL4roSTLjGWkKFZw/5eib5I95XTGnJEy7oWH6T
cmwA==;
dara=google.com
ARC-Authentication-Results: i=1; gmr-mx.google.com;
dkim=pass header.i=@gmail.com header.s=20230601 header.b=euzvv+5F;
spf=pass (google.com: domain of rot13maxi@gmail.com designates 2a00:1450:4864:20::632 as permitted sender) smtp.mailfrom=rot13maxi@gmail.com;
dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com;
dara=pass header.i=@googlegroups.com
Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com. [2a00:1450:4864:20::632])
by gmr-mx.google.com with ESMTPS id 4fb4d7f45d1cf-5e816ada5c5si384856a12.4.2025.03.18.14.33.48
for <bitcoindev@googlegroups.com>
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Tue, 18 Mar 2025 14:33:48 -0700 (PDT)
Received-SPF: pass (google.com: domain of rot13maxi@gmail.com designates 2a00:1450:4864:20::632 as permitted sender) client-ip=2a00:1450:4864:20::632;
Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-ac2af2f15d1so877890066b.1
for <bitcoindev@googlegroups.com>; Tue, 18 Mar 2025 14:33:48 -0700 (PDT)
X-Gm-Gg: ASbGncuHLqUlM2dFIeqS234TA/g5Y/i3Po2OFvkcFOBLAMsE/yTKRWcLS1MOzx8khFH
/TR2teJbMbduy8qvsE/hNfG5D2Ip12VwAe1Km0nQj4DtJ5p8su1tu1sgCCnqnANAVUnFfP+2EE6
H+ybBuG9E41a9B1u1irBwPZGvQBm8t7UBvg3ye
X-Received: by 2002:a17:907:e88c:b0:ac2:64eb:d4e8 with SMTP id
a640c23a62f3a-ac3b7365683mr30605966b.0.1742333628299; Tue, 18 Mar 2025
14:33:48 -0700 (PDT)
MIME-Version: 1.0
References: <f844a85e-8be8-4429-8687-bc19dd4b96ffn@googlegroups.com>
<Z9hTu2TjMlLr5-Eg@petertodd.org> <678d40e3-3e22-4d55-82c0-b25ccafb87ecn@googlegroups.com>
In-Reply-To: <678d40e3-3e22-4d55-82c0-b25ccafb87ecn@googlegroups.com>
From: Rijndael <rot13maxi@gmail.com>
Date: Tue, 18 Mar 2025 17:33:37 -0400
X-Gm-Features: AQ5f1JplQejEWfovx9OUo7cXVn3EA43QUSK4qfnRAfzXFSi1ut-FJPHH_K8q1Gk
Message-ID: <CAD2YOAp=ft+pApAwh6CQvwMpujfZ0ysSK+=7zKA64nBeB5w3nA@mail.gmail.com>
Subject: =?UTF-8?Q?Re=3A_=5Bbitcoindev=5D_New_Proposal=EF=BC=9AString_Substring_Sea?=
=?UTF-8?Q?rch_in_Bitcoin_Script_=2D_OP=5FISSUBSTR?=
To: weichu deng <weichudeng@stu2024.jnu.edu.cn>
Cc: Bitcoin Development Mailing List <bitcoindev@googlegroups.com>
Content-Type: multipart/alternative; boundary="000000000000fecf750630a4a85a"
X-Original-Sender: rot13maxi@gmail.com
X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass
header.i=@gmail.com header.s=20230601 header.b=euzvv+5F; spf=pass
(google.com: domain of rot13maxi@gmail.com designates 2a00:1450:4864:20::632
as permitted sender) smtp.mailfrom=rot13maxi@gmail.com; dmarc=pass
(p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com
Precedence: list
Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com
List-ID: <bitcoindev.googlegroups.com>
X-Google-Group-Id: 786775582512
List-Post: <https://groups.google.com/group/bitcoindev/post>, <mailto:bitcoindev@googlegroups.com>
List-Help: <https://groups.google.com/support/>, <mailto:bitcoindev+help@googlegroups.com>
List-Archive: <https://groups.google.com/group/bitcoindev
List-Subscribe: <https://groups.google.com/group/bitcoindev/subscribe>, <mailto:bitcoindev+subscribe@googlegroups.com>
List-Unsubscribe: <mailto:googlegroups-manage+786775582512+unsubscribe@googlegroups.com>,
<https://groups.google.com/group/bitcoindev/subscribe>
X-Spam-Score: -0.5 (/)
--000000000000fecf750630a4a85a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Stack elements in Taproot are limited to 520 bytes. The current proposal
for re-activating OP_CAT includes this restriction: creating a string
longer than 520 bytes with CAT will cause the script to fail.
With either CAT or ISSUBSTR, you can either commit to the substrings or
provide them at spend-time as witness data (and allow them to be unfixed in
the script).
Fixed: FOOBAR BAR ISSUBSTR =3D=3D FOOBAR FOO BAR CAT EQ
Variable: [witness: FOOBAR] BAR ISSUBSTR =3D=3D [witness: FOOBAR FOO] BAR C=
AT EQ
rijndael
On Mar 18, 2025, at 11:32=E2=80=AFAM, weichu deng <weichudeng@stu2024.jnu.e=
du.cn>
wrote:
Hi, Peter Todd
Thanks for your feedback. I agree that "Bitcoin scripts are about
validation. Not computation."
String search and concatenation are equivalent in some cases, such as in
the example you provided.
However, it is still necessary to introduce the OP_ISSUBSTR operation
separately.
One example is converting a non-deterministic signature to a deterministic
one.
Another case is when the substring in question is located in the middle of
the checked string.
CAT cannot replace ISSUBSTR for the following reasons:
1. The security of CAT is still controversial. It can easily generate
overly long strings, potentially causing a stack overflow. Additionally,
whether OP_CAT will be restored is still under discussion.
2. The other substring (bar) must be known in advance.
With respect,
Weichu Deng
weichudeng@stu2024.jnu.edu.cn
=E5=9C=A82025=E5=B9=B43=E6=9C=8818=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=8C UTC+=
8 01:01:16<Peter Todd> =E5=86=99=E9=81=93=EF=BC=9A
On Mon, Mar 17, 2025 at 09:14:05AM -0700, weichu deng wrote:
>
>
> Dear fellow Bitcoin developers,
>
>
>
> I am pleased to present a new BIP proposal. This proposal introduces a ne=
w
> opcode for Bitcoin scripts: OP_ISSUBSTR.
>
>
> *Abstract*
>
> This BIP introduces two string opcodes, OP_ISSUBSTR and OP_ISSUBSTRVERIFY
> (similar to the relationship between OP_EQUAL and OP_EQUALVERIFY), to
> determine whether one string is a substring of another. As these opcodes
do
> not alter any blockchain state, they are secure.
Bitcoin scripts are about validation. Not computation.
This means that substring search and concatenation are equivalent. For
every script that validates a substring search, you can instead
concatenate the substring with the rest of the string, and validate
equality instead.
Basically speaking:
foobar foo IsSubStr
is equivalent to:
foobar foo bar Cat Equal
A real-world example would be more complex. But I hope that illustrates
my point sufficiently.
--=20
https://petertodd.org 'peter'[:-1]@petertodd.org
--=20
You received this message because you are subscribed to the Google Groups
"Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to bitcoindev+unsubscribe@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/bitcoindev/678d40e3-3e22-4d55-82c0-b25cca=
fb87ecn%40googlegroups.com
<https://groups.google.com/d/msgid/bitcoindev/678d40e3-3e22-4d55-82c0-b25cc=
afb87ecn%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter>
.
--=20
You received this message because you are subscribed to the Google Groups "=
Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to bitcoindev+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/=
CAD2YOAp%3Dft%2BpApAwh6CQvwMpujfZ0ysSK%2B%3D7zKA64nBeB5w3nA%40mail.gmail.co=
m.
--000000000000fecf750630a4a85a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"auto" style=3D"line-break:after-white-space">S=
tack elements in Taproot are limited to 520 bytes. The current proposal for=
re-activating OP_CAT includes this restriction: creating a string longer t=
han 520 bytes with CAT will cause the script to fail.<div><br></div><div>Wi=
th either CAT or ISSUBSTR, you can either commit to the substrings or provi=
de them at spend-time as witness data (and allow them to be unfixed in the =
script).</div><div><br></div><div>Fixed: FOOBAR BAR ISSUBSTR =3D=3D FOOBAR =
FOO BAR CAT EQ</div><div>Variable: [witness: FOOBAR] BAR ISSUBSTR =3D=3D [w=
itness: FOOBAR FOO] BAR CAT EQ</div><div><br></div><div><br></div><div>rijn=
dael=C2=A0</div><div><br id=3D"m_1356653997907207526lineBreakAtBeginningOfM=
essage"><div style=3D"direction:ltr"><br><blockquote type=3D"cite"><div>On =
Mar 18, 2025, at 11:32=E2=80=AFAM, weichu deng <<a href=3D"mailto:weichu=
deng@stu2024.jnu.edu.cn" target=3D"_blank">weichudeng@stu2024.jnu.edu.cn</a=
>> wrote:</div><br><div><div style=3D"font-size:12px;font-style:normal;f=
ont-variant-caps:normal;font-weight:400;text-align:start;text-indent:0px;te=
xt-transform:none;white-space:pre-wrap;word-spacing:0px;text-decoration:non=
e;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asi=
an:inherit;font-variant-alternates:inherit;font-stretch:inherit;line-height=
:24px;font-family:-apple-system,BlinkMacSystemFont,"Helvetica Neue&quo=
t;,Helvetica,"Segoe UI",Arial,Roboto,"PingFang SC",MIUI=
,"Hiragino Sans GB","Microsoft YaHei",sans-serif;font-s=
ize-adjust:inherit;font-kerning:inherit;font-feature-settings:inherit;verti=
cal-align:baseline;margin:0px 0px 0.859em;letter-spacing:0.25px;max-width:1=
00%;overflow:auto hidden;color:rgb(6,6,7);word-break:break-word">Hi, <span =
style=3D"color:rgb(32,33,36);font-family:Roboto,Arial,sans-serif">Peter Tod=
d</span></div><div style=3D"font-size:12px;font-style:normal;font-variant-c=
aps:normal;font-weight:400;text-align:start;text-indent:0px;text-transform:=
none;white-space:pre-wrap;word-spacing:0px;text-decoration:none;padding:0px=
;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;fo=
nt-variant-alternates:inherit;font-stretch:inherit;line-height:24px;font-fa=
mily:-apple-system,BlinkMacSystemFont,"Helvetica Neue",Helvetica,=
"Segoe UI",Arial,Roboto,"PingFang SC",MIUI,"Hiragi=
no Sans GB","Microsoft YaHei",sans-serif;font-size-adjust:in=
herit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:bas=
eline;margin:0px 0px 0.859em;letter-spacing:0.25px;max-width:100%;overflow:=
auto hidden;color:rgb(6,6,7);word-break:break-word">Thanks for your feedbac=
k. I agree that "Bitcoin scripts are about validation. Not computation=
."</div><div style=3D"font-size:12px;font-style:normal;font-variant-ca=
ps:normal;font-weight:400;text-align:start;text-indent:0px;text-transform:n=
one;white-space:pre-wrap;word-spacing:0px;text-decoration:none;padding:0px;=
border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;fon=
t-variant-alternates:inherit;font-stretch:inherit;line-height:24px;font-fam=
ily:-apple-system,BlinkMacSystemFont,"Helvetica Neue",Helvetica,&=
quot;Segoe UI",Arial,Roboto,"PingFang SC",MIUI,"Hiragin=
o Sans GB","Microsoft YaHei",sans-serif;font-size-adjust:inh=
erit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:base=
line;margin:0px 0px 0.859em;letter-spacing:0.25px;max-width:100%;overflow:a=
uto hidden;color:rgb(6,6,7);word-break:break-word">String search and concat=
enation are equivalent in some cases, such as in the example you provided.<=
/div><div style=3D"font-size:12px;font-style:normal;font-variant-caps:norma=
l;font-weight:400;text-align:start;text-indent:0px;text-transform:none;whit=
e-space:pre-wrap;word-spacing:0px;text-decoration:none;padding:0px;border:0=
px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-varian=
t-alternates:inherit;font-stretch:inherit;line-height:24px;font-family:-app=
le-system,BlinkMacSystemFont,"Helvetica Neue",Helvetica,"Seg=
oe UI",Arial,Roboto,"PingFang SC",MIUI,"Hiragino Sans G=
B","Microsoft YaHei",sans-serif;font-size-adjust:inherit;fon=
t-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline;mar=
gin:0px 0px 0.859em;letter-spacing:0.25px;max-width:100%;overflow:auto hidd=
en;color:rgb(6,6,7);word-break:break-word">However, it is still necessary t=
o introduce the OP_ISSUBSTR operation separately.</div><div style=3D"font-s=
ize:12px;font-style:normal;font-variant-caps:normal;font-weight:400;text-al=
ign:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spa=
cing:0px;text-decoration:none;padding:0px;border:0px;font-variant-numeric:i=
nherit;font-variant-east-asian:inherit;font-variant-alternates:inherit;font=
-stretch:inherit;line-height:24px;font-family:-apple-system,BlinkMacSystemF=
ont,"Helvetica Neue",Helvetica,"Segoe UI",Arial,Roboto,=
"PingFang SC",MIUI,"Hiragino Sans GB","Microsoft Y=
aHei",sans-serif;font-size-adjust:inherit;font-kerning:inherit;font-fe=
ature-settings:inherit;vertical-align:baseline;margin:0px 0px 0.859em;lette=
r-spacing:0.25px;max-width:100%;overflow:auto hidden;color:rgb(6,6,7);word-=
break:break-word">One example is converting a non-deterministic signature t=
o a deterministic one.</div><div style=3D"font-size:12px;font-style:normal;=
font-variant-caps:normal;font-weight:400;text-align:start;text-indent:0px;t=
ext-transform:none;white-space:pre-wrap;word-spacing:0px;text-decoration:no=
ne;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-as=
ian:inherit;font-variant-alternates:inherit;font-stretch:inherit;line-heigh=
t:24px;font-family:-apple-system,BlinkMacSystemFont,"Helvetica Neue&qu=
ot;,Helvetica,"Segoe UI",Arial,Roboto,"PingFang SC",MIU=
I,"Hiragino Sans GB","Microsoft YaHei",sans-serif;font-=
size-adjust:inherit;font-kerning:inherit;font-feature-settings:inherit;vert=
ical-align:baseline;margin:0px 0px 0.859em;letter-spacing:0.25px;max-width:=
100%;overflow:auto hidden;color:rgb(6,6,7);word-break:break-word">Another c=
ase is when the substring in question is located in the middle of the check=
ed string.</div><div style=3D"font-size:12px;font-style:normal;font-variant=
-caps:normal;font-weight:400;text-align:start;text-indent:0px;text-transfor=
m:none;white-space:pre-wrap;word-spacing:0px;text-decoration:none;padding:0=
px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;=
font-variant-alternates:inherit;font-stretch:inherit;line-height:24px;font-=
family:-apple-system,BlinkMacSystemFont,"Helvetica Neue",Helvetic=
a,"Segoe UI",Arial,Roboto,"PingFang SC",MIUI,"Hira=
gino Sans GB","Microsoft YaHei",sans-serif;font-size-adjust:=
inherit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:b=
aseline;margin:0px 0px 0.859em;letter-spacing:0.25px;max-width:100%;overflo=
w:auto hidden;color:rgb(6,6,7);word-break:break-word">CAT cannot replace IS=
SUBSTR for the following reasons:</div><ol start=3D"1" style=3D"font-size:1=
2px;font-style:normal;font-variant-caps:normal;font-weight:400;text-align:s=
tart;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0p=
x;text-decoration:none;padding:0px 0px 0px 2em;border:0px;font-variant-nume=
ric:inherit;font-variant-east-asian:inherit;font-variant-alternates:inherit=
;font-stretch:inherit;line-height:inherit;font-family:-apple-system,BlinkMa=
cSystemFont,"Helvetica Neue",Helvetica,"Segoe UI",Arial=
,Roboto,"PingFang SC",MIUI,"Hiragino Sans GB","Mic=
rosoft YaHei",sans-serif;font-size-adjust:inherit;font-kerning:inherit=
;font-feature-settings:inherit;vertical-align:baseline;list-style-position:=
initial;margin:0.859em 0px 0px;color:rgb(6,6,7);letter-spacing:0.5px"><li s=
tyle=3D"margin:0px;padding:0px;border:0px;font-style:inherit;font-variant-l=
igatures:inherit;font-variant-caps:inherit;font-variant-alternates:inherit;=
font-variant-numeric:inherit;font-variant-east-asian:inherit;font-weight:in=
herit;font-stretch:inherit;font-size:inherit;line-height:24px;font-family:i=
nherit;font-size-adjust:inherit;font-kerning:inherit;font-feature-settings:=
inherit;vertical-align:baseline;letter-spacing:0.25px"><div style=3D"paddin=
g:0px;border:0px;font-style:inherit;font-variant-ligatures:inherit;font-var=
iant-caps:inherit;font-variant-alternates:inherit;font-variant-numeric:inhe=
rit;font-variant-east-asian:inherit;font-weight:inherit;font-stretch:inheri=
t;line-height:24px;font-family:inherit;font-size-adjust:inherit;font-kernin=
g:inherit;font-feature-settings:inherit;vertical-align:baseline;margin:0px;=
max-width:100%;overflow:visible;word-break:break-word">The security of CAT =
is still controversial. It can easily generate overly long strings, potenti=
ally causing a stack overflow. Additionally, whether OP_CAT will be restore=
d is still under discussion.</div></li><li style=3D"margin:0px;padding:0px;=
border:0px;font-style:inherit;font-variant-ligatures:inherit;font-variant-c=
aps:inherit;font-variant-alternates:inherit;font-variant-numeric:inherit;fo=
nt-variant-east-asian:inherit;font-weight:inherit;font-stretch:inherit;font=
-size:inherit;line-height:24px;font-family:inherit;font-size-adjust:inherit=
;font-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline=
;letter-spacing:0.25px"><div style=3D"padding:0px;border:0px;font-style:inh=
erit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-variant-=
alternates:inherit;font-variant-numeric:inherit;font-variant-east-asian:inh=
erit;font-weight:inherit;font-stretch:inherit;line-height:24px;font-family:=
inherit;font-size-adjust:inherit;font-kerning:inherit;font-feature-settings=
:inherit;vertical-align:baseline;margin:0px;max-width:100%;overflow:visible=
;word-break:break-word">The other substring (bar) must be known in advance.=
</div></li></ol><div style=3D"font-family:Helvetica;font-size:12px;font-sty=
le:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;te=
xt-align:start;text-indent:0px;text-transform:none;white-space:normal;word-=
spacing:0px;text-decoration:none"><font color=3D"#060607" face=3D"-apple-sy=
stem, BlinkMacSystemFont, Helvetica Neue, Helvetica, Segoe UI, Arial, Robot=
o, PingFang SC, MIUI, Hiragino Sans GB, Microsoft YaHei, sans-serif"><span =
style=3D"letter-spacing:0.25px"><br></span></font></div><div style=3D"font-=
family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;=
font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text=
-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><=
p><span lang=3D"EN-US">With respect,</span></p><p><span lang=3D"EN-US">Weic=
hu Deng</span></p><p><span lang=3D"EN-US"><a href=3D"mailto:weichudeng@stu2=
024.jnu.edu.cn" target=3D"_blank">weichudeng@stu2024.jnu.edu.cn</a></span><=
/p></div><div style=3D"font-family:Helvetica;font-size:12px;font-style:norm=
al;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-alig=
n:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing=
:0px;text-decoration:none"><div dir=3D"auto">=E5=9C=A82025=E5=B9=B43=E6=9C=
=8818=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=8C UTC+8 01:01:16<Peter Todd> =
=E5=86=99=E9=81=93=EF=BC=9A<br></div><blockquote style=3D"margin:0px 0px 0p=
x 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb=
(204,204,204);padding-left:1ex">On Mon, Mar 17, 2025 at 09:14:05AM -0700, w=
eichu deng wrote:<br>><span>=C2=A0</span><br>><span>=C2=A0</span><br>=
> Dear fellow Bitcoin developers,<br>><span>=C2=A0</span><br>><spa=
n>=C2=A0</span><br>><span>=C2=A0</span><br>> I am pleased to present =
a new BIP proposal. This proposal introduces a new<span>=C2=A0</span><br>&g=
t; opcode for Bitcoin scripts: OP_ISSUBSTR.<br>><span>=C2=A0</span><br>&=
gt;<span>=C2=A0</span><br>> *Abstract*<br>><span>=C2=A0</span><br>>=
; This BIP introduces two string opcodes, OP_ISSUBSTR and OP_ISSUBSTRVERIFY=
<span>=C2=A0</span><br>> (similar to the relationship between OP_EQUAL a=
nd OP_EQUALVERIFY), to<span>=C2=A0</span><br>> determine whether one str=
ing is a substring of another. As these opcodes do<span>=C2=A0</span><br>&g=
t; not alter any blockchain state, they are secure.<br><br>Bitcoin scripts =
are about validation. Not computation.<br><br>This means that substring sea=
rch and concatenation are equivalent. For<br>every script that validates a =
substring search, you can instead<br>concatenate the substring with the res=
t of the string, and validate<br>equality instead.<br><br>Basically speakin=
g:<br><br>foobar foo IsSubStr<br><br>is equivalent to:<br><br>foobar foo ba=
r Cat Equal<br><br>A real-world example would be more complex. But I hope t=
hat illustrates<br>my point sufficiently.<br><br>--<span>=C2=A0</span><br><=
a href=3D"https://petertodd.org/" rel=3D"nofollow" target=3D"_blank">https:=
//petertodd.org</a><span>=C2=A0</span>'peter'[:-1]@<a href=3D"http:=
//petertodd.org/" rel=3D"nofollow" target=3D"_blank">petertodd.org</a><br><=
/blockquote></div><div style=3D"font-family:Helvetica;font-size:12px;font-s=
tyle:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;=
text-align:start;text-indent:0px;text-transform:none;white-space:normal;wor=
d-spacing:0px;text-decoration:none"><br></div><span style=3D"font-family:He=
lvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weig=
ht:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transfor=
m:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;=
display:inline!important">--<span>=C2=A0</span></span><br style=3D"font-fam=
ily:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;fon=
t-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tr=
ansform:none;white-space:normal;word-spacing:0px;text-decoration:none"><spa=
n style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-vari=
ant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text=
-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-de=
coration:none;float:none;display:inline!important">You received this messag=
e because you are subscribed to the Google Groups "Bitcoin Development=
Mailing List" group.</span><br style=3D"font-family:Helvetica;font-si=
ze:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-s=
pacing:normal;text-align:start;text-indent:0px;text-transform:none;white-sp=
ace:normal;word-spacing:0px;text-decoration:none"><span style=3D"font-famil=
y:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-=
weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tran=
sform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:n=
one;display:inline!important">To unsubscribe from this group and stop recei=
ving emails from it, send an email to<span>=C2=A0</span></span><a href=3D"m=
ailto:bitcoindev+unsubscribe@googlegroups.com" style=3D"font-family:Helveti=
ca;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:40=
0;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:non=
e;white-space:normal;word-spacing:0px" target=3D"_blank">bitcoindev+unsubsc=
ribe@googlegroups.com</a><span style=3D"font-family:Helvetica;font-size:12p=
x;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing=
:normal;text-align:start;text-indent:0px;text-transform:none;white-space:no=
rmal;word-spacing:0px;text-decoration:none;float:none;display:inline!import=
ant">.</span><br style=3D"font-family:Helvetica;font-size:12px;font-style:n=
ormal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-a=
lign:start;text-indent:0px;text-transform:none;white-space:normal;word-spac=
ing:0px;text-decoration:none"><span style=3D"font-family:Helvetica;font-siz=
e:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-sp=
acing:normal;text-align:start;text-indent:0px;text-transform:none;white-spa=
ce:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!i=
mportant">To view this discussion visit<span>=C2=A0</span></span><a href=3D=
"https://groups.google.com/d/msgid/bitcoindev/678d40e3-3e22-4d55-82c0-b25cc=
afb87ecn%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter" sty=
le=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant-c=
aps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-inde=
nt:0px;text-transform:none;white-space:normal;word-spacing:0px" target=3D"_=
blank">https://groups.google.com/d/msgid/bitcoindev/678d40e3-3e22-4d55-82c0=
-b25ccafb87ecn%40googlegroups.com</a><span style=3D"font-family:Helvetica;f=
ont-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;le=
tter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;wh=
ite-space:normal;word-spacing:0px;text-decoration:none;float:none;display:i=
nline!important">.</span></div></blockquote></div><br></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Bitcoin Development Mailing List" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:bitcoindev+unsubscribe@googlegroups.com">bitcoind=
ev+unsubscribe@googlegroups.com</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
bitcoindev/CAD2YOAp%3Dft%2BpApAwh6CQvwMpujfZ0ysSK%2B%3D7zKA64nBeB5w3nA%40ma=
il.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/d/msgid/bitcoindev/CAD2YOAp%3Dft%2BpApAwh6CQvwMpujfZ0ysSK%2B%3D7zKA64nB=
eB5w3nA%40mail.gmail.com</a>.<br />
--000000000000fecf750630a4a85a--
|