public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Peter Todd <pete@petertodd•org>
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: Mon, 17 Mar 2025 16:54:19 +0000	[thread overview]
Message-ID: <Z9hTu2TjMlLr5-Eg@petertodd.org> (raw)
In-Reply-To: <f844a85e-8be8-4429-8687-bc19dd4b96ffn@googlegroups.com>

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

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/Z9hTu2TjMlLr5-Eg%40petertodd.org.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2025-03-17 17:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 16:14 weichu deng
2025-03-17 16:54 ` Peter Todd [this message]

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=Z9hTu2TjMlLr5-Eg@petertodd.org \
    --to=pete@petertodd$(echo .)org \
    --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