Ericet

Posted on Jul 16, 2022Read on Mirror.xyz

Teritori自动复投脚本

跑Cosmos生态的测试网节点,很多时候为了让节点保持活跃,大家火拼测试币的数量

除了水水龙头获得测试币之外,活跃验证人的节点奖励也是一个大头,如果可以自动复投节点奖励,将让你在拼测试币上获得先机

这里附上Teritori测试网的复投脚本(Cosmos生态其他的节点基本差不多,需要改几个参数就可以用)

#!/bin/bash
GREEN_COLOR='\033[0;32m'
RED_COLOR='\033[0;31m'
WITHOUT_COLOR='\033[0m'
DELEGATOR_ADDRESS='钱包地址'
VALIDATOR_ADDRESS='验证人地址'
ACC_NAME='钱包名' 
PWD='钱包密码'
DELAY=1800 #in secs — how often restart the script
NODE="tcp://localhost:26657" #change it only if you use another rpc port of your node
CHAIN_NAME="teritori-testnet-v2"
for (( ;; )); do
echo -e "Getting Rewards..."
echo -e "${PWD}\ny\n" | teritorid tx distribution withdraw-rewards ${VALIDATOR_ADDRESS}  --chain-id ${CHAIN_NAME} --from ${DELEGATOR_ADDRESS} --gas=200000 --commission --yes
for (( timer=30; timer>0; timer-- ))
do
printf "* sleep for ${RED_COLOR}%02d${WITHOUT_COLOR} sec\r" $timer
sleep 1
done
BAL=$(teritorid q bank balances ${DELEGATOR_ADDRESS} --node ${NODE} -o json | jq -r '.balances | .[].amount');
echo -e "Balance:${BAL}\n"
echo -e "BALANCE: ${GREEN_COLOR}${BAL}${WITHOUT_COLOR} utori\n"
echo -e "Stake ALL\n"
if (( BAL > 0 )); then
echo -e "${PWD}\n${PWD}\n" | teritorid tx staking delegate ${VALIDATOR_ADDRESS} ${BAL}utori --from ${DELEGATOR_ADDRESS} --gas=200000 --chain-id ${CHAIN_NAME} --yes
else
echo -e "BALANCE: ${GREEN_COLOR}${BAL}${WITHOUT_COLOR} utori BAL < 0 \n"
fi
for (( timer=${DELAY}; timer>0; timer--))
do
printf "* sleep for ${RED_COLOR}%02d${WITHOUT_COLOR} sec\r" $timer
sleep 1
done
done

需要自己填入“钱包地址", "验证人地址” 和 “钱包密码“

这个脚本设置每1800秒(30分钟)自动领取收益并质押

由于Teritori链可以无手续操作,所以这个时间随便设置,反正没有手续费

image.png