script – Can OP_DROP be used to include arbitrary data?

[ad_1]

OP_RETURN is only limited to 80 bytes by Bitcoin Core’s default standardness rules. Some people increase this limit using the -datacarriersize option. Other people have been running Peter Todd’s “Libre Relay” patch that removes this and other standardness limits, and automatically connects to other nodes running the patch. As a result, many transactions that exceed this limit have been mined lately, so you might not actually need to devise a way around it.

Moreover, OP_RETURN is one of only a handful of standard output script templates. Putting <data> OP_DROP into the output script will make it non-standard by Bitcoin Core’s (and most other implementations’) rules. What you actually need is to put it into a script that’s revealed in an input, i.e. a P2WSH witness script or a P2TR leaf script. Doing it this way also means your data makes use of the discount on witness data.

However, <data> OP_DROP is still slightly suboptimal if you’re looking to push anything large. The largest push size allowed by consensus rules is 520 bytes, so you’d need to split your data into chunks of 520 bytes like <data> OP_DROP <data> OP_DROP ..., requiring multiple drop opcodes. A more efficient way is OP_FALSE OP_IF <data> <data> ... OP_ENDIF, sometimes known as the “inscription envelope” as it was popularized by ordinal inscriptions. (Note that there’s currently a movement to make this specific pattern non-standard by default; how likely it is to succeed I will leave as an exercise for the reader.)

[ad_2]

Source link


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *