How to set up a curation bot on raspberry pi
Introduction
If you feel like trusting your keys to external sites is not a great way to curate content, I've got a 35 dollar lifetime solution for you. Not that many people know that steemit curation bots can even be built on your mobile phones, since singing transactions takes little to no computational power.
In this tutorial, I'll be showing you how to set up a curation bot on a small arm processor machine, that takes up little to no power, so you can run it with almost no running costs. The specific machine that I'm going to use is Raspberry Pi 2 Model B however the same process applies to any other Raspberry Pi models, Arduino, BeagleBone or any other device that can run linux.
Needed programs/files/accessories
Raspberry Pi - https://www.amazon.com/Raspberry-Pi-RASP-PI-3-Model-Motherboard/dp/B01CD5VC92
Wifi dongle - https://www.amazon.com/FotoFo-USB-WiFi-Adapter-Raspberry/dp/B01I191N48
Micro SD card - https://www.amazon.com/SanDisk-microSD-High-Capacity-microSDHC/dp/B00488G6P8
Micro SD card reader - https://www.amazon.com/IOGEAR-MicroSD-Reader-Writer-GFR204SD/dp/B0046TJG1U
A copy of raspian(any other linux based operating system will work as well) - https://www.raspberrypi.org/downloads/raspbian/
Make sure to download the pixel version.
If you have larger than 8gb sd card I'd reccommend Ubuntu mate located here - https://ubuntu-mate.org/raspberry-pi/
You might even consider rokos OS if you want to stake your favorite altcoins meantime - http://rokos.space/core.html
SDFormatter - https://www.sdcard.org/downloads/formatter_4/index.html
etcher - https://etcher.io/
Bitwise SSH client - https://www.bitvise.com/ssh-client-download
Step by step tutorial
1. Format the Micro SD card
Get and install SDFormatter, when that is done insert your Micro SD card to the reader, open up SDFormatter and make sure format size adjustment is swiched on. Then format the SD card.
2. Burn raspbian on the SD card
We're going to use Etcher for this process. Burning the image on the SD card is fairly simple and straight forward.
3. Install raspbian on your raspberry pi and log into your wifi
Installing rasbian is done automatically, you just have to wait until it boots up. After it's done booting, just log into your wifi and write down your local ip for the device. You'll be using this ip to ssh into the device.
4. SSH into your raspberry with bitvise
The default username is : pi
The default password is: raspberry
6. Install piston and all other prerequisites
bitvise will open up a terminal along with a ftp tunnel, paste the following commands into the terminal to install piston
Install screen
sudo apt-get install screen
Install python with all piston the prerequisites
sudo apt-get install python3
sudo apt-get install python3-dev
sudo apt-get install python3-pip
sudo apt-get install git make automake cmake g++ libssl-dev autoconf libtool
sudo apt-get install libboost-thread-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-signals-dev libboost-serialization-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-locale-dev libboost-coroutine-dev libboost-iostreams-dev
sudo apt-get install doxygen perl libreadline-dev libncurses5-dev
install piston
sudo pip3 install steem-piston
Just paste all of theese commands into your terminal one by one to intsall piston with all of the prerequisites
7. Compile the curation bot script
Make a new folder on your desktop called bot, then create 2 files in that folder called bot.py and votelist.txt
so it would look like this
You can just create 2 text files and rename the extensions to get the .py extension.
Edit the bot.py file and paste the following code inside:
from steem.steem import Steem
from steem.steem import BroadcastingError
import threading
import time
import random
import csv
my_subscriptions = []
with open('votelist.txt', mode='r') as infile:
reader = csv.reader(infile)
for rows in reader:
v = rows[0]
my_subscriptions.append(v)
# accounts and passwords
account = ["account_goes_here"]
posting_key = ["password_goes_here"]
# delay in seconds when the bot votes
vote_delay = random.randrange(1200,1800)
upvote_history = []
def feed():
print("Waiting for new posts by %s\n\n\nGo Oprah!\nGo Winfrey!" % my_subscriptions)
steem = Steem(wif=posting_key[0])
for comment in steem.stream_comments():
if comment.author in my_subscriptions:
# Comments don't have titles. This is how we can know if we have a post or a comment.
if len(comment.title) > 0:
# check if we already upvoted this. Sometimes the feed will give duplicates.
if comment.identifier in upvote_history:
continue
print("New post by @%s %s" % (comment.author, url_builder(comment)))
workerThread = threading.Thread(name=comment.identifier, target=worker, args=(comment,))
workerThread.start()
def url_builder(comment):
return "https://steemit.com/%s/%s" % (comment.category, comment.identifier)
def worker(worker_comment):
time.sleep(vote_delay)
try:
for (k,v) in enumerate(account):
worker_steem = Steem(wif=posting_key[k])
upvote_comment = worker_steem.get_content(worker_comment.identifier)
# vote weight 100 full power vote -100 full power flag
upvote_comment.vote(100, v)
print("@%s====> ^Upvoted^" % upvote_comment.author)
upvote_history.append(upvote_comment.identifier)
except BroadcastingError as e:
print("@%s<- failed" % upvote_comment.author)
print(str(e))
if __name__ == "__main__":
while True:
try:
feed()
except (KeyboardInterrupt, SystemExit):
print("Quitting...")
break
except Exception as e:
traceback.print_exc()
print("### Exception Occurred: Restarting...")
8. Add your account to the curation bot, also modify the the settings
add your account to "your_account_goes_here"
add your password to "your_password_goes_here"
you can also add multiple account by seperating the accounts and keys with a comma like so:
account = ["account1", "account2"]
posting_key = ["key1", "key2"]
You can modify the delay when the bot votes by altering this line (in seconds)
vote_delay = random.randrange(1200,1800)
You can also modify the vote weight by altering this line (100 being full power and -100 being full power flag)
upvote_comment.vote(100, v)
9. Add users to the curation list
open up your votelist.txt and add users you want to vote on, each line contains a new user for the bot to vote on
So the list would go like so
ubg
fyrstikken
furion
contentjunkie
xeroc
steempowertwins
10. Move the files from your desktop to raspberry
After you're done adding accounts to your curation list just via bitvise ftp tunnel like so
11. Run your bot
To run your bot, you first need to navigate to the bots folder
you do that by typing
cd bot
then you need to run your bot
screen python3 bot.py
By using that command you're attaching the python script to a screen. So you can close your terminal and log out.
Each time you want to know how the bot is doing you type
screen -r
If you want to detach the screen use keyboard shortcut ctrl+a+d
If you want to close the script use keyboard shortcut ctrl+c
Big thanks to @fyrstikken for releasing the source code for the winfrey bot.
You can find the original code for the winfrey bot here: https://steemit.com/socialist-bot/@fyrstikken/the-anonymous-winfrey-bot-upvotes-for-everyone-download-here-easy-steps-for-n00bs
Also if you have any questions regarding setting up your own bot, just ask in the comments or contact @ubg in rocket chat. Also a huge thanks to @noganoo for providing me the piston prerequisites.
Hello @ubg,
Congratulations! Your post has been chosen by the communities of SteemTrail as one of our top picks today.
Also, as a selection for being a top pick today, you have been awarded a TRAIL token for your participation on our innovative platform...STEEM.
Please visit SteemTrail to get instructions on how to claim your TRAIL token today.
If you wish to learn more about receiving additional TRAIL tokens and SteemTrail, stop by and chat with us.
Happy TRAIL!
Twist and shout!
noganoo !cheetah ban
Okay, I have banned @spin.
how the hell did you make 2000 accounts...
What a sizzling hot article.
noganoo !cheetah ban
Okay, I have banned @tinder.
Fine and good.
noganoo !cheetah ban
Okay, I have banned @tawnie.
Legit.
noganoo !cheetah ban
Okay, I have banned @steemville.
Carolina Reapers. Haha!
noganoo !cheetah ban
Okay, I have banned @snake-plissken.
will this work on a mac?
Yes, just paste the commands in the terminal.
Just to do steps 6, 7, 8, 9 and 11
what about the other steps?
Hmm....when I decide to tackle this, how can i reach you? are you in steemit chat a lot?
@ubg in steemit.chat
ah ok thanks
dude, there are problems with that piston. Does this code still works? I wrote a different bot in python with the selenium framework(browser automation framework).
That is boss level! Just think.....that little Raspberry Pi could curate and probably stake some other coins at the same time. I'm not going to have time for the project but I think it would be cool if someone built a miniature DIY Tesla power wall and had a solar panel hooked up and ran a setup like this just to curate and stake coins.
Yea, you can run rokos to stake the coins at the same time
http://rokos.space/core.html
I am getting index out of range at line 14 of the bot scrip V = rows[0] ??
Try fyrstikkens original script, or felixes updated one. see if those work.
https://steemit.com/socialist-bot/@fyrstikken/the-anonymous-winfrey-bot-upvotes-for-everyone-download-here-easy-steps-for-n00bs
https://steemit.com/piston/@felixxx/learning-python-with-steem-the-winfrey-bot
Hit me up on rocket chat, I'm @ubg there
Just Fixed it by deleting the entire block of code related to the votelist and manually adding in top writers thanks for the feedback though and the awesome tutorial! Thanks to you I got this all done in under a day!
I'm glad you got it working, be sure to look out for updated scripts, because this one is pretty basic and far from perfect. However this gets the job done fairly well.
Awesome, I was thinking now that I've got the setup down the next step is making my bot smarter/ messing with the code