1

Is it stored in the witness program as

OP_FALSE
OP_IF
<data>
OP_ENDIF

or is it stored in annex as described in bip 341 or in some other form?

2
  • @VojtěchStrnad yes, it's illustrative, but it seems to be a normal SegWit transaction (OP_0), not taproot (OP_1). I was a bit confused by annex logic in ord wallet source code and thought they might use annex for data storage since it's simply ignored
    – DeLorean88
    Commented May 9, 2023 at 15:07
  • 1
    The OP_0 is not in the output script but in the leaf script, to avoid executing the code branch that has the inscription data. Commented May 9, 2023 at 15:12

1 Answer 1

2

I think this is explained at https://docs.ordinals.com/inscriptions.html

Inscription content is serialized using data pushes within unexecuted conditionals, called "envelopes". Envelopes consist of an OP_FALSE OP_IF … OP_ENDIF wrapping any number of data pushes. Because envelopes are effectively no-ops, they do not change the semantics of the script in which they are included, and can be combined with any other locking script.

A text inscription containing the string "Hello, world!" is serialized as follows:

OP_FALSE
OP_IF
  OP_PUSH "ord"
  OP_1
  OP_PUSH "text/plain;charset=utf-8"
  OP_0
  OP_PUSH "Hello, world!"
OP_ENDIF

From what I have seen, the inscribed data appears in the second witness component of three. The last does not start with 0x50 so is not an annex if my (pretty sketchy) understanding is correct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.