How to claim your rewards automatically?

in #steemit • 7 years ago

Ways to claim rewards
Script with the official python library for STEEM
It's too complicated for me. 😭
Fortunately, the official python library for STEEM did a lot of work for us, such as to fill out this structure, to make a transaction structure and to sign the translation with your posting private key, and to broadcast it.

All we need to do is call the method claim_reward_balance of Steem Class.

A simplest script maybe like this:
#!/usr/bin/env python
from steem import Steem
steem=Steem()
steem.claim_reward_balance(account = 'oflyhigh')
Let me save it as claim_rewards_for_oflyhigh.py.
To run the above script, we MUST do following things first:

Install steem-python with pip
pip install -U steem

Get Posting private key
Get Posting private key from Wallet->Permissions->Show private key

Import Posting private key to local wallet
steempy addkey
Input private key and set password for local wallet (First time)

Set UNLOCK environment variable
UNLOCK=mysecretpassword

chmod u+x claim_rewards_for_oflyhigh.py

Run the script automatically
You can add this script to cron job to let it run automatically at specified intervals.
crontab -e
0 0 * * * /path/claim_rewards_for_oflyhigh.py >>log.txt 2>&1

Then the script will be executed at 00:00 every day.
More details about crontab can be found by man crontab.

To claim rewards for multiple accounts is just as easy.
Create scripts for each account, and then setup cron job for each file. The benefit is that you can set different intervals for different users.

If you want to claim rewards for multiple account with same same interval, Place users in a list and then iterate through them may be the better way.