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
By setting the environment variable
UNLOCK
with yourpython-steem
wallet password, you can avoid unlocking logic or pw handling in your code.Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you very much for your advice. :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This is great. Unfortunately, I know nothing about python all the codes is talking about. Sorry I'm ignorant.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Can you add as many times as you like or would that be pointless?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I think I need to learn this python thing.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
一起学习。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I love Python my current fav comp language easy to learn the basics too. Might even do a free course on it .
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
wow really good post!! thank you
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
You are welcome:)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Was wondering about this, and bingo... it's answered. Thanks.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
any ideas? I get this error when installing steem
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
you need to install 'libssl-dev'
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thanks for making this guide. :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank your work
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit