Skip to content

Instantly share code, notes, and snippets.

@darkerego
Last active April 6, 2022 20:21
Show Gist options
  • Save darkerego/3385acd2445a0eef2fed7ed2a563ddde to your computer and use it in GitHub Desktop.
Save darkerego/3385acd2445a0eef2fed7ed2a563ddde to your computer and use it in GitHub Desktop.
Eoseo Autoclaim
#!/bin/bash
########################################
# Eoseo AutoClaimer ~ Darkerego 2022 #
########################################
#
# Enviroment variables
NODEOSBINDIR="/opt/bin/bin"
WALLETHOST="127.0.0.1"
NODEHOST="127.0.0.1"
NODEPORT="8888"
WALLETPORT="3000"
LOGDIR='/home/eos/logs'
LOGFILE='autoclaim.log'
LOG="${LOGDIR}/${LOGFILE}"
now=$(echo "$(date)")
account="luminaryvisn"
permission="luminaryvisn@claimer"
wallet_pass="xxxx"
echo "Running autoclaim at $now ..." >> $LOG
# First, the wallet must be unlocked:
$NODEOSBINDIR/cleos -u http://$NODEHOST:$NODEPORT --wallet-url http://$WALLETHOST:$WALLETPORT wallet unlock --password $wallet_pass >> $LOG 2>&1
# Next, try to claim any pending vote rewards
$NODEOSBINDIR/cleos -u http://$NODEHOST:$NODEPORT --wallet-url http://$WALLETHOST:$WALLETPORT push transaction "{
\"delay_sec\": 0,
\"max_cpu_usage_ms\": 0,
\"actions\": [
{
\"account\": \"eosio\",
\"name\": \"voterclaim\",
\"data\": {
\"owner\": \"$account\"
},
\"authorization\": [
{
\"actor\": \"$account\",
\"permission\": \"owner\"
}
]
}
]
}" >> $LOG 2>&1
# Now try to claim any pending validator rewards
$NODEOSBINDIR/cleos -u http://$NODEHOST:$NODEPORT --wallet-url http://$WALLETHOST:$WALLETPORT system claimrewards $account -p $permission >> $LOG 2>&1
# Finally, lock the wallet again
$NODEOSBINDIR/cleos -u http://$NODEHOST:$NODEPORT --wallet-url http://$WALLETHOST:$WALLETPORT wallet lock >> $LOG 2>&1
echo "Finished." >> $LOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment