Author

Topic: Consistent output precedence for tx's from a single address? (Read 1171 times)

legendary
Activity: 3430
Merit: 3080
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.

member
Activity: 98
Merit: 10
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)?
legendary
Activity: 3430
Merit: 3080
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
legendary
Activity: 3430
Merit: 3080
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).
legendary
Activity: 1428
Merit: 1093
Core Armory Developer
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.
legendary
Activity: 3430
Merit: 3080
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.
legendary
Activity: 1428
Merit: 1093
Core Armory Developer
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. 

legendary
Activity: 3430
Merit: 3080
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)
Jump to: