How does the Coin Selection in Bitcoin Wallet for Android work?

2

1

What is the algorithm in Bitcoin Wallet for Android to select the inputs to create a new transaction?

Murch

Posted 2016-07-02T14:58:52.323

Reputation: 41 609

Answers

2

It appears that Bitcoin Wallet for Android uses the DefaultCoinSelector from bitcoinj.

The DefaultCoinSelector sorts the available UTXO by diminishing age and value:

value [satoshi] * age [confirmations]

Should two UTXO compare as equal, larger value is preferred.

The CoinSelection then picks from the front until the target is reached.


Still trying to figure out whether I understood this correctly:
If the resulting change is large enough to pay for the fee and remain above dust level, the transaction goes ahead.
Else, change will be increased by 0.01 BTC. If it satisfies neither option, the change will be added to the fee.

Murch

Posted 2016-07-02T14:58:52.323

Reputation: 41 609