Howto: Steemit Bot Tutorial For Newbies #1 - Votebot
This guide is meant to teach you, how to employ your own bot-agents for Steemit.
It's not the first guide of this kind ...
I will try to explain everything so that you need no prior experience at all.
All you need is a running version of Windows (maybe mac), an internet connection and some time.
In this first episode I will try to explain, how to employ a simple votebot, like in this guide by @xeroc
https://steemit.com/steem/@xeroc/upvote-bot-in-less-than-10-lines-of-code
I will not add anything to that script, but show how to actually run it on your computer at home.
I have written something similar on this blog before, but apparently failed to communicate, how really anybody can start developing with Python 3 and Piston.
Note:
Until some months ago, before I knew Steemit, I had been completely ignorant of Linux.
I was a Windows-user.
I also have very limited experience in programming.
This guide should work for most newbies.
For this guide I will use Ubuntu 16.04.1 in a virtual machine.
You will not need any prior experience with Linux, though.
Note: This is not the only way to do it and it might not be the easiest.
Because you can use Linux for other stuff too, I think it's a good way of introduction.
Step 1:
Environment
Download VMware Workstation and an Ubuntu 16.04.1 iso.
Install Ubuntu in a virtual machine.
This procedure is well documented all over the internet.
I just hope you can figure that out by searching the web.
If it all works right, you get to choose the virtual hardware for the machine.
I put it to:
- 1 Processor
- 2 Gig RAM
- 20 G HD
That should be sufficient.
It should then look like this:
This way, you have a nice development environment.
If anything was to go wrong, you could just kill the virtual machine and start over again.
Step 2:
Piston
Documentation for Piston:
https://piston.readthedocs.io/en/stable/
Open a terminal with ctrl
+alt
+T
.
Install Piston:
https://piston.readthedocs.io/en/stable/installation.html
It says this command will install piston:
pip3 install steem-piston
It will return an error:
The program 'pip3' is currently not installed [...]
This friendly message also tells us, how to fix it.
Type:
sudo apt install python3.pip
Confirm with your password.
Confirm with 'Y'.
Once that is done, retry
pip3 install steem-piston
It should work now - Yet, it doesn't.
Another friendly error message tells us what to do.
pip install --upgrade pip
This will cause another error message.
This one tells us to try this:
sudo apt install python-pip
Confirm with your password.
Confirm with 'Y'.
This still won't work.
This will fix it:
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
retry
pip3 install steem-piston
This should work, finally
piston --help
This should show you some of Piston's functions.
Some steps above were somewhat pointless, but this is the route I took.
This way it's reproducable at least ( I hope ).
Step 3
Python
We don't want to use Piston 'by hand' though - We want to automate it, right ?
You will need to create a new script.
gedit votebot.py
Will open an editor and a new file called 'votebot.py'.
This is my modified version of @xeroc 's example.
(I don't know how the environmental variables work)
from steem.steem import Steem
import os
import json
steem = Steem(wif="5yourpostingkeyhere")
authors = "felixxx", "deutschbot"
for c in steem.stream_comments():
if c["author"] in authors:
print(c.upvote(weight=100, voter="votebot"))
Important:
You will need to put your posting key into this script.
I don't know how safe this method is.
I can therefore NOT recommend it.
Use entirely at your own risk
Replace 5yourpostingkeyhere with your posting key.
Replace votebot with the account the above posting key belongs to.
After
authors =
replace the list of authors with your favourite authors. (Keep the format)
Save the file.
Step 4
Finished !
Run your script like this:
python3 votebot.py
This bot will crash after a while.
Also, it's very simple and will vote any of the authors' posts, even the comments.
In terms of value, I would not recommend this approach for voting.
This is meant for educational purpose, mainly.
In the next episode I will try to explain, how to modify the bot, to make it act a little smarter.
That will mostly be about Python.
Ultimately the goal is to educate the readers of these posts to come up with their own modifications.
I doubt it would hurt Steemit, if more people joined the bot-game.
Especially, if those bots did more than just voting anything from a list.
Please also keep in mind: For this to work 24/7, your computer will need to run 24/7.
I imagine this to be a very annoying solution for most users.
Please let me know, if this tutorial worked for you.
I hope, I didn't make any mistakes.
This guide is over a year old.
Here is the latest working update on it:
https://steemit.com/steem-python/@felixxx/how-to-really-install-steem-python-ubuntu-17-10
@felixxx once 17.10 is installed will the winfrey auto curation bot still work? I've been chasing this down for a few days now and I remember seeing somewhere that piston no longer works but I couldn't find the fate of the winfrey bot. Thanks for your contributions to the community.
It will need some tweaks, since some functions have changed from piston to steem-python.
Can you add this as part of your learn python series? Got my raspberry pi 3 ordered so I can start trying to tinker with things.
If you can install a Linux with Python 3.6 (or higher), my latest tutorial series should work for you.
Aye thanks man, this post was really useful. I'm working on a few bots now!
Thank you!!
Change the following line:
steem = Steem(wif="5yourpostingkeyhere")
to
steem = Steem(wif=os.environ['WIF_POSTING'])
Then, before you run the script, in the terminal, set the following environment variable:
export WIF_POSTING='5KDWWnSQiPtVhzCquaBWhbWS8UNoAkeNuuCm8uJJE6EiSqt514p'
(or whatever your WIF is, the above example is a worthless random key)
then run the script as normal. It will pick up the posting key from your
WIF_POSTING
environment variable. Now you can save your code on GitHub or wherever else safely. :)Actually, since the latest release of python-steem, the library also contains a wallet that can be managed through
piston
.Just import your keys with
and use
Since wif keys are stored encrypted, you will be asked to provide the password when voting. If you want to unlock the wallet from script, you can use the
UNLOCK
environmental variable:Thanks !
For the next episode I wanted to use a config file instead. :)
Hello @felixxx,
It gives us pleasure to inform you that you have been chosen as a featured author by the @robinhoodwhale initiative.
Learn more about the Robinhood Whale here!
We hope to see you continuing to post some great stuff on Steemit!
Good luck!
~RHW~
Thanks for sharing , I too must step out of the comfort of the windows dungeon at some point and explore the script world. I just bought a raspberry Pi for this pourpose but haven't had a chance to set it up as yet.
It's possible to run those Python scripts from Windows, too.
I hope this guide shows how quick and simple it can be.
It's more fun, when more people join.
so what if you have more than one votebot... does this work assuming they all have the same posting key?
print(c.upvote(weight=100, voter="votebot"))
print(c.upvote(weight=100, voter="votebot2"))
print(c.upvote(weight=100, voter="votebot3"))
if you had like 8000 votebots running like this, would that likely be prohibitively unstable?
When instanciating
Steem()
you can pass an array of wif keys:of you install the keys into the library-internal wallet using pison
then you don't need to deal with keys in the script at all but need to provide the masterpassword for the wallet either in the terminal-prompt, or in the environmental variable
UNLOCK
It would be better to put a multi select function that triggers votes from multiple bots in one. Each instance will be pulling the same data, it makes more sense to only do this once.
Yes if all the bots have the same key they can vote like you show.
Great post felixxx, I am looking forward to read more about it in the following episodes.
Thanks for posting this. I am looking forward to your next post. I have some questions but my guess is that the answers will be covered there :)
Hi felixxx, Could you make an update this instruction please?
Piston is not available on https://readthedocs.org/ anymore.
Thanks Buddy