Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: robocop on February 15, 2012, 05:10:22 PM



Title: send BTC generate new address?
Post by: robocop on February 15, 2012, 05:10:22 PM
If I have 50 BTC on my address and I want to send 10 BTS to another address then the rest of 50 BTC = 40 BTC will sent to a new generated address.
I know that was integrated to make the flow more anonymous.

Is there a possibilty to deactivate this function?

Because I need a clean simple transaction history where I and other users can check it.


Title: Re: send BTC generate new address?
Post by: Stephen Gornick on February 15, 2012, 07:18:59 PM
Is there a possibilty to deactivate this function?

I believe you are asking to specify the address for the "change" to land at.

The only A client that I'm aware of that lets you choose the address where the change should land at is My Wallet from http://BlockChain.info/wallet (which is a  Javascript wallet accessed from a browser)

A workaround is, using the bitcoin-qt client, to make more than one transaction.  So you would send a 10 BTC payment and then click "add recipient" to send the 40 BTC (or 39.9995 to account if paying a 0.0005 fee) right back to the address that you would be sending from.

 [Update: A client that sends the change back to an input address is MultiBit -- see jim618's response below.]


Title: Re: send BTC generate new address?
Post by: terrytibbs on February 15, 2012, 07:35:32 PM
Is there a possibilty to deactivate this function?

I believe you are asking to specify the address for the "change" to land at.

The only client that I'm aware of that lets you choose the address where the change should land at is My Wallet from http://BlockChain.info/wallet (which is a  Javascript wallet accessed from a browser)

A workaround is, using the bitcoin-qt client, to make more than one transaction.  So you would send a 10 BTC payment and then click "add recipient" to send the 40 BTC (or 39.9995 to account if paying a 0.0005 fee) right back to the address that you would be sending from.

I think what this person is asking for is a way to have a transaction with only a single output. This is what they're referring to when they mean a "clean" transaction.

To answer the question:
Yes and no. In the scenario you describe, I would send the 10BTC to an address you still control, and to the recipient from there - if there weren't any fees there should only be a single output.


Title: Re: send BTC generate new address?
Post by: mcorlett on February 15, 2012, 07:40:18 PM
This isn't technically possible. There is no way to spend just part of the balance output of an address. You have to spend it all, so the client sends the rest ("change") back to itself.


Title: Re: send BTC generate new address?
Post by: DeathAndTaxes on February 15, 2012, 07:45:24 PM
If I have 50 BTC on my address and I want to send 10 BTS to another address then the rest of 50 BTC = 40 BTC will sent to a new generated address.
I know that was integrated to make the flow more anonymous.

Is there a possibilty to deactivate this function?

Because I need a clean simple transaction history where I and other users can check it.

You could (w/ a modified client) specify which change address you want the 40 BTC sent to.

Alternatively you could create a mult-spend transaction sending 10 BTC to A and 40 BTC to B and thus the change will be zero.

It is completely impossible to just send 10 from an address which has 50 BTC (from one output).  Bitcoin doesn't move values it moves prior outputs.

Your address has 50 BTC because there is some prior transaction(s) which has it as an ouput.  When you "spend" or "move" coins what you are actually doing is specifying a prior output and directing it to a new input.  You can specify part of an output.



Title: Re: send BTC generate new address?
Post by: jim618 on February 15, 2012, 07:51:10 PM
Whilst you cannot specify a change address, MultiBit sends the change back to the original sending address (not a new address).
This might be 'clean' enough for the OP.

For instance, if you look at a transaction I just made in MultiBit:

http://blockchain.info/tx-index/15642797/8877b6e815e319d0153ec7d4aa3b952c9f246b8a98a75bde858350bd4ba3d19b

You can see that the 0.01 BTC went from 1Kqnx... to 1Jixz... and the change went back to 1Kqnx...


Title: Re: send BTC generate new address?
Post by: Gavin Andresen on February 15, 2012, 09:16:15 PM
If I have 50 BTC on my address and I want to send 10 BTS to another address then the rest of 50 BTC = 40 BTC will sent to a new generated address.
I know that was integrated to make the flow more anonymous.

Is there a possibilty to deactivate this function?

Because I need a clean simple transaction history where I and other users can check it.

I've got a "noprivacy" branch of bitcoin that I use for the Faucet:
  https://github.com/gavinandresen/bitcoin-git/tree/noprivacy

Instead of creating a new address for change, it uses one of the input's addresses.

It works nicely if your entire bitcoin balance is one "account", but will fail if you're using the accounts feature to keep track of separate balances (which is why it will probably never be a mainline feature).



Title: Re: send BTC generate new address?
Post by: Pieter Wuille on February 15, 2012, 09:25:49 PM
This isn't technically possible. There is no way to spend just part of the balance of an address. You have to spend it all, so the client sends the rest ("change") back to itself.

This is not correct. There is no way to spend just part of a single transaction output ("coin"), but the balance of an address may consist of several transaction outputs, in which case they can be spent individually.


Title: Re: send BTC generate new address?
Post by: mcorlett on February 15, 2012, 09:32:19 PM
This isn't technically possible. There is no way to spend just part of the balance of an address. You have to spend it all, so the client sends the rest ("change") back to itself.

This is not correct. There is no way to spend just part of a single transaction output ("coin"), but the balance of an address may consist of several transaction outputs, in which case they can be spent individually.
My apologies. What I meant to say instead of address was output (or input, depending on where you're looking from).


Title: Re: send BTC generate new address?
Post by: robocop on February 15, 2012, 10:30:19 PM
Thx all for your helping answers. Now I have what I want.
I will use Multibit for my new project. More informations coming soon. ;-)


Title: Re: send BTC generate new address?
Post by: coretechs on February 16, 2012, 02:56:55 PM
Couldn't you just use "sendmany" to send to the recipient and back to your own address?  (I haven't tried this)


Title: Re: send BTC generate new address?
Post by: btc_artist on February 16, 2012, 02:58:23 PM
Couldn't you just use "sendmany" to send to the recipient and back to your own address?  (I haven't tried this)
Yes, you can.


Title: Re: send BTC generate new address?
Post by: Pieter Wuille on February 16, 2012, 02:59:09 PM
Couldn't you just use "sendmany" to send to the recipient and back to your own address?  (I haven't tried this)
Yes, you can.

Except you don't know which input sendmany is going to use, so you don't know how much to send back.


Title: Re: send BTC generate new address?
Post by: btc_artist on February 16, 2012, 03:00:32 PM
Couldn't you just use "sendmany" to send to the recipient and back to your own address?  (I haven't tried this)
Yes, you can.

Except you don't know which input sendmany is going to use, so you don't know how much to send back.
True, I stand corrected. So with the (unmodified) Satoshi client, the best answer is you really can't.


Title: Re: send BTC generate new address?
Post by: coretechs on February 16, 2012, 03:06:47 PM
I thought sendmany allows you to specify from which "account" you are sending, so you could create a new "account" first and move BTC to an address there to isolate the inputs.


Title: Re: send BTC generate new address?
Post by: coretechs on February 29, 2012, 03:19:03 AM
I finally got back to trying this and it seems to work just fine using bitcoind 0.5.2.  I believe this is what robocop was looking for and shows it is possible in the standard client if you take a step first to isolate the account and ensure that you always send the entire remaining balance to the desired address.  Just keep in mind that this will expose the exact remaining balance of the account/address to anyone you send BTC.

To make things easier while playing with this I made a quick script to generate the sendmany command for sending a payment to a single address and automatically send the remaining balance (-0.0005 tx fee) back to the specified address.  It assumes you are using an address in the default "" account in a dedicated wallet.

Code:
#!/bin/bash
# Usage: send.sh <from> <to> <amt>
echo "./bitcoind sendmany \"\" '{\"$2\":$3,\"$1\":`echo "(\`./bitcoind getbalance "" 0\`-$3-0.0005)"|bc`}'"

p.s. Holliday - I should have figured this out before running that p2pool donation cron job; it would have tracked correctly like we had wanted!!