OP_RETURN
OP_RETURN is a Bitcoin script opcode that allows embedding a small amount of arbitrary data (up to 80 bytes) in a transaction output. The output is provably unspendable, meaning it does not create a UTXO that nodes must track, making it the cleanest way to store data on the blockchain.
How It Works
OP_RETURN creates a transaction output that immediately marks itself as unspendable. When a node encounters OP_RETURN in a script, it stops execution and the output can never be spent. This is intentional — it provides a standardized way to embed data in the blockchain without polluting the UTXO set with outputs that can never be used.
Before OP_RETURN was standardized, people embedded data using other methods like fake addresses or multisig outputs, which created unspendable UTXOs that every full node had to track forever. OP_RETURN was introduced specifically to address this problem — it gives data embedders a clean method that does not burden the UTXO set, since nodes can immediately discard these outputs.
Common uses of OP_RETURN include timestamping documents (storing a hash as proof of existence), anchoring sidechain data to the Bitcoin blockchain, and various token protocols. Each OP_RETURN output is limited to 80 bytes of data, which is enough for a hash or a short message but not for storing large files. The transaction still requires a fee to be included in a block, so there is an economic cost to data embedding.
Key Points
- Allows embedding up to 80 bytes of arbitrary data in a transaction
- Creates provably unspendable outputs that do not bloat the UTXO set
- Commonly used for timestamping, proof-of-existence, and sidechain anchoring
- Preferable to other data embedding methods that pollute the UTXO set
- Requires a transaction fee like any other Bitcoin transaction