Skip to content

Instantly share code, notes, and snippets.

@nckrtl
Last active January 8, 2019 03:53
Show Gist options
  • Save nckrtl/d05b7af24a72032ca83c33b26b312644 to your computer and use it in GitHub Desktop.
Save nckrtl/d05b7af24a72032ca83c33b26b312644 to your computer and use it in GitHub Desktop.
Auto delegate
echo "Enter your key password:"
read -s password
while true
do
amount_steak=$(gaiacli query account <comosaddr> --chain-id=9001 --trust-node=true | jq -r '.value.coins[0].amount')
if [[ $amount_steak > 0 && $amount_steak != "null" ]]; then
echo "About to stake ${amount_steak} steak"
echo "${password}" | gaiacli tx delegate --amount=${amount_steak}steak --from=crytter --validator=<cosmosvaloper> --chain-id=gaia-9001
fi
sleep 60
done
@nckrtl
Copy link
Author

nckrtl commented Nov 13, 2018

This script auto delegates unused steak in the account to a validator of your liking every 60 seconds.

Replace <cosmosaddr> and <cosmosvaloper> with your own values. Also make sure your using the correct chain-id

cosmosaddr can be found via gaiacli keys list and the cosmosvaloper can be found via gaiacli keys show <key_name> --bech=val

You can run the script with bash <scriptname>.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment