OP_RETURN data transaction

6

Looking at Dev Update #5 and in particular the OP_RETURN data function due to be included in 0.9 release, how is data returned during the transaction?

Am I meant to create a new txout with no value and a scriptPubKey with just "OP_RETURN mydata" or is it included as part of another txout with a value and being sent to an actual address? How is the data represented when reaching the other end?

If I have asked the wrong question it could be due to my limited understanding of how scripting is meant to be used. In which case links to resources explaining this better would be appreciated.

Thanks

daentech

Posted 2014-03-04T10:50:23.777

Reputation: 163

Answers

5

That is correct. You create an additional txout with value 0 and script "OP_RETURN data".

Pieter Wuille

Posted 2014-03-04T10:50:23.777

Reputation: 54 032

Just pulled this script off of bc.info "OP_DUP OP_HASH160 9fec72675d009abb687ccc69a49453bb4d60f74d OP_EQUALVERIFY OP_CHECKSIG". @PeterWuille Any chance you could give me an example of how a script would be constructed using OP_RETURN? Thanksnyusternie 2014-03-19T21:43:03.830

ok, I just found this link http://blockexplorer.com/tx/eb31ca1a4cbd97c2770983164d7560d2d03276ae1aee26f12d7c2c6424252f29. OP_RETURN is the complete script; is that correct?

nyusternie 2014-03-19T21:45:12.313

No, that's not a normal OP_RETURN data output.Pieter Wuille 2014-03-19T22:26:52.973

ok, i'm starting to understand how this works. i plan to write a few test scripts to see it in action; however, any idea on the likelihood of the tx actually getting confirmed (ie. how many miners are using 0.9)? also, is it possible to use more than 1 OP_RETURN in a tx? i've read discussions, but i'm unsure on the final spec. thanksnyusternie 2014-03-21T12:08:20.353

Could you explicitly post the extra step needed in the raw transaction? I've followed this recipe for the raw transaction, but do not see how to add the OP_RETURN to the txout: https://people.xiph.org/~greg/signdemo.txt

Robert-Reinder Nederhoed 2014-04-09T07:43:55.377

3

We've just released php-OP_RETURN, a simple PHP library for generating OP_RETURN transactions. Even if you're not using PHP you can hopefully follow the code to see what is required.

Gideon

Posted 2014-03-04T10:50:23.777

Reputation: 31

Hi Gideon! Welcome to Bitcoin.SE. This looks like an interesting library.Nick ODell 2014-10-03T22:16:39.477