Difference between revisions of "OP RETURN"

Line 1: Line 1:
 
'''OP_RETURN''' is a [[Opcodes_used_in_Bitcoin_Script|script]] opcode used to end the script and return the top value on the stack. This opcode is analogous to the return function in programming languages. The OP_RETURN opcode has a controversial history(link) in Bitcoin and as a result has been primarily used as a means of storing data on the blockchain.
 
'''OP_RETURN''' is a [[Opcodes_used_in_Bitcoin_Script|script]] opcode used to end the script and return the top value on the stack. This opcode is analogous to the return function in programming languages. The OP_RETURN opcode has a controversial history(link) in Bitcoin and as a result has been primarily used as a means of storing data on the blockchain.
  
The Genesis upgrade in February 2020 restores the original functionality of the opcode. This will not impact the ability to store arbitrary data, as it is advised to now use OP_FALSE OP_RETURN in scripts that seek to do so.
+
The Genesis upgrade in February 2020 restores the original functionality of the opcode. This will not impact the ability to store arbitrary data, as it is advised to now use OP_FALSE OP_RETURN in scripts that still seek to do so.
 +
 
 +
=== Storing data on-chain ===
 +
The Genesis upgrade re-enables the original functionality of the push data opcodes such that OP_RETURN is no longer the only means of pushing data onto the stack. Given this, the push data opcodes should be used in lieu of OP_RETURN.
  
 
{{DISPLAYTITLE:OP_RETURN}}
 
{{DISPLAYTITLE:OP_RETURN}}

Revision as of 17:28, 6 January 2020

OP_RETURN is a script opcode used to end the script and return the top value on the stack. This opcode is analogous to the return function in programming languages. The OP_RETURN opcode has a controversial history(link) in Bitcoin and as a result has been primarily used as a means of storing data on the blockchain.

The Genesis upgrade in February 2020 restores the original functionality of the opcode. This will not impact the ability to store arbitrary data, as it is advised to now use OP_FALSE OP_RETURN in scripts that still seek to do so.

Storing data on-chain

The Genesis upgrade re-enables the original functionality of the push data opcodes such that OP_RETURN is no longer the only means of pushing data onto the stack. Given this, the push data opcodes should be used in lieu of OP_RETURN.