Difference between revisions of "History of OP RETURN"

Line 1: Line 1:
The OP_RETURN opcode has a controversial history that has culminated to it being used as the primary mechanism to store arbitrary data on-chain. The original functionality was intended to behave as a return operation that ends execution of the script. The original implementation had a critical bug and was quickly [https://github.com/bitcoin/bitcoin/commit/73aa262647ff9948eaf95e83236ec323347e95d0 patched by Satoshi Nakamoto.]
+
The OP_RETURN opcode has a controversial history that has culminated to it being used as the primary mechanism to store arbitrary data on-chain. The original functionality was intended to behave as a return operation that ends execution of the script. The original implementation of the opcode had a critical bug and was quickly [https://github.com/bitcoin/bitcoin/commit/73aa262647ff9948eaf95e83236ec323347e95d0 patched by Satoshi Nakamoto.]
  
 
=== Original functionality disabled ===
 
=== Original functionality disabled ===
Line 6: Line 6:
 
OP_TRUE OP_RETURN
 
OP_TRUE OP_RETURN
  
True would be returned from the script; because of this, this example script could prepend any unlocking script, granting the ability for one to steal anyone's Bitcoin. The functionality of the opcode was changed to always return false instead of returning the value on top of the stack. This had the implication of
+
True would be returned from the script and the script would terminate, ignoring any opcodes that came afterwards; because of this, this example script could prepend any unlocking script, granting the ability for one to steal anyone's Bitcoin.  
 +
 
 +
The functionality of the opcode was changed to always return false instead of returning the value on top of the stack.
  
 
=== Storing data on-chain ===
 
=== Storing data on-chain ===

Revision as of 15:06, 8 January 2020

The OP_RETURN opcode has a controversial history that has culminated to it being used as the primary mechanism to store arbitrary data on-chain. The original functionality was intended to behave as a return operation that ends execution of the script. The original implementation of the opcode had a critical bug and was quickly patched by Satoshi Nakamoto.

Original functionality disabled

OP_RETURN was originally intended to return the top value on the stack. Given the script:

OP_TRUE OP_RETURN

True would be returned from the script and the script would terminate, ignoring any opcodes that came afterwards; because of this, this example script could prepend any unlocking script, granting the ability for one to steal anyone's Bitcoin.

The functionality of the opcode was changed to always return false instead of returning the value on top of the stack.

Storing data on-chain