public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Rijndael <rot13maxi@gmail•com>
To: weichu deng <weichudeng@stu2024•jnu.edu.cn>
Cc: Bitcoin Development Mailing List <bitcoindev@googlegroups.com>
Subject: Re: [bitcoindev] New Proposal:String Substring Search in Bitcoin Script - OP_ISSUBSTR
Date: Tue, 18 Mar 2025 17:33:37 -0400	[thread overview]
Message-ID: <CAD2YOAp=ft+pApAwh6CQvwMpujfZ0ysSK+=7zKA64nBeB5w3nA@mail.gmail.com> (raw)
In-Reply-To: <678d40e3-3e22-4d55-82c0-b25ccafb87ecn@googlegroups.com>

[-- Attachment #1: Type: text/plain, Size: 3567 bytes --]

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 == FOOBAR FOO BAR CAT EQ
Variable: [witness: FOOBAR] BAR ISSUBSTR == [witness: FOOBAR FOO] BAR CAT EQ


rijndael


On Mar 18, 2025, at 11:32 AM, weichu deng <weichudeng@stu2024•jnu.edu.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
在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 bitcoindev+unsubscribe@googlegroups•com.
To view this discussion visit
https://groups.google.com/d/msgid/bitcoindev/678d40e3-3e22-4d55-82c0-b25ccafb87ecn%40googlegroups.com
<https://groups.google.com/d/msgid/bitcoindev/678d40e3-3e22-4d55-82c0-b25ccafb87ecn%40googlegroups.com?utm_medium=email&utm_source=footer>
.

-- 
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/CAD2YOAp%3Dft%2BpApAwh6CQvwMpujfZ0ysSK%2B%3D7zKA64nBeB5w3nA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 17439 bytes --]

  reply	other threads:[~2025-03-19  2:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 16:14 weichu deng
2025-03-17 16:54 ` Peter Todd
2025-03-18 15:32   ` weichu deng
2025-03-18 21:33     ` Rijndael [this message]
2025-03-18 16:41   ` Erik Aronesty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD2YOAp=ft+pApAwh6CQvwMpujfZ0ysSK+=7zKA64nBeB5w3nA@mail.gmail.com' \
    --to=rot13maxi@gmail$(echo .)com \
    --cc=bitcoindev@googlegroups.com \
    --cc=weichudeng@stu2024$(echo .)jnu.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox