Bitcoin Forum
May 24, 2024, 05:00:59 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin-QT/bitcoind sendtoaddress  (Read 932 times)
supermoney (OP)
Legendary
*
Offline Offline

Activity: 1161
Merit: 1004



View Profile
April 10, 2015, 01:10:53 PM
 #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.
drizzt
Member
**
Offline Offline

Activity: 61
Merit: 10

Developer


View Profile WWW
April 10, 2015, 01:39:38 PM
 #2

What is a "weird address"?

Community manager of ABCore
Bitrated user: drizzt.
TierNolan
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
April 10, 2015, 01:40:26 PM
 #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).

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
April 10, 2015, 01:41:48 PM
 #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.

supermoney (OP)
Legendary
*
Offline Offline

Activity: 1161
Merit: 1004



View Profile
April 10, 2015, 01:45:10 PM
 #5

Ok guys got it now, gonna use listunspent + createrawtransaction  Cheesy
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
April 10, 2015, 01:48:30 PM
 #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.
supermoney (OP)
Legendary
*
Offline Offline

Activity: 1161
Merit: 1004



View Profile
April 10, 2015, 01:52:37 PM
 #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..
DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
April 10, 2015, 02:04:51 PM
 #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.
supermoney (OP)
Legendary
*
Offline Offline

Activity: 1161
Merit: 1004



View Profile
April 10, 2015, 02:24:28 PM
 #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?
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
April 10, 2015, 03:34:21 PM
 #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

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!