Bitcoin Forum
May 09, 2024, 09:54:06 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Consistent output precedence for tx's from a single address?  (Read 1139 times)
Carlton Banks (OP)
Legendary
*
Offline Offline

Activity: 3430
Merit: 3074



View Profile
June 14, 2014, 09:54:03 PM
Last edit: June 15, 2014, 01:13:14 PM by Carlton Banks
 #1

I think everyone mining is probably familiar with this: do multiple outputs get chosen in a predictable order when spent from a single address? If yes, what's the order? Reverse date order? (i.e. highest priority first)

Vires in numeris
1715248446
Hero Member
*
Offline Offline

Posts: 1715248446

View Profile Personal Message (Offline)

Ignore
1715248446
Reply with quote  #2

1715248446
Report to moderator
1715248446
Hero Member
*
Offline Offline

Posts: 1715248446

View Profile Personal Message (Offline)

Ignore
1715248446
Reply with quote  #2

1715248446
Report to moderator
In order to get the maximum amount of activity points possible, you just need to post once per day on average. Skipping days is OK as long as you maintain the average.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
etotheipi
Legendary
*
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
June 15, 2014, 03:53:35 PM
 #2

I think everyone mining is probably familiar with this: do multiple outputs get chosen in a predictable order when spent from a single address? If yes, what's the order? Reverse date order? (i.e. highest priority first)

It's complicated.  There is some randomness involved in Armory's algorithm, but it's usually unnecessary.  I've written a detailed description of it before, and you can traverse the code for it starting here:

https://github.com/etotheipi/BitcoinArmory/blob/master/armoryengine/CoinSelection.py#L582

The gist of it is that we create a pool of coin-selection solutions, and then score each solution based on a variety of factors, such as "output anonymity," tx size, spending zero-conf, and most importantly -- number of input addresses linked.  The coin-selection solution with the highest score from that function is what is used:

https://github.com/etotheipi/BitcoinArmory/blob/master/armoryengine/CoinSelection.py#L358

The pool of coin-selections is created by doing a bunch of different sortings of the UTXOs.  Some by straight priority, some by modified "priority", some even have a few random solutions in them.   Then we pop off the highest sorted UTXOs until we have a candidate that is close to exactly the output amount, and one aiming for 2x (so that both output sizes are approx the same, if there is change).   Those two candidates are added to the pool to be ranked.

The process ends up with about 20 solutions, ranks all of them, and then uses the one with the highest score.   Typically, the solutions use the UTXOs with the highest priority.  Some of the sortings guarantee that coins from the same address are near each other and thus will typically use multiple inputs from a single address.

So the answer to your question is basically that it's not consistent, but there is a strong preference for using older UTXOs before newer ones.  You're also not guaranteed to use coins from the same address, though it is likely to happen due to the ranking system, which will give a higher score to solutions that have less unique input addresses. 


Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
Carlton Banks (OP)
Legendary
*
Offline Offline

Activity: 3430
Merit: 3074



View Profile
June 15, 2014, 04:23:40 PM
 #3

ok. So if I choose an amount, say, consistent with the sum of the 3 oldest outputs (fee inclusive) at an address with 100 outputs, and use Coin Control mode to use only the address that contains those outputs, will the algorithm choose those 3? This is an address with outputs all of somewhat different sizes (as is typical of mining addresses), so it's not likely that there will be any other combination of outputs that will have the same sum as the oldest 3.

If not, when can we expect to see coin control that allows control of output selection? It seems odd that coin control is currently an expert feature, when everyone ought to be paying some attention to the issue. I'd see output specific coin control as an expert feature, as only merchants, power users and miners are ever likely to need/want it.

Vires in numeris
etotheipi
Legendary
*
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
June 15, 2014, 04:28:06 PM
 #4

ok. So if I choose an amount, say, consistent with the sum of the 3 oldest outputs (fee inclusive) at an address with 100 outputs, and use Coin Control mode to use only the address that contains those outputs, will the algorithm choose those 3? This is an address with outputs all of somewhat different sizes (as is typical of mining addresses), so it's not likely that there will be any other combination of outputs that will have the same sum as the oldest 3.

If not, when can we expect to see coin control that allows control of output selection? It seems odd that coin control is currently an expert feature, when everyone ought to be paying some attention to the issue. I'd see output specific coin control as an expert feature, as only merchants, power users and miners are ever likely to need it.

If you use coin control and only select a few addresses with lots of outputs, you are most likely to spend them oldest-first.  I had been meaning to update the coin-control dialog to use a proper table instead of its current design, and along the way I would have it show individual UTXOs, not just addresses.  But that hasn't been a priority.

As for being an expert feature... no matter how you look at it, this is still not something that "regular" users use, care about or even understand.  Should they?  Maybe in a perfect world everyone would study Bitcoin and understand how to optimize their privacy, etc.  But the vast majority don't and the feature would just confuse them.

Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
Carlton Banks (OP)
Legendary
*
Offline Offline

Activity: 3430
Merit: 3074



View Profile
June 15, 2014, 07:11:06 PM
 #5

Yes, perhaps it will always be considered an advanced feature. I just think it would be a shame if a typical Armory user didn't get exposed to the option, and for their imagination to be sparked into learning why it makes a difference.

Oh, and if/when you get to the stage where you do redesign coin control to select outputs, there is a useful little feature you could borrow from the core client : the kb size of the outputs (both individual & cumulative).

Vires in numeris
Carlton Banks (OP)
Legendary
*
Offline Offline

Activity: 3430
Merit: 3074



View Profile
July 19, 2014, 09:33:54 PM
 #6

Ok. Just tested this out, and the result is not what I expected.

One address, containing dozens of mining outputs. The first 3 outputs received were small (<0.02 BTC). Every output received after that is > 0.1 BTC. Worked out the total of the first 3 small outputs, then used coin control to limit the tx to only the address in question. Created an unsigned tx. The output selection logic, for some reason, picked outputs that did not include the first 3 small outputs I was trying to force it into picking. It went for the first > 0.1 output that was received immediately after them.

I think that output granular coin control feature would be my top choice for new features in 0.93!  Smiley

Vires in numeris
PRab
Member
**
Offline Offline

Activity: 98
Merit: 10


View Profile
July 19, 2014, 10:35:36 PM
 #7

I'm just curious why you care which UTXO is used. To me this is the same as opening up your (non-bitcoin) wallet and spending extra time deciding exactly which $20 bill you want to use to pay for something. I understand that sometimes its nice to really dig into the guts of a protocol to understand how it works, but for that I would tend to use the bitcoind rpc methods instead of Armory.

What are you trying to accomplish by picking a specific UTXO(s)?
Carlton Banks (OP)
Legendary
*
Offline Offline

Activity: 3430
Merit: 3074



View Profile
July 19, 2014, 11:10:32 PM
 #8

2 reasons, mining specific housekeeping, and spam dust.

One mining address can end up with dozens of outputs, this can make spending from the address really expensive if you're using anything more than a small part of the amount in the address. Cleaning it up by aggragating the small ouputs together and sending them to separate addresses can give you more usable output sizes.

Isolating spam dust and sending it to a dust recycler is probably the best way to use the stuff. Or maybe you might want to keep the spam output and never spend it. Either way, you've got to be able to select the outputs manually.


Vires in numeris
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!