Post
Topic
Board Development & Technical Discussion
Merits 1 from 1 user
Re: Playing with analytics
by
pooya87
on 16/02/2025, 04:51:38 UTC
⭐ Merited by ABCbits (1)
OP_RETURN, in Bitcoin protocol, prune transaction embedded with data out of the Utxo set and make them unspendable,
The protocol doesn't make them unspendable by pruning them out of the UTXO set (or rather not including them in first place), they are unspendable because of how that OP code is defined. Not to mention that bitcoin core is only skipping certain scripts that contain OP_RETURN[1] not all of them and that behavior can be categorized as a preference by this client not as part of the protocol.

The way protocol makes them unspendable is by defining how they are treated[2] which is: if the interpreter reaches OP_RETURN the script evaluation fails right away. Otherwise the following output script is also unspendable but bitcoin core will include it in the UTXO set:
Code:
OP_1 OP_RETURN

P.S. FWIW when I say "reaches them" I mean the following output script is spendable regardless of the OP_RETURN inside it:
Code:
OP_1 OP_IF OP_1 OP_ELSE OP_RETURN OP_ENDIF

[1] https://github.com/bitcoin/bitcoin/blob/43e71f74988b2ad87e4bfc0e1b5c921ab86ec176/src/script/script.h#L571
[2] https://github.com/bitcoin/bitcoin/blob/43e71f74988b2ad87e4bfc0e1b5c921ab86ec176/src/script/interpreter.cpp#L666-L669

Runes protocol, for instance, then uses the Opcode to hold just about 80bytes of fungible data token, that includes, name, minting, token ID, and symbol, to aid the transfers of Runestoken.
That is still arbitrary data as far as Bitcoin protocol is concerned.