Bitcoin Forum
October 19, 2018, 06:53:29 PM *
News: Make sure you are not using versions of Bitcoin Core other than 0.17.0 [Torrent], 0.16.3, 0.15.2, or 0.14.3. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: raw tx and change address  (Read 846 times)
init1
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
November 03, 2015, 09:50:15 AM
 #1

Hello

Want to prepare raw TX with change address.
according to the manual https://bitcoin.org/en/developer-examples#simple-raw-transaction

input had 50.0000 bitcoins and our output ($NEW_ADDRESS) is being paid 49.9999 bitcoins, so the transaction will include a fee of 0.0001 bitcoins. If we had paid $NEW_ADDRESS only 10 bitcoins with no other changes to this transaction, the transaction fee would be a whopping 40 bitcoins

I should add change address if I want to save change.

prepared Raw tx like this
Code:
./bitcoin-cli createrawtransaction
'[{"txid":"fba4b0a1e11b68c587aae3578844d68131c807913767a1efc9a699d38ecd9f06",
"vout":1,
"scriptPubKey":"a914e8fa0f97c663ba132bd81e6d657c46825d390e6c87",
"redeemscript":"524104d9546728bb1d1bf309ef3c2c7278d8d306052ecf7dc81443f16e75ae607099dfcfc573a3e71553bd8321d91c209bab03aa999befa6e77734c0f4dd34ef78ebfd41041050ff637a97fa462dffa19d0bc013869f6231895019bd9f263a0a55a067665cfca4473aab1dc38e8aecf359e23ce6bb35ff900bc84fdd890a3b982ea50dd92f4104e086dce7893384cbfa89fbbf7d33de3f1ee01279a1e9810d952f1c440e91fc7ee7cb9cf070dfbdee397e123c363d140221e81610b7bd695905fbf198edfd71a153ae"}]'
 '{"143UX8t7LNiAf1dNPqyWDYQ1Gedbk27R7b":0.0001}'

Could you please share example how to prepare raw tx with address for the change and fee  ?

Thanks.
1539975209
Hero Member
*
Offline Offline

Posts: 1539975209

View Profile Personal Message (Offline)

Ignore
1539975209
Reply with quote  #2

1539975209
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1539975209
Hero Member
*
Offline Offline

Posts: 1539975209

View Profile Personal Message (Offline)

Ignore
1539975209
Reply with quote  #2

1539975209
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1554
Merit: 1704


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


View Profile WWW
November 03, 2015, 12:52:17 PM
 #2

Just add a second output the same way you added the first output.

fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 250


View Profile
November 05, 2015, 03:38:02 PM
 #3

If you were doing:

in: 50 coin input,
fee: 0.0001
out: 10
 39.9999 change

Quote
...snippet...
'{"143UX8t7LNiAf1dNPqyWDYQ1Gedbk27R7b":"10","your-change-address", "39.9999"}'

And, remember to never use floats (BTC amounts) in additions, subtractions - use satoshis instead.

Bitwasp Developer.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!