One thing that I hate in steemit is having to redeem my post/curation rewards manually. It's cool because you can see like "oh I earned x steems" But on the other hand, whenever I vote I have to check if I don't have a pending reward. Plus it's another thing that I have to do on my steemit account and I feel like it's kinda useless.
So with that in mind : automation !
We'll be using the piston steem library : Everything you need to know to make a steemit bot in python
installation
We'll need the piston library to interact with the steem blockchain :
(note that this tutorial is made for linux, if you're on windows, just skip the apt-get and you should be fine)
sudo apt-get install libffi-dev libssl-dev python-dev
sudo pip3 install piston-lib piston-cli
and you're done.
Get your active key
Be Very carefull as it's a key that can control your money.
Go to "wallet" then "permissions" and click on "login to show" and then the "show private key" button will appear next to "Active". Copy that.
Code
The code itself is very simple :
#!/usr/bin/env python3
from piston.steem import Steem
steem = Steem(wif='youractivekeyhere') # using default server
try :
steem.claim_reward_balance(account="youaccountnamehere")
except:
print("An error occured, You probably had no reward to redeem or it's too small")
Put that in a file, Fill the correct fields, execute that via python3 and witness the magic !
if you don't know how to execute a python script
Automation
Now we did that once, but how do we trigger our script daily or hourly ?
Cron on a Linux server/pc
The easiest and most reliable way to do that is to just use cron in a linux server.
Cron is simply a program that will run other programs at specified times.
You configure it by editing the crontabs, it's a file located in /etc/crontab
So we edit it with nano :
nano /etc/crontab
The crontab syntax is easy : each line is a new timed program. It can be configured to run program with a granularity of a minute all the way to a specific month. I won't cover it because there are already great articles on the subject.
eg : https://www.pantz.org/software/cron/croninfo.html
So we'll configure it to run at 8h30 (hour of the server) every day
30 8 * * * root /usr/bin/python3 /complete/path/to/the/post/redeemer.py
For instance if you know that your computer will be on very often at 22, configure cron to run the program at 22.
0 22 * * * root /usr/bin/python3 /complete/path/to/the/post/redeemer.py
This way your computer doesn't have to be on all the time but you'll still be fine :)
The pythonic way
If you don't want to rely on something like that you may want to rely on the pythonic way :
from piston.steem import Steem
import timesteem = Steem(wif='youractivekeyhere') # using default server
while True :
try :
steem.claim_reward_balance(account="youaccountnamehere")
except:
print("An error occured, You probably had no reward to redeem or it's too small")
time.sleep(86400) # 24 hours in seconds
But you have to trust that the program will run all the time without crashing. This can run on pretty much any system but it needs to be up 24/24 since the python program needs to be running 24/24. So don't use it on your home computer. A vps or a raspberry pi may be a good alternative :)
Pretty much anything
Yeah, pick your favorite thing that allows you to run a program every x hours and you'll be good to go. So if you're on windows, look up https://stackoverflow.com/questions/132971/what-is-the-windows-version-of-cron or if you really like python you would run https://github.com/kipe/pycron pycron which is basically a cron in python, so cross platform.
Conclusion
And that's it, get your active key, take the code, pick your favorite automation tool and you'll never have to click on that button ever again ! :D
Thanks for reading and if you have any questions don't hesitate to leave a comment.
Posted on Utopian.io - Rewarding Open Source Contributors
Another way to do this is simply using the reedem rewards @minnowbooster ability at minnowbooster.net
If you're wondering why the double post, this one is posted via utopian.io, I did not realize this would appear here.
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
So how does not redeeming your rewards affect your votes?
Suppose you have 100 sp, this is roughly 1 cent per upvote and it'll be like this even if you have 500 sp waiting to be redeemed. So your account is actually worth 600 sp but you vote only with the money that you have redeemed.
Oh, okay, makes sense. Guees I'll be using the tool soon! Thank you for your work @howo
You're welcome :) if you need direct help I'm on steemit.chat as well
Hey @howo I am @utopian-io. I have just super-voted you at 1.3% Power!
Suggestions https://utopian.io/rules
Achievements
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Hi,
You can find here as well, How to run python script