Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: init1 on July 18, 2015, 03:32:04 PM



Title: change address for raw tx
Post by: init1 on July 18, 2015, 03:32:04 PM
Hello!

Can I set change address for raw tx?

For example


1) createrawtransaction
2) addedrawtransactionaddress
3) signrawtransaction
4) sendrawtransaction

or can I set address for the change which I created in the step 1 "1) createrawtransaction"

BR !


Title: Re: change address for raw tx
Post by: achow101 on July 18, 2015, 03:52:22 PM
You have to set the change address when you do createrawtransaction. If you don't it will become a transaction fee.


Title: Re: change address for raw tx
Post by: fbueller on July 19, 2015, 01:01:16 AM
^ this is very important.. You can lose bitcoins if you forget about change.

You can set a change address during createrawtransaction. Just add a second output. It's a good idea to randomize the order of the change address, and to use a new change address every time to avoid privacy issues.


Title: Re: change address for raw tx
Post by: init1 on July 19, 2015, 03:54:12 PM
Thanks you, Any examples how to do it with p2sh address ?
I created address like this

createmultisig   <nrequired> <'["key,"key"]'>   Creates a multi-signature address and returns a json object

Shoud I add change output with creation raw tx?

Any correct examples ?

BR!


Title: Re: change address for raw tx
Post by: coinableS on July 19, 2015, 04:27:00 PM
Thanks you, Any examples how to do it with p2sh address ?
I created address like this

createmultisig   <nrequired> <'["key,"key"]'>   Creates a multi-signature address and returns a json object

Shoud I add change output with creation raw tx?

Any correct examples ?

BR!
Exactly like knightdk stated you have specify one when creating the transaction.
Just add a comma after the destination address and enter in another address as your change address.

Code:
createrawtransaction '[{"txid":"","vout":}]' '{"1someBitcoinAddress45d1c5":0.001,"1myChangeAddress45d6c1":0.01}'

Here's a video I made on the subject as well https://youtu.be/YN2Vyu9RupU?t=7m30s


Title: Re: change address for raw tx
Post by: init1 on July 20, 2015, 09:24:00 AM
WoW! cool, thanks a lot!