Title: raw tx and change address Post by: init1 on November 03, 2015, 09:50:15 AM 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 Could you please share example how to prepare raw tx with address for the change and fee ? Thanks. Title: Re: raw tx and change address Post by: achow101 on November 03, 2015, 12:52:17 PM Just add a second output the same way you added the first output.
Title: Re: raw tx and change address Post by: fbueller on November 05, 2015, 03:38:02 PM 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. |