This wallet is used for withdrawing, as the number of withdraws increases, the num_unspent_outputs decreases to 1 in the end. This will cause the wallet to lock its whole balance for each transfer, which is very much undesirable. Why is this? I suspect the wallet is spending outputs in ascending order, that is spend smaller outputs first, so in the end, it will group all the balance into one output. Is there any setting to change this?
1 Answer
The monero wallet will try to use two inputs to each transaction, in an attempt to have most transactions look like each other (two inputs, and two outputs). Since in a typical transaction you will get one output back as change, it means that you spend two outputs, and get one in return (the second output going to whoever you're paying). Thus, over time, you will coalesce your own outputs, which leads to the problem you're describing.
There are two settings in monero-wallet-cli
which can control this and avoid coalescing outputs down to too few: min-outputs-count
and min-outputs-value
. They're viewable and settable using the set
command: just running set
will show all settings, including those.
Those settings control when a second output will be added onto your transactions when it is not necessary (ie, when it's just in an attempt to make your transaction look like a typical 2 -> 2 transaction). monero-wallet-cli
will only include such an output if it wouldn't cause the wallet to have less than min-outputs-count
outputs of value at least min-outputs-value
monero. Of course, if using two or more of your outputs if necessary to meet the payment+fee amount, this will be done regardless.
For example, you can run:
set min-outputs-count 5
set min-outputs-value 1
This will cause monero-wallet-cli
to try to use only one input for a transaction once you have only 5 outputs left over 1 monero.
-
monero-wallet-rpc will also obey those (they have to be set via monero-wallet-cli first though). Make sure you don't run both binaries on the same wallet at the same time. Commented Nov 30, 2017 at 18:56
-
if all the blance was aggregated into one output, can I split it by send to itself? say, it has 10000 XMR, send to it self, 2000, 3000, 4000, will split the 10000 output into 1000, 2000, 3000, 4000, four outputs? Commented Dec 5, 2017 at 8:41
-
Yes. Make sure the "merge-destinations" option is off in this case, that's its default value (see "set"). Commented Dec 5, 2017 at 9:55