Bitcoin Forum
May 06, 2024, 12:28:55 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: TXs that include unnecessary UTXOs  (Read 219 times)
wayr (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 2


View Profile
October 19, 2019, 03:40:29 PM
Merited by LoyceV (1), ABCbits (1)
 #1

I'm hoping someone here can help explain why certain transactions seem to include unnecessary UTXO inputs. eg, if I have a UTXO of 0.08 BTC, and am making a purchase of 0.06 btc, I should not need any other inputs; it should be a single 0.08 BTC input with a 0.06 BTC output and 0.02 BTC change.  However, I will frequently see another input added, such that the amount of change frequently ends up larger than the size of the purchase.  Is there a reason this would happen?  All I can imagine is that it is done as some kind of camouflage (the change ends up being the larger amount, and so someone looking at it might not realize it is actually the change), or as a defense against dust/creating change addresses with dust in them.  Can anyone confirm, or provide a better explanation?  Thanks!
1714955335
Hero Member
*
Offline Offline

Posts: 1714955335

View Profile Personal Message (Offline)

Ignore
1714955335
Reply with quote  #2

1714955335
Report to moderator
1714955335
Hero Member
*
Offline Offline

Posts: 1714955335

View Profile Personal Message (Offline)

Ignore
1714955335
Reply with quote  #2

1714955335
Report to moderator
1714955335
Hero Member
*
Offline Offline

Posts: 1714955335

View Profile Personal Message (Offline)

Ignore
1714955335
Reply with quote  #2

1714955335
Report to moderator
The Bitcoin software, network, and concept is called "Bitcoin" with a capitalized "B". Bitcoin currency units are called "bitcoins" with a lowercase "b" -- this is often abbreviated BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714955335
Hero Member
*
Offline Offline

Posts: 1714955335

View Profile Personal Message (Offline)

Ignore
1714955335
Reply with quote  #2

1714955335
Report to moderator
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


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


View Profile
October 19, 2019, 03:49:53 PM
Merited by Jet Cash (2)
 #2

It's to save money on fees. Most wallets have an option somewhere that let's you decide whether to favour lower fees or privacy.

It always a good idea to consolidate all of your nonprivate inputs while you're not in a rush too... At the same time, most wallets let you decide which inputs you want to spend so you could spend just the 0.08 and all the other utxos will remain the same.

I think this also goes to reducing the size of the chain state for full nodes too as there's less data to hold if you have 2 utxos from 2-5+
khaled0111
Legendary
*
Offline Offline

Activity: 2520
Merit: 2853


Top Crypto Casino


View Profile WWW
October 19, 2019, 04:21:38 PM
Merited by ABCbits (1), hugeblack (1)
 #3

You should use a wallet that have coin control feature.
Some wallets, by default, will use the oldest UTXOs. If the oldest is smaller than the amount you want to spend then it will add the next one and so on.
Other wallets will pick UTXOs randomly for more privacy.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
ABCbits
Legendary
*
Offline Offline

Activity: 2870
Merit: 7464


Crypto Swap Exchange


View Profile
October 19, 2019, 07:09:39 PM
Merited by hugeblack (1)
 #4

Without knowing the wallet which used to create the transaction, we only can make educated guess.

IMO it's not privacy feature because :
1. If the output have "neat" number (such as 0.01BTC), while the change have "random" number (such as 0.039653241BTC), then it's easy to guess to guess which one is output and which one is change.
2. Few wallet applies multiple change address as method to improve user's privacy

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5588


Self-proclaimed Genius


View Profile
October 20, 2019, 01:27:07 AM
 #5

Was your example based from your experience?
Because usually, that only happens when the remaining amount from one input isn't enough for the fee.
But the example wont fall to that category, for a 0.08 UTXO & 0.06 to send, the change is quite too high for the tx fee.

If it's something like 0.005 UTXO and 0.00495 to send, the wallet might include one more input to the transaction.

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

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

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

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

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

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











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











▄▄▄▄█
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
October 31, 2019, 05:55:11 PM
 #6

It really comes down to a wallets "UTXO picker algorithm" and/or if the user is implementing manual coin-control.

Some wallets just use "oldest UTXO(s) first"... some use "least number of UTXO(s) required)" to keep transaction size to a minimum... some do all sorts of weird things in the name of "privacy"... some just include ALL UTXOs in a wallet in every transaction.

Then you have wallets like Bitcoin Core and Electrum that provide "coin-control" features that enable the user to pick and choose which UTXOs they want to include.

As ETFBitcoin stated above, without knowing the specific wallet you experienced this with, it is difficult to state with any confidence the reason why you witnessed this behaviour.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
October 31, 2019, 09:56:40 PM
Merited by Foxpup (5), LoyceV (4), HCP (4)
 #7

As mentioned, it all comes down to the coin selection algorithm. There are many different coin selection algorithms in use by a number of different wallets which optimize for different parameters. In general, coin selection is a hard problem to solve well.

In coin selection, there are a number of things that need to be considered. First and foremost, the amount being selected. Then it also needs to consider the fee and whether to optimize for a lower transaction. While it may seem obvious that you should optimize for a lower transaction fee, the behavior of the coin selection algorithm now effects how it performs in the future. It could work "well" in the short term be not in the long term. The algorithm also has to consider how large the change output will be, if it's too small, it may be unspendable in the future (it could be considered dust).

So for your specific question, it all really depends on the coin selection algorithm in use and what it is optimizing for. And some algorithms are implemented not because they are good, but because they are easy.

For example, your wallet could be using a first in, first out strategy (FIFO). This means the oldest coins are chosen first. So what could have happened is that 0.2 was first, and that's not enough for 0.6. Then it chooses the next oldest coin, which would be 0.8. It's now over the target value, and so 0.2 and 0.8 are the coins selected. A couple of wallets do actually use this naive strategy, and that could be why you see this behavior.

If you want to read an actual scientific analysis of coin selection strategies and how they perform, I would suggest that you read Mark Erhardt's master's thesis on this subject: http://murch.one/wp-content/uploads/2016/11/erhardt2016coinselection.pdf

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!