Author Topic: question about OP_RETURN  (Read 1417 times)

Mithril Man

  • Hero Member
  • *****
  • Posts: 589
    • View Profile
    • Mithril Man Web!
question about OP_RETURN
« on: February 27, 2015, 09:24:25 AM »
the way i wanted to use OP_RETURN was to add an identification to a transaction in order to prove that user XX payed to address 123 or that hunter213.12 subscribed to a context, etc...

now i was looking at bitcoin docs (where OP_RETURN comes from) and i've just read a scary thing: OP_RETURN transactions can be pruned and its output value is unspendable

ref: http://bitzuma.com/posts/op-return-and-the-future-of-bitcoin/

now my question is: how is OP_RETURN handled here on huntercoin? i think we should consider every tx with OP_RETURN a standard transaction (and maybe it is already), because otherwise it has lost all its attractive to me

domob, can you confirm that bitcoin works as i've read and understood (could be wrong) and that in huntercoin we don't have that problem?
Alternative GUI client for Huntercoin http://www.mithrilman.com
HUC donation: HMSCYGYJ5wo9FiniVU4pXWGUu8E8PSmoHE
BTC donation: 1DKLf1QKAZ5njucq37pZhMRG67qXDP3vPC

domob

  • Developer
  • Sr. Member
  • *****
  • Posts: 285
    • View Profile
Re: question about OP_RETURN
« Reply #1 on: February 27, 2015, 09:46:26 AM »
I've not fully understood what your concerns are.  But since we designed OP_RETURN precisely for the features you want to use it for, I see no problems with it.  Some details:
  • OP_RETURN transactions are considered standard transactions and thus relayed/mined without problems.  (They are in Bitcoin as well, although Bitcoin has a limit on the maximal size.  In Huntercoin, such a limit does not exist as long as you pay the proper fee (which the client does for you by default).)
  • OP_RETURN outputs can not be spent, that's precisely their purpose.  They also can not be spent in Huntercoin, but I do not see how that's a problem.  After all, you create them to store data and not to send coins to someone.  (The coins that you send in a "sendtoaddress" call with "tagging" are not sent to the OP_RETURN output.  The OP_RETURN output is created in addition with only the corresponding fee sent there and thus "destroyed".)

  • OP_RETURN can be pruned from the UTXO set, that's also precisely its purpose.  Again, this does not affect their usability to add "tags" to transactions.  (Unless you have a client that does not store a transaction index, which might happen in the future - in that case, you of course, you can not query for the transaction to read its tag.)
I think you haven't yet fully understood how OP_RETURN and Bitcoin transactions and all that work in detail - if you still see a problem taking these points into account, let me know and we can fix it.
Use your Namecoin-ID as OpenID: https://nameid.org/
Donations: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | HBkxA5QmYSATFoPN1wFk8eBkgwPpY97Mfu

Mithril Man

  • Hero Member
  • *****
  • Posts: 589
    • View Profile
    • Mithril Man Web!
Re: question about OP_RETURN
« Reply #2 on: February 27, 2015, 10:08:03 AM »
yes i think i've misunderstood some concept then, about how scripts works

reading https://en.bitcoin.it/wiki/Transaction#Output maybe clarified me about this, correct if i'm wrong:

OP_RETURN is a "type" of output, it is used with a value of 0 (usually) and it has its own scriptPubKey, so basically i can send a normal transaction that, as output, it contains one output that's the value i want to send to an address, and it's spendable, while another output with the scriptPubKey of OP_RETURN has usually value of 0 because OP_RETURN outputs are unspendable so any input i put there, would be wasted (lost?)

am i right?
if so, i've learnt better how transactions works and ok, i can send money alongside OP_RETURNS and what i want to do is doable (send a single transaction that send coins to address X while saying, using OP_RETURN, that the transaction has been created by user XYZ)

thanks
Alternative GUI client for Huntercoin http://www.mithrilman.com
HUC donation: HMSCYGYJ5wo9FiniVU4pXWGUu8E8PSmoHE
BTC donation: 1DKLf1QKAZ5njucq37pZhMRG67qXDP3vPC

domob

  • Developer
  • Sr. Member
  • *****
  • Posts: 285
    • View Profile
Re: question about OP_RETURN
« Reply #3 on: February 27, 2015, 10:40:25 AM »
Yes, exactly.  This is precisely how "sendtoaddress" with tagging works.  The coins explicitly sent appear in a normal output that is spendable by the recipient.  The OP_RETURN output is created additionally with the data.  (I'm not perfectly sure about the details, but I think that the value of OP_RETURN is not exactly zero in our case - it is sent the "fee" applicable for OP_RETURN, which is thus effectively destroyed.)
Use your Namecoin-ID as OpenID: https://nameid.org/
Donations: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | HBkxA5QmYSATFoPN1wFk8eBkgwPpY97Mfu