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

[email protected]
在2025年3月18日星期二 UTC+8 01:01:16<Peter Todd> 写道:

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 
new 
> 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. 

-- 
https://petertodd.org 'peter'[:-1]@petertodd.org 

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/bitcoindev/678d40e3-3e22-4d55-82c0-b25ccafb87ecn%40googlegroups.com.

Reply via email to