What's OP_RETURN ??
OP_RETURN( an
Opcode) refers to a locking script used for locking data to atrasanction, this data can't exceed 80
Bytes ...
Why do we use OP_RETURN ??
OP_RETURN was meant to be used to store only important trx related data..you see in the past, there was no usage of OP_RETURN and some People(with cryptographic Knowledge) were able to embed data in a way which will make it remain in the
UTXO sets,
This data could be large like(images, tweets...) which could eventually lead to bloated UTXO set , but with OP_RETURN this datas were proved to be non-spendable thus, can be pruned by nodes.
Also, to prevent the blockchain from being spammed with large data set, OP_RETURN Limit was introduced..
Here's a quick Tut on using OP_RETURN on Electrum Testnet
- Open your Electrum and goto send Tab
- On the "Pay to" section, input your Address then followed by the amount but seperated by delimer " , " comma ( the amount set will be automatically updated on the "Amount section"
- Next, move to the next line in same "Pay to" section and input "OP_RETURN <your data in hex format>" followed by amount to be burned which will be zero(0), also seperated by delimeter " , "

- Now you can add description (if you want for ease identificattoion locally) and then pay , you will be having a transaction like this:

you should notice the output with the OP_RETURN script has a balance of zero
Input: => Sender address
Outputs: => Receiver address
=> Change address
On mempool.space the transaction first-output [zero] will readily have your text attached to it.. and the hex is still available too, if you use explorer like Blockchair i think it will only show you the hex and you have to decode it yourself..
the TXID
66f4bd03c03280156d5efeb6965f2b0102c17bd41302c16ab0a089e326b48059So now you can go through thread like
this and understand what's been discussed
Note: OP_RETURN wasn't created to store all kinds of data.. if you need to store one you can do that on a cloud storage or your local drives but incase you need to store an important messages,data to your transaction, OP_RETURN got you covered. Warning: For the purpose of trying out the Tutorial, use testnet to prevent losing of funds Source and useful links:https://learnmeabitcoin.com/technical/script/return/https://bitcoin.stackexchange.com/questions/29554/explanation-of-what-an-op-return-transaction-looks-likehttps://en.bitcoin.it/wiki/Scripthttps://learnmeabitcoin.com/technical/general/bytes/https://learnmeabitcoin.com/technical/general/hexadecimal/Corrections and suggestions are welcome ..