user30709: I am currently looking into the Bitcoin script. I want to create a transaction with one output with OP_RETURN and some data, and one output which pays coins to some address. I am confused, does OP_RETURN mark the whole transaction as invalid or just the output.
I am especially confused because the wiki is not clear on this issue:
https://en.bitcoin.it/wiki/Script#Flow_control
(says the whole transaction is marked as invalid)
https://en.bitcoin.it/wiki/OP_RETURN
(says just the output is marked as invalid)

user208: Both.
Transaction output scripts are only executed at the time they are attempted to be spent.
If you try to spend an OP_RETURN output, the spending transaction is invalid, as this instruction immediately fails the execution.
As a result, OP_RETURN outputs (not the transactions they are in) are unspendable.

30709: <p>I am currently looking into the Bitcoin script. I want to create a transaction with one output with OP_RETURN and some data, and one output which pays coins to some address. I am confused, does OP_RETURN mark the whole transaction as invalid or just the output.</p>

<p>I am especially confused because the wiki is not clear on this issue:
<a href="https://en.bitcoin.it/wiki/Script#Flow_control" rel="nofollow">https://en.bitcoin.it/wiki/Script#Flow_control</a>
(says the whole transaction is marked as invalid)
<a href="https://en.bitcoin.it/wiki/OP_RETURN" rel="nofollow">https://en.bitcoin.it/wiki/OP_RETURN</a>
(says just the output is marked as invalid)</p>
 208: <p>Both.</p>

<p>Transaction output scripts are only executed at the time they are attempted to be spent.</p>

<p>If you try to spend an OP_RETURN output, the spending transaction is invalid, as this instruction immediately fails the execution.</p>

<p>As a result, OP_RETURN outputs (not the transactions they are in) are unspendable.</p>
