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/sendtoaddress
RPC?) - What's the difference between
getnewaddress
andgetrawchangeaddress
at 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
getnewaddress
key or agetrawchangeaddress
key?
Thank you,
Alin
getrawchangeaddress
to send the change, the change UTXO of the rawOP_RETURN
TX I created doesn't show up in mylistunspent
query. Why is that? I would like to continue spending that change, by easily finding the UTXO for it. Should I usegetnewaddress
instead? Is there something wrong with that? This is where I am confused about the two. – Alin Tomescu Jul 13 '16 at 16:03getnewaddress
PK. I am seeing the change inlistunspent
now. Will check ifgetrawchangeaddress
works as well... – Alin Tomescu Jul 13 '16 at 18:26getnewaddress
andgetrawchangeaddress
work exceptgetnewaddress
can 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