Bitcoin Forum
May 23, 2024, 04:46:16 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: change address for raw tx  (Read 954 times)
init1 (OP)
Jr. Member
*
Offline Offline

Activity: 43
Merit: 1


View Profile
July 18, 2015, 03:32:04 PM
 #1

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 !
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6647


Just writing some code


View Profile WWW
July 18, 2015, 03:52:22 PM
 #2

You have to set the change address when you do createrawtransaction. If you don't it will become a transaction fee.

fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 275


View Profile
July 19, 2015, 01:01:16 AM
 #3

^ 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.

Bitwasp Developer.
init1 (OP)
Jr. Member
*
Offline Offline

Activity: 43
Merit: 1


View Profile
July 19, 2015, 03:54:12 PM
 #4

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!
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
July 19, 2015, 04:27:00 PM
 #5

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

init1 (OP)
Jr. Member
*
Offline Offline

Activity: 43
Merit: 1


View Profile
July 20, 2015, 09:24:00 AM
 #6

WoW! cool, thanks a lot!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!