Author

Topic: Bitcoin-QT/bitcoind sendtoaddress (Read 933 times)

hero member
Activity: 560
Merit: 509
I prefer Zakir over Muhammed when mentioning me!
April 10, 2015, 10:34:21 AM
#10
Yes I understand, something like that:

Code:
createrawtransaction '[{"txid":"d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262","vout":1}]' '{"mxgxQ52kYRVPfLeYpXugkCAGhjLfUaZk3g":0.05000000,"mvDLEEymmEijZXyrrNRL3aPMhH8q2m8vE1":1.19994817}'

Where first output is the receiving address and second one is my actual address receving back the rest minus fee. Am I right?

By looking at the UTXO tx hash[1], yes, the second one is your address receiving the change.

It isn't always like that. For example, if you want to send Bitcoins to two people, you may use all UTXOs causing you not to receive any change.

[1] http://blockexplorer.com/testnet/tx/d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262
legendary
Activity: 1161
Merit: 1004
April 10, 2015, 09:24:28 AM
#9
However I just have to use one address only hopefully eheh..

No.

Typically you will need at least 2 output addresses for each transaction.

You'll need the address that you are sending to, and you'll need an address under your control where you are sending the change.  You'll need to make sure that you correctly calculate the change every time.  If you send back too much change, then the transaction will be invalid and the entire network will reject your transaction.  It will never confirm, and the person you are sending to will not receive the bitcoins that you are trying to send to them.

If you don't send back enough change, then you will pay a ridiculously large transaction fee.

Don't forget to calculate the transaction fee when determining the change.  If you don't leave enough value in the transaction for an adequate transaction fee, then it may take a very long time for the transaction to confirm.

Yes I understand, something like that:

Code:
createrawtransaction '[{"txid":"d3be60aaf98ef888a9137928fa405806cd2e0c762f5205b3d9ba3e6ad26a5262","vout":1}]' '{"mxgxQ52kYRVPfLeYpXugkCAGhjLfUaZk3g":0.05000000,"mvDLEEymmEijZXyrrNRL3aPMhH8q2m8vE1":1.19994817}'

Where first output is the receiving address and second one is my actual address receving back the rest minus fee. Am I right?
legendary
Activity: 3472
Merit: 4801
April 10, 2015, 09:04:51 AM
#8
However I just have to use one address only hopefully eheh..

No.

Typically you will need at least 2 output addresses for each transaction.

You'll need the address that you are sending to, and you'll need an address under your control where you are sending the change.  You'll need to make sure that you correctly calculate the change every time.  If you send back too much change, then the transaction will be invalid and the entire network will reject your transaction.  It will never confirm, and the person you are sending to will not receive the bitcoins that you are trying to send to them.

If you don't send back enough change, then you will pay a ridiculously large transaction fee.

Don't forget to calculate the transaction fee when determining the change.  If you don't leave enough value in the transaction for an adequate transaction fee, then it may take a very long time for the transaction to confirm.
legendary
Activity: 1161
Merit: 1004
April 10, 2015, 08:52:37 AM
#7
Ok guys got it now, gonna use listunspent + createrawtransaction  Cheesy

Yes.  If you use createrawtransaction, then you will have full control over exactly where the transaction value is assigned.  Be VERY careful.  Many knowledgeable and experienced people using createrawtransaction in the past have made typos or had bugs in their program that resulted in failing to send the change to an address, or sending the wrong amount of change to an address.  Any unaccounted for transaction value (supplied by the inputs) will become transaction fees for the miner (or pool) that confirms your transaction.

Thanks for the info, I'll try to work with it like a surgeon  Roll Eyes
However I just have to use one address only hopefully eheh..
legendary
Activity: 3472
Merit: 4801
April 10, 2015, 08:48:30 AM
#6
Ok guys got it now, gonna use listunspent + createrawtransaction  Cheesy

Yes.  If you use createrawtransaction, then you will have full control over exactly where the transaction value is assigned.  Be VERY careful.  Many knowledgeable and experienced people using createrawtransaction in the past have made typos or had bugs in their program that resulted in failing to send the change to an address, or sending the wrong amount of change to an address.  Any unaccounted for transaction value (supplied by the inputs) will become transaction fees for the miner (or pool) that confirms your transaction.
legendary
Activity: 1161
Merit: 1004
April 10, 2015, 08:45:10 AM
#5
Ok guys got it now, gonna use listunspent + createrawtransaction  Cheesy
legendary
Activity: 3472
Merit: 4801
April 10, 2015, 08:41:48 AM
#4
Why is Bitcoin-QT/bitcoind automatically always sending bitcoins to weird addresses and then when you spend them are obviously spent from these weird addresses?

There's nothing "weird" about them.  They are perfectly normal addresses.

It's confusing!! You can't even track your actual balance on blockchain

You have a wallet to track your balances.  Why would you trust some other third party service to know how your wallet is set up?  You shouldn't be using blockchain.info to "track balances". Blockchain.info tries to make a lot of "guesses" about what is happening with transactions.  Frequently their "guesses" are wrong.

legendary
Activity: 1232
Merit: 1094
April 10, 2015, 08:40:26 AM
#3
I assume you mean change addresses?

A bitcoin transaction must spend 100% of all coins it uses as inputs.  This means that if you don't have coins which add up to the correct amount, you have to spend the change back to your wallet.  A new change address is generated for each transaction.

If you have 3 outputs worth 0.1, 0.2 and 0.3 BTC in your wallet, and you want to spend 0.222 BTC, then transaction formed might be (inputs: 0.1, 0.2, outputs: 0.222, 0.077, fee: 0.001).  This spends the 0.2 and 0.1 BTC outputs and sends 0.077 to a change address.

If you re-use addresses, your bitcoins are less secure (protected by the ECDSA algorithm rather than both the ECDSA and RIPEMD-160 algorithms).  It also makes it easier to track what you spend them on (which is bad for privacy).
member
Activity: 61
Merit: 18
Developer
April 10, 2015, 08:39:38 AM
#2
What is a "weird address"?
legendary
Activity: 1161
Merit: 1004
April 10, 2015, 08:10:53 AM
#1
Why is Bitcoin-QT/bitcoind automatically always sending bitcoins to weird addresses and then when you spend them are obviously spent from these weird addresses?
It's confusing!! You can't even track your actual balance on blockchain because bitcoins are in many weird addresses..... Btw I'm running a PHP software on testnet with sendtoaddress and sendmany functions.
Jump to: