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.Thank you very much for your advice. :)
This is great. Unfortunately, I know nothing about python all the codes is talking about. Sorry I'm ignorant.
Can you add as many times as you like or would that be pointless?
wow really good post!! thank you
You are welcome:)
I think I need to learn this python thing.
一起学习。
I love Python my current fav comp language easy to learn the basics too. Might even do a free course on it .
Was wondering about this, and bingo... it's answered. Thanks.
any ideas? I get this error when installing steem
scrypt-1.2.0/libcperciva/crypto/crypto_aes.c:6:25: fatal error: openssl/aes.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
you need to install 'libssl-dev'
Thanks for making this guide. :)
Thank your work
Thank you:)
那个是机器人自动回帖的。
不过确实写的不错。
谢谢大神点评:)
其实一直没搞懂为啥还要claim 一下
系统自动发放多好啊:)
但是既然研究不懂,就不深入研究了,自己自动发放
省得看着蓝字闹心
Cutie ^_^