!/bin/sh
curl -s -X POST http://127.0.0.1:33777/json_rpc -H 'Content-Type: application/json-rpc' -d '{"jsonrpc": "2.0", "method": "getAddresses", "password": "password", "params": {}, "id": "1"}' | jq '.result.addresses | .[]' | xargs -I ADDR curl -s -X POST http://127.0.0.1:33777/json_rpc -H 'Content-Type: application/json-rpc' -d '{"jsonrpc": "2.0", "method": "sendFusionTransaction", "password": "password", "params": {"addresses": ["ADDR"], "destinationAddress": "ADDR", "threshold" : 100000000, "anonymity": 0}, "id": "1"}'

This shell script gets list of subwallet addresses from wallet daemon and runs wallet optimization once for every subwallet. In two places the second "password" after : must be replaced with the real password, for example "password": "my_secret_password". If using custom port, replace 33777 with correct port in both places.

*/5 * * * * /root/optimize.sh > /dev/null 2>&1

If you save the script on top of the post as /root/optimize.sh and add above line in /root/crontab, and run crontab /root/crontab the script will be run every 5 minutes. All output from script will be discarded. 5 minute interval should be enough to optimize all the subwallets even if they are used for mining.

Published by Mika

Lead developer and team leader of Talleo Project