<p>You can send bitcoins to the same address you are sending from, if you create a raw transaction manually, or if you use a wallet that does not create a new change address each time a transaction is made.</p>

<p>One reason why this new address process exists is to protect privacy. If you consider that the outputs of a transaction with change, where one of the outputs points back to itself, you will immediately be able to determine how much you paid, and factually, that you paid that amount to someone else, keeping the change.</p>

<p>If on the other had a different address is used for change, an independent observer cannot determine which of the two amounts was change and which was the payment.</p>

<p>However what I suspect you are doing is the classic mistake of thinking that the difference between what you are paying to the other address and what was in the originating address is automatically sent back to you. </p>

<p>I cannot emphasize this enough - the difference is sent to the miner as a mining fee. You have in effect not explicitly told the transaction what to do with the difference and it is therefore assumed that this is a fee that you are paying, and is collected by the miner who mines the block containing your transaction.</p>

<p>In order to avoid this, each transaction must have a minimum of two explicit payments, and one implicit payment:</p>

<ul>
<li><p>Input amount </p></li>
<li><p>Payment to address 1 (must be less than input)</p></li>
<li>Payment to address 2 (must be change minus the fee that you want to pay)</li>
</ul>

<p>The input must be explicitly greater than the sum of payment 1 and 2, and anything left over is implicitly the miners fee</p>

CC BY-SA 3.0
2014-12-09T10:45:35.473Z
2014-12-09T10:53:46.193Z
2014-12-09T10:53:46.193Z
T9b
<p>I am using the BitcoinJ API to create my wallet.
When I create a transaction, I provide the change address to which change should be sent.
For example: let there be 1 bitcoin at address A;
then I create a transaction to send 0.1 bitcoins to address B and the change (0.9 bitcoins) back to address A.</p>

<p>In the BitcoinJ wallet, I see that the change (0.9 bitcoins) is not received back. To try to fix that, I created a custom coin selector to explicitly select unconfirmed transactions which are generated by myself---but still I do not see the change (0.9 bitcoins) in my wallet.</p>

<p>This is the transaction view <a href="https://www.biteasy.com/testnet/transactions/db66d5058e5773f353447ffa2174a417867e9aa134113f01359576f5e6f2b4c6" rel="nofollow">https://www.biteasy.com/testnet/transactions/db66d5058e5773f353447ffa2174a417867e9aa134113f01359576f5e6f2b4c6</a></p>

<p>And this is my wallet <a href="https://www.biteasy.com/testnet/addresses/mnj3589DHMoCyhxDSvWKubjkUoTenmrGkE" rel="nofollow">https://www.biteasy.com/testnet/addresses/mnj3589DHMoCyhxDSvWKubjkUoTenmrGkE</a>.</p>

<p>According to my address on Biteasy, there is a balance of 4BTC,
but my BitcoinJ wallet shows only 0.069BTC</p>

<p>Now my question is: Why can't I send return change to same address it is being sent from?</p>

<client><address><development><bitcoinj><change>
Sending bitcoins to same address
Deepak Agrawal
# Sending bitcoins to same address

(Asked by: username_0 on 2014-12-07)

I am using the BitcoinJ API to create my wallet.
When I create a transaction, I provide the change address to which change should be sent.
For example: let there be 1 bitcoin at address A;
then I create a transaction to send 0.1 bitcoins to address B and the change (0.9 bitcoins) back to address A.

In the BitcoinJ wallet, I see that the change (0.9 bitcoins) is not received back. To try to fix that, I created a custom coin selector to explicitly select unconfirmed transactions which are generated by myself---but still I do not see the change (0.9 bitcoins) in my wallet.

This is the transaction view <https://www.biteasy.com/testnet/transactions/db66d5058e5773f353447ffa2174a417867e9aa134113f01359576f5e6f2b4c6>

And this is my wallet <https://www.biteasy.com/testnet/addresses/mnj3589DHMoCyhxDSvWKubjkUoTenmrGkE>.

According to my address on Biteasy, there is a balance of 4BTC,
but my BitcoinJ wallet shows only 0.069BTC

Now my question is: Why can't I send return change to same address it is being sent from?

**Tags:** client, address, development, bitcoinj, change


---

## 1 answers

### Answer by username_1 on 2014-12-09. Score: 5

You can send bitcoins to the same address you are sending from, if you create a raw transaction manually, or if you use a wallet that does not create a new change address each time a transaction is made.

One reason why this new address process exists is to protect privacy. If you consider that the outputs of a transaction with change, where one of the outputs points back to itself, you will immediately be able to determine how much you paid, and factually, that you paid that amount to someone else, keeping the change.

If on the other had a different address is used for change, an independent observer cannot determine which of the two amounts was change and which was the payment.

However what I suspect you are doing is the classic mistake of thinking that the difference between what you are paying to the other address and what was in the originating address is automatically sent back to you.

I cannot emphasize this enough - the difference is sent to the miner as a mining fee. You have in effect not explicitly told the transaction what to do with the difference and it is therefore assumed that this is a fee that you are paying, and is collected by the miner who mines the block containing your transaction.

In order to avoid this, each transaction must have a minimum of two explicit payments, and one implicit payment:

* Input amount
* Payment to address 1 (must be less than input)
* Payment to address 2 (must be change minus the fee that you want to pay)

The input must be explicitly greater than the sum of payment 1 and 2, and anything left over is implicitly the miners fee


---

