The Magic of Auto Combining Rewards

Masternodes 3 minutes, 28 seconds

There is a feature of the UCC Wallet that allows you to automatically combine your rewards as you receive them. Rather than a pile of small rewards, the wallet can be configured to check these amounts and automatically sweep them together, for each wallet address, up to the setting value.

The command to configure this is “autocombinerewards enable ( threshold ) ( frequency )” in the debug console; or using “autocombinerewards=” in your ucc.conf file, and will enable the feature (setting it in your configuration file will require you to restart your wallet to take effect). Periodically the wallet will look for 'dust' in your addresses, and combine them up to the number of coins set in the configuration setting. “Threshold” (the number of coins to combine) is only required when enabling the feature (setting the enable field to “true”). The default for frequency is every 15 blocks.

For example, if you have the "autocombinerewards true 6" set, then everytime the block height is a multiple of 15; any transactions less than 6 will be swept into a new transaction, repetitively until the combine threshold is exceeded. Once that threshold is exceeded, the grouping begins with another transaction.

This greatly helps prevent your wallet from getting into a situation where you exceed the max size of a transaction (see "Transaction too large"-Error when sending Coins). Instead of having to manually sweep your rewards daily to prevent the transaction too large threshold, you can use autocombinerewards to automatically sweep the dust together, and greatly reduce the amount of times you must sweep.

For example; with a limitation of 675 rewards in a single transaction; a single tier 1 masternode will exceed that many rewards in about 16 days. However with a threshold of 6, it will take almost 100 days, and over 4000 coins, before the threshold is exceeded. A threshold of 8 should insure that you will never end up with the transaction too large error as long as you sweep your rewards into a new masternode every time you reach 5000 extra coins.

There are also special features built into the feature; these are invoked with special cases using “0” for threshold and/or frequency”. When setting a threshold of “0”, this tells the wallet to sweep as many as possible into a single pile. A frequency of “0” tells the wallet to run it on the next block. Once it’s been run, it will be saved enabled, however be disabled; which means, the combine will run again whenever you restart your wallet. To turn it off, set “autocombinerewards false” in your console after the sweep is run.

These features become very useful when initially using autocombinerewards; or after a long time with your wallet disabled. For example, if you are running 10 light masternodes, and you have not started your wallet for over a month; you may have as much as 8000 UTXOs piled into your wallet, each with 0.12 UCC in each transaction. Combining these can become extremely complicated and tiresome. However, setting up this feature to run every 100 blocks, and combine the max: “autocombinerewards true 0 100”, will run it every 100 blocks, and after about a day, they will all be swept up into one big UTXO. If you would rather it combine it into eight 1000 UTXO chunks, you can do that too by setting the threshold to be 1000 instead of 0.

Some important things to note: auto combining does incur transaction fees; therefore a small fee will be incurred when it is run; so that should be taken into account when choosing your threshold. Also, the algorithm isn’t 100% to the threshold. It actually combines to 10% above the threshold; and then splits it into two outputs; one for 10% less, and one for the change less the fees. E.g. if you have the threshold set to 200, and you have six 40 UCC UTXOs, it will not run on the 5 UTXOs (totaling 200), but rather wait until the 6th UTXO is collected (totaling 240), and it will be combined into 216 (240 x .90) and the change being 23.9 ish (240 x .1 minus fees).