public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Peter Todd <pete@petertodd•org>
To: Andrew Poelstra <apoelstra@wpsoftware•net>
Cc: Bitcoin Protocol Discussion <bitcoin-dev@lists•linuxfoundation.org>
Subject: Re: [bitcoin-dev] Debate: 64 bytes in OP_RETURN VS taproot OP_FALSE OP_IF OP_PUSH
Date: Thu, 2 Feb 2023 06:22:23 -0500	[thread overview]
Message-ID: <Y9uc72RSs6LQojG4@petertodd.org> (raw)
In-Reply-To: <Y9pxAdm3kO1rr2kU@camus>

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

On Wed, Feb 01, 2023 at 02:02:41PM +0000, Andrew Poelstra wrote:
> On Tue, Jan 31, 2023 at 09:07:16PM -0500, Peter Todd via bitcoin-dev wrote:
> > 
> > 
> > On January 31, 2023 7:46:32 PM EST, Christopher Allen via bitcoin-dev <bitcoin-dev@lists•linuxfoundation.org> wrote:
> > >All other things being equal, which is better if you need to place a
> > >64-bytes into the Bitcoin blockchain? A traditional OP_RETURN or a spent
> > >taproot transaction such as:
> > >
> > >OP_FALSE
> > >OP_IF
> > >OP_PUSH my64bytes
> > >OP_ENDIF
> > 
> > What's wrong with OpPush <data> OpDrop?
> >
> 
> This is a technical nit, but the reason is that <data> is limited to 520
> bytes (and I believe, 80 bytes by standardness in Taproot), so if you
> are pushing a ton of data and need multiple pushes, it's more efficient
> to use FALSE IF ... ENDIF since you avoid the repeated DROPs.

Yes, for more than 520 bytes you need to wrap the push in an IF/ENDIF so it's
not executed. But in this example we're just talking about 64 bytes, so that
limit isn't relevant and OpPush <data> OpDrop should be sufficient.

Specifically for more than 520 bytes you run into the the
MAX_SCRIPT_ELEMENT_SIZE check in script/interpreter.cpp, which applies to all
scripts regardless of standardness at script execution:

           //
           // Read instruction
           //
           if (!script.GetOp(pc, opcode, vchPushValue))
               return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
           if (vchPushValue.size() > MAX_SCRIPT_ELEMENT_SIZE)
               return set_error(serror, SCRIPT_ERR_PUSH_SIZE);

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

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

  reply	other threads:[~2023-02-02 11:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  0:46 Christopher Allen
2023-02-01  2:07 ` Peter Todd
2023-02-01  2:22   ` Christopher Allen
2023-02-01  8:36     ` Kostas Karasavvas
2023-02-01 12:51       ` Peter Todd
2023-02-01 14:02   ` Andrew Poelstra
2023-02-02 11:22     ` Peter Todd [this message]
2023-02-02 11:45       ` Aymeric Vitte
2023-02-02 11:49         ` Peter Todd
2023-02-02 12:24           ` Aymeric Vitte
2023-02-01 12:59 ` Aymeric Vitte
2023-02-02 13:25 ` Rijndael
2023-02-03 11:15   ` Aymeric Vitte
2023-02-03 18:47     ` Christopher Allen
2023-02-04 14:11       ` Kostas Karasavvas
2023-02-04 17:01         ` Aymeric Vitte
2023-02-04 18:54           ` Christopher Allen
2023-02-04 20:55             ` Aymeric Vitte
2023-02-04 22:18               ` Christopher Allen
2023-02-04 23:09                 ` Aymeric Vitte
2023-02-05  0:04                   ` Peter Todd
2023-02-05 11:40                     ` Aymeric Vitte
2023-02-05 12:06                       ` Peter Todd
2023-02-05 12:47                         ` Aymeric Vitte
2023-02-05  0:11                   ` Russell O'Connor
2023-02-05  2:01                     ` Peter Todd
2023-02-05 18:12                       ` Russell O'Connor
2023-02-12 16:23                         ` Aymeric Vitte
2023-02-16 18:23                           ` Aymeric Vitte
2023-02-16 19:59                             ` Claus Ehrenberg
2023-02-17 10:56                               ` Aymeric Vitte
2023-02-05 18:06                     ` Andrew Poelstra
2023-02-17 12:49                     ` Anthony Towns
2023-02-18 18:38                       ` Aymeric Vitte

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=Y9uc72RSs6LQojG4@petertodd.org \
    --to=pete@petertodd$(echo .)org \
    --cc=apoelstra@wpsoftware$(echo .)net \
    --cc=bitcoin-dev@lists$(echo .)linuxfoundation.org \
    /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