OP_RETURN marks transaction or output as invalid 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)
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.