I was wondering how bitcoin clients (and bitcoin-qt in particular) select inputs for transactions. Are they selected by age (oldest/newest first), to minimize the number of inputs, to minimize the change output, or some other criteria?
Just curious.
The algorithm for the client generally aims to come up with the combination of coins that results in the least amount of change.
There are some factors also taking into account. If the coins haven't confirmed yet, they will not be automatically chosen.
But after a short while, the age of the coins is no longer a factor.
Use the oldest first might give away information and thus take from Bitcoin's privacy, so the "minimize change" is essentially the only goal when choosing which coins to spend.