17

I'm interested in improving Coin Selection for Bitcoin, and I saw that the wallet implementation has significantly changed in Monero compared to Bitcoin. I was wondering whether the Coin Selection algorithm has also been changed.

When creating a transaction in Bitmonero, what is the algorithm used to determine which unspent outputs will be used as inputs?

Does the client consider the resulting transaction size, transaction fees, and global UTXO Set growth in its selection?

Does the client make any attempt to optimize which 'coins' are used based on minimizing the transaction size, the resulting fragmentation, or the 'age' of the coins (value/transactions) used as the source?

11

The coin selection in Monero is very simple and naive, so I'm afraid you're not going to find much to take inspiration from.

Currently, the selection is random, with an equiprobable distribution.

There is a patch that will be merged along with RingCT (https://github.com/moneromooo-monero/bitmonero/commit/90fb5e411307a949779c65a1931f3462ee3a564d) which improves this, but only to avoid correlation attacks on the inputs.

As such, there is no attempt made to favor small fees, or transaction size, or number of outputs.

Fees are per kB in Monero, so small fees and transaction size are the same metric (down to quantization at 1 kB). Once Ring CT is merged, each transaction will typically have two outputs, growing the TXO set by the same amount. The vast majority of outputs on the blockchain are not known to be spent/unspent, due to the use of ring signatures (but this does not hold for dust, which is typically consolidated at mixin 0), therefore using up many inputs does not actually decrease the TXO set (and this is why it's a TXO set and not a UTXO set).

Additionally, and I add this since you're using "changed [...] compared to Bitcoin" wording: Monero is not a Bitcoin clone. It is a Bytecoin clone. So the algorithm hasn't really changed, it's just a new one. Not sure if you know this or not, but I thought it worth a mention.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.