WAX Technical How To #23

Ross Dold
EOSphere Blog

--

Providing services to the WAX ecosystem and being validated by the WAX Office of the Inspector General (OIG) qualifies your Guild to earn daily rewards. In order to receive these rewards a claim action needs to be executed using your producer account.

This daily action if manually executed can be quite tiresome and unreliable. Using a scheduled claim script with an associated claim permission is by far the most reliable and safest way to perform this action.

This guide will cover a simple a secure way to schedule a daily claim for your Guild producer rewards.

Schedule Guild Producer Reward Claims

This guide is an extension to WAX Technical How To #12 | WAX Account Custom Permissions and will use the same custom permissions structure.

Custom Permission :
waxclaimer

Permissioned Actions :
claimgbmprod (Block Production Rewards)
claimgbmvote (Voter Rewards)

A custom permission with specified authorised actions is used so that the claim script is securely limited and won’t need to use the account active permission allowing all actions such as token transfer etc.

Create and Schedule the Script

Firstly ensure you have the WAX Software cleos and keosd binary in the local path or claimer directory.

cleos is the command line interface for the WAX software and keosd is essentially a wallet / key manager service daemon for storing private keys and signing digital messages. You can find the WAX Software binary’s here: ~/wax-blockchain/build/programs/

The example bash script should be modified to use your created waxclaim wallet password and point to your preferred WAX API’s.

The script logs into the waxclaim wallet using keosd and then executes two actions with cleos using your preferred API’s, it then creates a log file.

Create your preferred directory structure, our example uses eosphere home:

$ cd ~

$ mkdir claimer

$ cd claimer

$ mkdir logs

Create the waxclaimer bash script as below:

$ nano waxclaimer.sh


#!/bin/sh

DATE=$(date +%Y%m%d%H%M%S)
LOGFILE="/home/eosphere/claimer/logs/claimrewards_$DATE.log"

# Kill keosd process if running
pkill keosd

# Check if keosd is running and start it if not
if ! pgrep keosd > /dev/null; then
echo "keosd not running - starting up now..." >> "$LOGFILE"
/home/eosphere/claimer/keosd --http-server-address 127.0.0.1:8900 & >> "$LOGFILE"
fi

# Unlock wallet
/home/eosphere/claimer/cleos wallet unlock -n waxclaim --password PW5JGHurUqfb2qf93Hynit3qFpkddiz6wpEWaWuqKTuGq5by4Fk7V >> "$LOGFILE"

# Claim rewards (3 API's listed for redundency)
echo "EOSphere" >> "$LOGFILE"
echo "Trying EOSphere" >> "$LOGFILE"

/home/eosphere/claimer/cleos -u https://wax.eosphere.io push action eosio claimgbmprod '{"owner":"eosphereiobp"}' -p eosphereiobp@waxclaimer >> "$LOGFILE"
/home/eosphere/claimer/cleos -u https://wax.eosphere.io push action eosio claimgbmvote '{"owner":"eosphereiobp"}' -p eosphereiobp@waxclaimer >> "$LOGFILE"

echo "EOSUSA" >> "$LOGFILE"
echo "Trying EOSUSA" >> "$LOGFILE"

/home/eosphere/claimer/cleos -u https://wax.eosusa.io push action eosio claimgbmprod '{"owner":"eosphereiobp"}' -p eosphereiobp@waxclaimer >> "$LOGFILE"
/home/eosphere/claimer/cleos -u https://wax.eosusa.io push action eosio claimgbmvote '{"owner":"eosphereiobp"}' -p eosphereiobp@waxclaimer >> "$LOGFILE"

echo "Aloha EOS" >> "$LOGFILE"
echo "Trying Aloha EOS" >> "$LOGFILE"

/home/eosphere/claimer/cleos -u https://api.wax.alohaeos.com push action eosio claimgbmprod '{"owner":"eosphereiobp"}' -p eosphereiobp@waxclaimer >> "$LOGFILE"
/home/eosphere/claimer/cleos -u https://api.wax.alohaeos.com push action eosio claimgbmvote '{"owner":"eosphereiobp"}' -p eosphereiobp@waxclaimer >> "$LOGFILE"

# Get balance
BALANCE=$(/home/eosphere/claimer/cleos -u https://wax.eosphere.io get currency balance eosio.token eosphereiobp)
echo "Balance: $BALANCE" >> "$LOGFILE"

--------------------------------------------------------------------------

Modify waxclaimer.sh to be executable and test

$ chmod +x waxclaimer.sh

$ ./waxclaimer.sh

If all appears to work the script can then be added to crontab, which is a list of commands that are scheduled to regularly run. Configure a suitable frequency to run the script. Rewards can only be claimed once per day so running once an hour is a good catch-all in our experience.

$ crontab -e

0 * * * * /home/eosphere/claimer/claimer.sh

Be sure to ask any questions in the EOSphere Telegram

EOSphere Guild is a Block Producer on the WAX Protocol Network as well as many other Antelope based Blockchains.

If you find our work helpful, please vote us on the WAX Mainnet: eosphereiobp

If you prefer to proxy your vote, our proxy account is : blklotusprxy

Connect with EOSphere via these channels:

TELEGRAM | MEDIUM |YOUTUBE | FACEBOOK | TWITTER | INSTAGRAM

--

--