About REDEEM REWARDS
Some people may notice that there's one new option in the wallet: REDEEM REWARDS (TRANSFER TO BALANCE)
since the 0.18 HF.
Which means that we need to claim our rewards (curation rewards and author rewards) manually time to time, otherwise the rewards will be kept separate from balance.
This is a very annoying thing for OCD patients (such as me).
So I tried to use the program to process it automatically, finally I realized this goal.
Now, let me share it with you.
Install Python STEEM library
First, install the official STEEM library for Python
pip install -U steem
(Note: steem-python requires Python 3.5 or higher)
Find & Import posting private key
Find out the posting (private) key for your steemit account
You can get it at steemit.com Wallet-> Permissions->POSTING after login.
(Click theSHOW PRIVATE KEY
button to show private key)Add the private key to the local wallet :
Run following command in terminal
steempy addkey --unsafe-import-key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
( Note: replace the xxxxxx with your posting private key )Find & Import posting private key for other users
If you want to claim rewards for multiple accounts, you need toFind & Import posting private key
for each account.
Just repeat theStep 1
&Step 2
to do it.
The script
Here is the simple script to claim(redeem) your rewards.
You can save it as claim_rewards.py
Add execution permissions for it.
chmod u+x claim_rewards.py
#!/usr/bin/env python
import sys
import datetime
from steem import Steem
node = 'https://steemd.steemit.com'
password = 'yourwalletpasswd'
userlist = {'chinadaily', 'otheruser1', 'otheruser2', 'otheruser3'}
def reclaim(steem, user):
try:
user_info = steem.get_account(user)
reward_sbd = float(user_info['reward_sbd_balance'].split(' ')[0])
reward_steem= float(user_info['reward_steem_balance'].split(' ')[0])
reward_vesting = float(user_info['reward_vesting_balance'].split(' ')[0])
reward_sp = float(user_info['reward_vesting_steem'].split(' ')[0])
if reward_sbd > 0 or reward_steem > 0 or reward_vesting > 0:
steem.claim_reward_balance(account = user)
print("{user} Claim rewards: {0} STEEM {1} SBD {2} STEEM POWER".format(reward_steem, reward_sbd, reward_sp, user = user))
else:
print("No rewards need to be claim")
except:
print("Error occured!")
def main(argv=None):
steem=Steem(node = node)
steem.wallet.unlock(pwd = password)
print(datetime.datetime.now())
for user in userlist:
reclaim(steem, user)
if __name__ == "__main__":
sys.exit(main())
Claim(redeem) your rewards by command
After config the right wallet password and the user list, Now you can claim(redeem) your rewards by run command manually.
In terminal, run ./claim_rewards.py
Here are the sample results I got
2017-05-12 19:07:30.634529
user1 Claim rewards: 0.0 STEEM 0.0 SBD 0.001 STEEM POWER
user2 Claim rewards: 0.0 STEEM 0.0 SBD 0.024 STEEM POWER
user3 Claim rewards: 0.0 STEEM 0.0 SBD 0.016 STEEM POWER
chinadaily Claim rewards: 0.0 STEEM 0.0 SBD 0.016 STEEM POWER
Run script automatically
To claim(redeem) your rewards automatically is very easy.
Add the script to cron, and it will be executed at your settings interval.
For example:
crontab -e
Add the following line and save:
0 0 * * * /path/claim_rewards.py >>log.txt 2>&1
Then the script will be executed at 00:00 every day.
You can find more details about crontab by man crontab
That's all, Thank you.
© @chinadaily