Bitcoin Forum
May 01, 2024, 05:15:43 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to detect 'change' transactions  (Read 153 times)
satoci (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 6


View Profile
October 03, 2022, 12:37:16 PM
Merited by o_e_l_e_o (4), NotATether (2)
 #1

While trying to calculate some on-chain metrics, I stumbled upon a cornerstone case that I do not know how to handle. When spending a UTXO, the change will be returned to the person who initiated the transaction, but the address is different. For instance, I have a UTXO of 15 BTC and I want to send 1 BTC to person X. There will be two transactions, one for 1 BTC to that person and the rest minus the fee back to me under a new address. Is there a way to detect 'change' transactions' and if so, how? Thanks
1714583743
Hero Member
*
Offline Offline

Posts: 1714583743

View Profile Personal Message (Offline)

Ignore
1714583743
Reply with quote  #2

1714583743
Report to moderator
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714583743
Hero Member
*
Offline Offline

Posts: 1714583743

View Profile Personal Message (Offline)

Ignore
1714583743
Reply with quote  #2

1714583743
Report to moderator
1714583743
Hero Member
*
Offline Offline

Posts: 1714583743

View Profile Personal Message (Offline)

Ignore
1714583743
Reply with quote  #2

1714583743
Report to moderator
hosseinimr93
Legendary
*
Offline Offline

Activity: 2380
Merit: 5235



View Profile
October 03, 2022, 12:44:33 PM
Last edit: October 03, 2022, 01:28:33 PM by hosseinimr93
Merited by o_e_l_e_o (4), pooya87 (2), ABCbits (1)
 #2

For instance, I have a UTXO of 15 BTC and I want to send 1 BTC to person X. There will be two transactions, one for 1 BTC to that person and the rest minus the fee back to me under a new address.
There won't be two transactions. There will be a single transaction with two outputs.
One of the outputs will belong to the receiver and the other one will be the change.


Is there a way to detect 'change' transactions' and if so, how? Thanks
If you send round amounts, anyone looking at your transaction will probably think that the round amount belongs to the receiver and the other output is the change.
If you send exactly 1 BTC to someone and 14 BTC minus fee to your change address, it's almost obvious that each output is the change.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
October 03, 2022, 01:06:01 PM
 #3

I can't remember the name of the site fully but I think it was wallet explorer that tried joining addresses together for spv clients: https://www.walletexplorer.com

I think there might be ways this has been done with other places but blockchain.com removed there's because it seemed to get quite a lot of things wrong.

One way of seeing if an address was change would be to analyse what the wallet has done before or to pick and output you don't think is change (such as one that's not spent instantly if the person was paying an exchange/service/payment processor).
hosseinimr93
Legendary
*
Offline Offline

Activity: 2380
Merit: 5235



View Profile
October 03, 2022, 01:14:02 PM
Last edit: October 03, 2022, 01:29:53 PM by hosseinimr93
Merited by jackg (1)
 #4

I can't remember the name of the site fully but I think it was wallet explorer that tried joining addresses together for spv clients: https://www.walletexplorer.com
Wallet explorer put addresses in the same wallet if they are co-spent with each other.
For example, if you spend from addresses A and B in a transaction and spend from addresses B and C in another transaction, they conclude that addresses A, B and C belong to the same wallet.
That's all walletexplorer do.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2394
Merit: 5578


Self-proclaimed Genius


View Profile
October 03, 2022, 01:37:30 PM
Merited by o_e_l_e_o (4), NeuroticFish (2), pooya87 (2), ABCbits (2)
 #5

-snip- Is there a way to detect 'change' transactions' and if so, how? Thanks
There's no definitive way to detect which output (not another txn) is the change.
In the blockchain, the output for the change does not differ from the actual sent amount's output.
There's no label, mark or data that will tell that it's the change.

All you can do is to "guess" based from the common characteristics of a change output.
Example: https://en.bitcoin.it/wiki/Privacy#Change_address_detection
Take note that most privacy-oriented bitcoin users rarely make those mistakes.

Or pay for services that could do blockchain analysis reliably (but still not 100% accurate).

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18509


View Profile
October 03, 2022, 01:50:19 PM
 #6

Is there a way to detect 'change' transactions' and if so, how?
There are multiple ways to make an educated guess, but there are usually no ways to say definitively which output is change.

The most common is by looking at the address type. Most wallets send change back to the same address type as the outputs. So if I spend from a legacy address, the change will be sent back to a legacy address. If the other output is to a segwit address, then you can make an educated guess that the legacy output is the change. The next most common technique is looking at the value, as hosseinimr93 has said above. Payment amounts are more commonly a round value, say 0.001 BTC, while change amounts are more commonly made up of whatever is left over and so are not a round value, such as 0.0012918 BTC.

There are other more advanced techniques, such as looking for unnecessary inputs, looking at how the suspected change is later spent/consolidated, or looking at the some of the specifics of the transaction such as the sequence, locktime, or fee rate.

However, not only can you avoid all these things if you know what you are doing, but you can actively use them to specifically make your payment look like change and your change look like a payment.
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5818


not your keys, not your coins!


View Profile WWW
October 03, 2022, 11:56:13 PM
 #7

Payment amounts are more commonly a round value, say 0.001 BTC, while change amounts are more commonly made up of whatever is left over and so are not a round value, such as 0.0012918 BTC.
Are they, though? Most of the time when people use Bitcoin (i.e. for buying something), the fiat amount may be round (like $100 USD), which is equivalent to a non-round BTC value.
I guess you could improve 'change output detection' by checking the historical Bitcoin price at the time of the transaction and checking whether one of the 2 outputs has a round USD, EUR, CNY, ... value at that point in time.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18509


View Profile
October 04, 2022, 08:55:32 AM
Merited by n0nce (1)
 #8

Are they, though? Most of the time when people use Bitcoin (i.e. for buying something), the fiat amount may be round (like $100 USD), which is equivalent to a non-round BTC value.
If you are paying in a fiat-denominated value, then chances are both your outputs will be non-round numbers. If you are paying in a bitcoin-denominated value, then chances are the payment output will be round and the change output will be non-round. I'm not saying that every payment output is a round figure, only that round figures are more likely to be payments.

I guess you could improve 'change output detection' by checking the historical Bitcoin price at the time of the transaction and checking whether one of the 2 outputs has a round USD, EUR, CNY, ... value at that point in time.
It is very likely that blockchain analysis companies are already doing this. You can also do it yourself using blockchair, which appends the value in a fiat of your choosing at the time of the transaction to each input and output.
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!