op return – When is OP_RETURN cheaper than OP_FALSE OP_IF?

op return – When is OP_RETURN cheaper than OP_FALSE OP_IF?

[ad_1]

TL;DR: OP_RETURN is cheaper for information smaller than 143 bytes.

graph that compares OP_RETURN with inscriptions

The overhead of an OP_RETURN output is at the very least 11 bytes:

  • quantity (8 bytes)
  • compact measurement of script (at the very least 1 byte)
  • script:
    • OP_RETURN opcode (1 byte)
    • push opcode (at the very least 1 byte)

The overhead of an inscription is at the very least 118.75 vB (84 base bytes and 139 witness bytes):

  • P2TR output (43 bytes)
  • P2TR enter:
    • outpoint TXID (32 bytes)
    • outpoint index (4 bytes)
    • sequence (4 bytes)
    • compact measurement of enter script (1 byte, script is empty)
    • witness information:
      • compact measurement of witness stack (1 WU)
      • compact measurement of signature (1 WU)
      • signature (64 WU)
      • compact measurement of script (at the very least 1 WU)
      • script:
        • public key push opcode (1 WU)
        • public key (32 WU)
        • OP_CHECKSIG opcode (1 WU)
        • OP_FALSE opcode (1 WU)
        • OP_IF opcode (1 WU)
        • push opcodes (at the very least 1 WU)
        • OP_ENDIF opcode (1 WU)
      • compact measurement of management block (1 WU)
      • management block (33 WU)

The witness low cost cancels out the bigger overhead at 143 bytes of knowledge, which takes 155 vB utilizing an OP_RETURN and 154.75 vB utilizing an inscription. For something smaller than that OP_RETURN is cheaper.

Notes:

  • The above assumes a best-case situation through which the P2TR enter is included in a transaction that serves another goal and could be made anyway. This usually is not the case, through which case the overhead is at the very least 129.25 vB and OP_RETURN is cheaper for as much as at the very least 158 bytes of knowledge.
  • It’s a necessity to separate the information into chunks of 520 bytes in an inscription however not in an OP_RETURN output. This solely impacts information massive sufficient that it does not change the reply.
  • We’re ignoring the 80-byte standardness restrict for OP_RETURN right here.

[ad_2]

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *