Tuesday, November 5, 2024
HomeBitcoinbitcoin core - Is the OP_PUSHBYTES_X opcode all the time required after...

bitcoin core – Is the OP_PUSHBYTES_X opcode all the time required after OP_RETURN?


My present reply stands, however as I really feel we’re speaking previous one another because of totally different assumptions about what Script notations imply, let me add this to dig deeper into that.

I will change the literals in your query a bit for simplicity, and attempt to reply the query:

I see an output with scriptPubKey OP_RETURN OP_PUSHBYTES_3 686c77. Would an output with scriptPubKey OP_RETURN 686c77 even be legitimate and/or customary?

The primary level is that in your notation, the string OP_RETURN 686c77 merely has no which means. It doesn’t correspond to any script in any respect. I do not imply that such a script can be invalid; I imply that actually this can’t be translated to precise script bytes.

For background, the script OP_RETURN OP_PUSHBYTES_3 686c77 corresponds the script bytes whose hex encoding is 6a03686c77 (6a being OP_RETURN, and 03 being OP_PUSHBYTES_3). My assumption is that what you imply by OP_RETURN 686c77 is the script whose hex bytes are 6a686c77, i.e., the identical bytes as earlier than, however with the OP_PUSHBYTES_3 byte dropped.

Nevertheless, these script bytes wouldn’t be denoted OP_RETURN 686c77. It might be denoted OP_RETURN OP_ENDIF OP_FROMALTSTACK OP_NIP (as a result of with out the 03 bytes, the three bytes that comply with are interpreted as opcodes, relatively than as a literal).

In case your query is concerning the script OP_RETURN OP_ENDIF OP_FROMALTSTACK OP_NIP (hex 6a686c77), the reply is that by consensus guidelines this output is legitimate (though it has an OP_ENDIF with out corresponding OP_IF!) as a result of Scripts are usually not executed or interpreted till they’re spent, and an OP_RETURN output like that is clearly unspendable. The one consensus guidelines governing scriptPubKeys is that they can’t exceed 10000 bytes, however there are completely no guidelines limiting what these bytes could be. As for standardness, the reply as of Bitcoin Core 27.0 is not any; the requirement for OP_RETURN outputs to be customary is (amongst different issues) that the OP_RETURN is barely adopted by pushes, not by different opcodes.

So as to add to the confusion, there exist different human-readable notations for Script, together with a typical one which simply by no means makes use of OP_PUSHBYTES_xx. Within the Bitcoin Core notation, the script whose hex bytes are 6a03686c77 is solely denoted OP_RETURN 686c77 (with the 03 byte, and the pushing, implicit within the hex fixed). So in the event you ask about OP_RETURN 686c77, it actually issues what you imply by that. Both you have switched to a different encoding (for a similar script, and nothing modified), otherwise you’ve described one thing meaningless.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments