I'm using the Golang btcsuite/btcd library to write a Bitcoin app that creates custom OP_RETURN TXs in the blockchain.
I understand Bitcoin at a high-level (proof-of-work consensus, Merkle trees, membership, signatures, etc.), but I'm getting lost in the (unnecessarily?) complicated details of its RPC interface.
I was writing code in Go for creating a custom transaction with 1 input and 2 outputs (an OP_RETURN output and a change output). Here are my questions:
- Is this considered a raw transaction? (If so, what exactly constitutes a raw transaction? Is it all transactions that don't get created via the
sendfrom/sendmany/sendtoaddressRPC?) - What's the difference between
getnewaddressandgetrawchangeaddressat a semantic level? It seems that both generate a key-pair, but why is there a need for two different calls? - If I'm creating a raw transaction as described above, should I send the change to a
getnewaddresskey or agetrawchangeaddresskey?
Thank you,
Alin
getrawchangeaddressto send the change, the change UTXO of the rawOP_RETURNTX I created doesn't show up in mylistunspentquery. Why is that? I would like to continue spending that change, by easily finding the UTXO for it. Should I usegetnewaddressinstead? Is there something wrong with that? This is where I am confused about the two. – Alin Tomescu Jul 13 '16 at 16:03getnewaddressPK. I am seeing the change inlistunspentnow. Will check ifgetrawchangeaddressworks as well... – Alin Tomescu Jul 13 '16 at 18:26getnewaddressandgetrawchangeaddresswork exceptgetnewaddresscan associate the PK with an 'account.' However, since accounts are deprecated, I will stay away from them. Still unclear why both calls exist, especially if accounts are being deprecated: the corresponding SK needs to be added to the wallet by both of them, so what's the difference between them? – Alin Tomescu Jul 14 '16 at 22:09