user24573: 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 and getrawchangeaddress 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 a getrawchangeaddress key?

Thank you,
Alin

user3697: 
The rawtransaction interface accepts and returns "raw" hex encoded p2p compatible transactions. Using the non-rawtransaction methods (like sendtoaddres, will not give you the possibility to inspect or alter the created bytearray.
The getrawchangeaddress method will retrieve a key from the keypool and return its pubkey (encoded into an p2pkh address). Unlike getrawchangeaddress, gewnewaddress will create an address book entry that will allow you better ways to inspect/distinct what funds you have received with that address and therefore increases the chance of a reused address.
You should use getrawchangeaddress if you like to use the given address as a change output for your rawtransaction.


24573: <p>I'm using the Golang btcsuite/btcd library to write a Bitcoin app that creates custom <code>OP_RETURN</code> TXs in the blockchain.</p>

<p>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.</p>

<p>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:</p>

<ol>
<li>Is this considered a <em>raw</em> transaction? (If so, what exactly constitutes a raw transaction? Is it all transactions that don't get created via the <code>sendfrom/sendmany/sendtoaddress</code> RPC?)</li>
<li>What's the difference between <code>getnewaddress</code> and <code>getrawchangeaddress</code> at a semantic level? It seems that both generate a key-pair, but why is there a need for two different calls?</li>
<li>If I'm creating a <em>raw</em> transaction as described above, should I send the change to a <code>getnewaddress</code> key or a <code>getrawchangeaddress</code> key?</li>
</ol>

<p>Thank you,<br>
Alin</p>
 3697: <ol>
<li><p>The <strong>rawtransaction</strong> interface accepts and returns "raw" hex encoded p2p compatible transactions. Using the non-rawtransaction methods (like <code>sendtoaddres</code>, will not give you the possibility to inspect or alter the created bytearray.</p></li>
<li><p>The <strong><code>getrawchangeaddress</code></strong> method will retrieve a key from the keypool and return its pubkey (encoded into an p2pkh address). Unlike <strong><code>getrawchangeaddress</code></strong>, <strong><code>gewnewaddress</code></strong> will create an address book entry that will allow you better ways to inspect/distinct what funds you have received with that address and therefore increases the chance of a reused address.</p></li>
<li><p>You should use <strong><code>getrawchangeaddress</code></strong> if you like to use the given address as a change output for your rawtransaction.</p></li>
</ol>
