Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: audenx on March 08, 2013, 04:36:21 AM



Title: Two separate outputs to the same address in one transaction?
Post by: audenx on March 08, 2013, 04:36:21 AM
Is it possible (or considered good/bad form) to have two separate outputs in a Bitcoin transaction that go to the same Bitcoin address?

If it is possible, are there any negative ramifications for the user, the blockchain, etc.?

Thanks.


Title: Re: Two separate outputs to the same address in one transaction?
Post by: Raoul Duke on March 08, 2013, 04:42:16 AM
Not possible. The Bitcoin client will not send it and give you an error.
All the outputs need to be different addresses.


Title: Re: Two separate outputs to the same address in one transaction?
Post by: audenx on March 08, 2013, 05:01:44 AM
Not possible. The Bitcoin client will not send it and give you an error.
All the outputs need to be different addresses.

Thank you!


Title: Re: Two separate outputs to the same address in one transaction?
Post by: grau on March 08, 2013, 03:04:57 PM
Not possible. The Bitcoin client will not send it and give you an error.
All the outputs need to be different addresses.
I do not see, that this would be a requirement on the protocol level.


Title: Re: Two separate outputs to the same address in one transaction?
Post by: blueadept on March 08, 2013, 03:12:29 PM
You can do this with the Satoshi client using the raw transaction API. Just make sure you're careful not to spend too much in fees.


Title: Re: Two separate outputs to the same address in one transaction?
Post by: Raoul Duke on March 08, 2013, 03:35:40 PM
Not possible. The Bitcoin client will not send it and give you an error.
All the outputs need to be different addresses.
I do not see, that this would be a requirement on the protocol level.

Well, may not be a requirement at the protocol level, but if you use sendmany, be it trough Bitcoin-qt or bitcoind, it will throw a error if you insert the same address more than 1 time.
Been there, done that, got the error "You can only send once to one address on the same transaction"(or something like that, can't remember the exact wording on it)


Title: Re: Two separate outputs to the same address in one transaction?
Post by: misterbigg on March 08, 2013, 03:40:13 PM
Two McFlys, with the SAME GUN!!


Title: Re: Two separate outputs to the same address in one transaction?
Post by: audenx on March 08, 2013, 04:06:12 PM
Not possible. The Bitcoin client will not send it and give you an error.
All the outputs need to be different addresses.
I do not see, that this would be a requirement on the protocol level.

Well, may not be a requirement at the protocol level, but if you use sendmany, be it trough Bitcoin-qt or bitcoind, it will throw a error if you insert the same address more than 1 time.

Does this mean it would be possible, if you wrote your own client, to construct a 2-outputs-to-the-same-address transaction?

Two McFlys, with the SAME GUN!!

LOL


Title: Re: Two separate outputs to the same address in one transaction?
Post by: Raoul Duke on March 08, 2013, 04:19:58 PM
Not possible. The Bitcoin client will not send it and give you an error.
All the outputs need to be different addresses.
I do not see, that this would be a requirement on the protocol level.

Well, may not be a requirement at the protocol level, but if you use sendmany, be it trough Bitcoin-qt or bitcoind, it will throw a error if you insert the same address more than 1 time.

Does this mean it would be possible, if you wrote your own client, to construct a 2-outputs-to-the-same-address transaction?

Two McFlys, with the SAME GUN!!

LOL

Like someone said you can maybe use the raw transactions API to create one of such transactions. But be careful... Already 2 times someone paid 100 BTC on fees using such raw transactions. Not telling you how to do it because I really don't know how.
Maybe someone here will want to teach you, or you may read up on it here: https://en.bitcoin.it/wiki/Raw_Transactions


Title: Re: Two separate outputs to the same address in one transaction?
Post by: audenx on March 08, 2013, 04:31:39 PM
Like someone said you can maybe use the raw transactions API to create one of such transactions. But be careful... Already 2 times someone paid 100 BTC on fees using such raw transactions.

Warning duly noted! I'm not planning to create raw transactions, myself, as I've read at least two posts in the past two days about accidental fee payments. I'm more interested conceptually about whether it's possible with a new client, since it could help further streamline the idea I'm brainstorming for a web-based alternative to bitcoin-otc (https://bitcointalk.org/index.php?topic=149385.0). (Two outputs to the same address in one transaction could eliminate the need for an "open" and a "close" signal to appear in separate transactions, thereby potentially reducing fees.)

Maybe someone here will want to teach you, or you may read up on it here: https://en.bitcoin.it/wiki/Raw_Transactions

Thanks for the link.


Title: Re: Two separate outputs to the same address in one transaction?
Post by: kjj on March 08, 2013, 04:36:46 PM
You can't use createrawtransaction to do this.  You have to make the transaction by hand (or using some other tool that you'll probably have to write yourself, but it is pretty easy either way).

Once made, the stock client can sign and broadcast it as usual.  It causes absolutely no problems in the client, network or protocol.  TxOuts are identified by {txhash:sequence} so each output has a unique name and can be spent as usual.

The main problem is that JSON does not allow duplicate keys, and the only interfaces in the stock client to create multi-output transactions are through JSON.


Title: Re: Two separate outputs to the same address in one transaction?
Post by: kjj on March 08, 2013, 04:53:32 PM
7a1539601e5928472eec972e4e12445f99c77f201de7bd641c1eb389e5ec464c (http://blockexplorer.com/tx/7a1539601e5928472eec972e4e12445f99c77f201de7bd641c1eb389e5ec464c)



Title: Re: Two separate outputs to the same address in one transaction?
Post by: audenx on March 08, 2013, 05:00:01 PM
7a1539601e5928472eec972e4e12445f99c77f201de7bd641c1eb389e5ec464c (http://blockexplorer.com/tx/7a1539601e5928472eec972e4e12445f99c77f201de7bd641c1eb389e5ec464c)



Ahah! Proof. Thanks.


Title: Re: Two separate outputs to the same address in one transaction?
Post by: mb300sd on March 08, 2013, 05:36:05 PM
You can use my library to do it if you know a little bit of C#

See the first commented out section of code here,
https://github.com/mb300sd/Bitcoin-Tool/blob/fb782fcc7d70f0a7c9c0acf79add281206658f95/Bitcoin%20Tool/Program.cs