<blockquote>
<p>In the attached example, can the change address be identified with 100% certainty?</p>
</blockquote>
<p>No.</p>
<blockquote>
<p>Is there a potential scenerio where it could be the first one, and a potential where it could be the second (without knowing more details about who sent it, what wallet they used etc).</p>
</blockquote>
<p>Yes.</p>
<p>There are a lot of heuristics that can be used to determine which output is the change output. However there are also a lot of ways that wallets can combat this. Without having the wallet that created the transaction, it is impossible to know with 100% certainty which is the change address.</p>
<blockquote>
<p>(ie the odds are overwhelming that it is the 2nd smaller amount for example)</p>
</blockquote>
<p>In your example, you use what is referred to as the unnecessary input heuristic. This heuristic relies on the assumption that a wallet is not going to include extra inputs to make a payment that could be covered by fewer inputs. Because the second output in your example is smaller than any one of the inputs, if it were the payment, then the transaction has an unnecessary input so it is likely that output is not the payment.</p>
<p>But wallet developers know that this is a heuristic used to determine change. So some wallets actually do exactly what this heuristic assumes to be false. Such wallets will sometimes make a change output that is greater than the payment amount. This breaks the heuristic.</p>
<p>There are a number of other techniques that can be used to determine which output is change, but each heuristic relies on an assumption that wallet developers can also break.</p>

CC BY-SA 4.0
2022-08-14T14:06:19.053Z
Thanks man appreciate it!
doug
CC BY-SA 4.0
2022-08-13T23:03:25.107Z
2022-08-13T23:03:25.107Z
Ava Chow
<blockquote>
<p>In the attached example, can the change address be identified with 100% certainty?</p>
</blockquote>
<p>No. Unless a transaction sends change back to the input address, you can never be 100% certain what the change output is. There are heuristics that can suggest which output is more likely, but wallet developers know about these heuristics and can actively work against them.</p>
<p>In your specific example, one heuristic to determine the change output is looking at script types. The transaction spends two P2WPKH inputs and creates one P2WPKH output and one P2SH output. Since wallets often work with only one script type, this suggests the P2SH output belongs to the recipient. But again, some wallets break this heuristic by randomly sending change to a different script type.</p>
<p>There's also the unnecessary input heuristic, which is discussed in <a href="https://bitcoin.stackexchange.com/a/114877/121614">Andrew Chow's answer</a>.</p>

CC BY-SA 4.0
2022-08-14T14:06:29.707Z
cheers mate appreciate the response
doug
CC BY-SA 4.0
2022-08-14T13:21:40.423Z
2022-08-14T13:21:40.423Z
Vojtěch Strnad
<p>hoping to gain a bit more clarity on how change addresses work here.
In the attached example, can the change address be identified with 100% certainty? Is there a potential scenerio where it could be the first one, and a potential where it could be the second (without knowing more details about who sent it, what wallet they used etc). I see some people say you can't be certain, but in most cases it seems fairly obvious (ie the odds are overwhelming that it is the 2nd smaller amount for example)
Thanks!</p>
<p><a href="https://www.blockchain.com/btc/tx/90cb1a71128bda33b00d9008b08ec6cfd3ea8f9868753e038a8b719c6b97f9c1" rel="nofollow noreferrer">https://www.blockchain.com/btc/tx/90cb1a71128bda33b00d9008b08ec6cfd3ea8f9868753e038a8b719c6b97f9c1</a></p>

<privacy><address-generation><change>
Determining change address
doug
# Determining change address

(Asked by: username_0 on 2022-08-13)

hoping to gain a bit more clarity on how change addresses work here.
In the attached example, can the change address be identified with 100% certainty? Is there a potential scenerio where it could be the first one, and a potential where it could be the second (without knowing more details about who sent it, what wallet they used etc). I see some people say you can't be certain, but in most cases it seems fairly obvious (ie the odds are overwhelming that it is the 2nd smaller amount for example)
Thanks!

<https://www.blockchain.com/btc/tx/90cb1a71128bda33b00d9008b08ec6cfd3ea8f9868753e038a8b719c6b97f9c1>

**Tags:** privacy, address-generation, change


---

## 2 answers

### Answer by username_1 on 2022-08-13. Score: 3

> In the attached example, can the change address be identified with 100% certainty?

No.

> Is there a potential scenerio where it could be the first one, and a potential where it could be the second (without knowing more details about who sent it, what wallet they used etc).

Yes.

There are a lot of heuristics that can be used to determine which output is the change output. However there are also a lot of ways that wallets can combat this. Without having the wallet that created the transaction, it is impossible to know with 100% certainty which is the change address.

> (ie the odds are overwhelming that it is the 2nd smaller amount for example)

In your example, you use what is referred to as the unnecessary input heuristic. This heuristic relies on the assumption that a wallet is not going to include extra inputs to make a payment that could be covered by fewer inputs. Because the second output in your example is smaller than any one of the inputs, if it were the payment, then the transaction has an unnecessary input so it is likely that output is not the payment.

But wallet developers know that this is a heuristic used to determine change. So some wallets actually do exactly what this heuristic assumes to be false. Such wallets will sometimes make a change output that is greater than the payment amount. This breaks the heuristic.

There are a number of other techniques that can be used to determine which output is change, but each heuristic relies on an assumption that wallet developers can also break.

> **Comments:**
> **username_0**: Thanks man appreciate it!  

---

### Answer by username_2 on 2022-08-14. Score: 1

> In the attached example, can the change address be identified with 100% certainty?

No. Unless a transaction sends change back to the input address, you can never be 100% certain what the change output is. There are heuristics that can suggest which output is more likely, but wallet developers know about these heuristics and can actively work against them.

In your specific example, one heuristic to determine the change output is looking at script types. The transaction spends two P2WPKH inputs and creates one P2WPKH output and one P2SH output. Since wallets often work with only one script type, this suggests the P2SH output belongs to the recipient. But again, some wallets break this heuristic by randomly sending change to a different script type.

There's also the unnecessary input heuristic, which is discussed in [Andrew username_1's answer](https://bitcoin.stackexchange.com/a/114877/121614).

> **Comments:**
> **username_0**: cheers mate appreciate the response  

---

