Difference between revisions of "OP RETURN"

From Bitcoin Wiki
Jump to: navigation, search
(Add Omni Layer, note Open Assets prefix)
(The recommendation for BIPs is outdated. No such BIPs exist and the practice has been discouraged on the mailing list.)
(22 intermediate revisions by 8 users not shown)
Line 1: Line 1:
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 transaction by following the OP_RETURN with an OP_PUSHDATA. Since any outputs with OP_RETURN are provably unspendable, OP_RETURN outputs can be used to [[Proof of burn|burn]] bitcoins.
+
'''OP_RETURN''' is a [[script]] opcode used to mark a transaction output as invalid. Since any outputs with OP_RETURN are provably unspendable, OP_RETURN outputs can be used to [[Proof of burn|burn]] bitcoins.
  
Currently, the default Bitcoin client relays OP_RETURN transactions up to 40 bytes, but does not provide a way 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, OP_RETURN has the advantage of not creating bogus UTXO entries, compared to some other ways of storing data in the blockchain.
  
== Philosophy ==
+
From [https://bitcoin.org/en/release/v0.9.0#opreturn-and-data-in-the-block-chain Bitcoin Core release 0.9.0]:
Some members of the Bitcoin community believe that use of OP_RETURN violates the contract of Bitcoin, because Bitcoin was intended to provide a record for financial transactions, not a record for arbitrary data. Despite this, use of OP_RETURN may continue unabated because there is no easy way to stop people from embedding arbitrary data in the blockchain, and OP_RETURN is an efficient way to do it. [[https://bitcointalk.org/index.php?topic=471928.0 bitcointalk discussion]]
+
<blockquote>
 +
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.
  
== Resources on OP_RETURN ==
+
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.
* [http://coinsecrets.org/ coinsecrets.org]: An OP_RETURN transaction explorer
+
</blockquote>
* [https://github.com/coinspark/python-OP_RETURN python-OP_RETURN]
 
* [http://bitcoin.stackexchange.com/questions/29554/explanation-of-what-an-op-return-transaction-looks-like StackExchange: Explanation of what an OP_RETURN transaction looks like]
 
* [http://www.slideshare.net/coinspark/bitcoin-2-and-opreturns-the-blockchain-as-tcpip Metadata in the Blockchain: The OP_RETURN Explosion]
 
* [http://wlangiewicz.com/blog/2014/10/24/how-to-put-custom-messages-into-bitcoin-blockchain-op-return/ How to Put Custom Messages Into Bitcoin Blockchain - OP_RETURN]
 
  
== OP_RETURN prefixes ==
+
== OP_RETURN applications ==
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.
+
OP_RETURN can be used for digital asset proof-of-ownership, and has at times been used to convey additional information needed to send transactions (see [[stealth address]]).
  
{| class="wikitable"
+
 
|-
+
{{DISPLAYTITLE:OP_RETURN}}
! Prefix (Ascii-Encoded) !! Protocol/Owner !! Brief description
 
|-
 
| Fa || Factom || ?
 
|-
 
| CC || Colu || ?
 
|-
 
| OA || [https://github.com/OpenAssets/open-assets-protocol Open Assets] || Issuance and transfer of user-created assets
 
|-
 
| omni || Omni Layer || ?
 
|-
 
| MG || [https://monegraph.com Monegraph] || Digital work licensing
 
|-
 
| id || Blockstore || ?
 
|-
 
| ASCRIBE || [https://ascribe.io ASCRIBE] || Digital work licensing
 
|-
 
| ? || Counterparty || ?
 
|}
 

Revision as of 15:30, 20 September 2018

OP_RETURN is a script opcode used to mark a transaction output as invalid. Since any outputs with OP_RETURN are provably unspendable, OP_RETURN outputs can be used to burn bitcoins.

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, OP_RETURN has the advantage of not creating bogus UTXO entries, compared to some other ways of storing data in the blockchain.

From Bitcoin Core release 0.9.0:

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 applications

OP_RETURN can be used for digital asset proof-of-ownership, and has at times been used to convey additional information needed to send transactions (see stealth address).