OP_RETURN is a script opcode used to mark a transaction output as invalid. Since the data after OP_RETURN are irrelevant to Bitcoin payments, arbitrary data can be added into the output after an OP_RETURN. Since any outputs with OP_RETURN are provably unspendable, OP_RETURN outputs can be used to burn bitcoins.
Currently, the default Bitcoin client relays OP_RETURN transactions up to 80 bytes , but does not provide a way for users to create OP_RETURN transactions.
Is storing data in the blockchain acceptable?
Many members of the Bitcoin community believe that use of OP_RETURN is irresponsible in part because Bitcoin was intended to provide a record for financial transactions, not a record for arbitrary data. Additionally, it is trivially obvious that the demand for external, massively-replicated data store is essentially infinite. Despite this, the use of OP_RETURN continues unabated: while there is no global miner consensus to stop people from embedding arbitrary data in the blockchain if they want to, OP_RETURN is somewhat more efficient in terms of data bytes stored as a fraction of blockchain space consumed. Compared to some other ways of storing data in the blockchain, OP_RETURN has the advantage of not creating bogus UTXO entries. Discussion on GitHub pull request
The creation of OP_RETURN outputs also destroys Bitcoins used in the outputs of OP_RETURN transactions, which contributes to future deflationary pressures.
This change is not an endorsement of storing data in the blockchain. The OP_RETURN change creates a provably-prunable output, to avoid data storage schemes – some of which were already deployed – that were storing arbitrary data such as images as forever-unspendable TX outputs, bloating bitcoin's UTXO database.
Storing arbitrary data in the blockchain is still a bad idea; it is less costly and far more efficient to store non-currency data elsewhere.
OP_RETURN is used for writing human-language messages, digital asset proof-of-ownership, and storing data. Its use has been proposed for P2P application discovery. See the "prefixes" table below.
Often, OP_RETURN transactions include a prefix to identify which protocol they belong to. There is no standardized method of claiming OP_RETURN prefixes, and not all OP_RETURN transactions use prefixes. At the time of writing, this wiki page is probably the most complete list of OP_RETURN prefixes. Note that this table is an attempt to catalog OP_RETURN prefixes that are already in use, *not* a system for reserving OP_RETURN prefixes! Protocols with no prefix do not use a prefix in OP_RETURN transactions.
|DOCPROOF||Proof of Existence|
External resources on OP_RETURN
- coinsecrets.org: An OP_RETURN transaction explorer]
- bitcoinstrings.com: A site showing raw strings in Bitcoin transactions