An auto-compound repository is a software project that enables validators to automatically accumulate rewards. Validators are individuals or entities that contribute computing power to maintain the security and integrity of a blockchain network. In return for their service, validators receive rewards in the form of cryptocurrency.
An auto-compound repository provides a convenient and efficient way for validators to maximize their earnings in a DeFi network. By automating the process of reinvesting rewards, validators can achieve exponential growth in their cryptocurrency holdings, while minimizing the amount of time and effort required to manage their investments.
Generate a new hot wallet you will use to automatically carry out the staking transactions. The mnemonic will need to be provided to the script so use a dedicated wallet and only keep enough funds for transaction fees.
git clone https://github.com/Yummy-Capital/auto-compound
cd auto-compound
npm install
npm run buildGrant authorization to withdraw validator commission:
~/chain-maind tx authz grant <grantee> generic \
--allowed-validators <validator> \
--msg-type "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" \
--from <granter> \
--gas 100000 \
--gas-prices 0.05basecro \
--chain-id crypto-org-chain-mainnet-1 \
--node https://rpc.mainnet.crypto.org:443Grant authorization to delegate:
~/chain-maind tx authz grant <grantee> delegate \
--allowed-validators <validator> \
--from <granter> \
--gas 100000 \
--gas-prices 0.05basecro \
--chain-id crypto-org-chain-mainnet-1 \
--node https://rpc.mainnet.crypto.org:443cp env/grant.sample.env env/grant.envPopulate your new grant.env file with your chain, grantee address, mnemonic and validator address.
npm run grantcp env/compound.sample.env env/compound.envPopulate your new compound.env file with your chain, delegator address, mnemonic and validator address.
npm run compoundYou can setup your script to run at the same time. Two methods are described below: using crontab or using systemd-timer.
In both cases, ensure your system time is correct and you know what time the script will run in UTC, as that will be required later. Both examples below are for run every hour.
Note: A helpful calculator for determining your auto-compound timer for crontab can be found here: https://crontab.guru/.
crontab -e
0 * * * * /bin/bash -c "cd /path/to/auto-compound && npm run compound" > ./auto-compound.log 2>&1Systemd-timer allows to run a one-off service with specified rules. This method is arguably preferable to Cron.
The unit file describes the application to run. We define a dependency with the timer with the Wants statement.
sudo nano /etc/systemd/system/auto-compound.service[Unit]
Description=auto-compound service
Wants=auto-compound.timer
[Service]
Type=oneshot
WorkingDirectory=/path/to/auto-compound
ExecStart=/usr/bin/npm run compound
[Install]
WantedBy=multi-user.targetThe timer file defines the rules for running the auto-compound service every hour. All rules are described in the systemd documentation.
Note: Helpful calculator for determining auto-compound times for OnCalendar can also be found at https://crontab.guru/.
sudo nano /etc/systemd/system/auto-compound.timer[Unit]
Description=Auto-compound timer
[Timer]
AccuracySec=1min
OnCalendar=*-*-* *:00:00
[Install]
WantedBy=timers.targetsudo systemctl daemon-reload
sudo systemctl enable auto-compound.service
sudo systemctl enable auto-compound.timer
sudo systemctl start auto-compound.timersudo systemctl status auto-compound.timer
● auto-compound.timer - Auto-compound timer Loaded: loaded (/etc/systemd/system/auto-compound.timer; enabled; vendor preset: enabled) Active: active (waiting) since Mon 2023-03-20 01:51:48 UTC; 14s ago Trigger: Mon 2023-03-20 02:00:00 UTC; 7min left Triggers: ● auto-compound.service
sudo systemctl status auto-compound.service
● auto-compound.service - auto-compound service Loaded: loaded (/etc/systemd/system/auto-compound.service; enabled; vendor preset: enabled) Active: inactive (dead) TriggeredBy: ● auto-compound.timer