Introduction
For the last couple of weeks, I've been posting a lot less frequently - that's mostly thanks to a pet project I've undertaken - a working bid bot!
In this post I plan to detail all the features I've built in and also give you a few pointers to it's operation.
Firstly, what is a bid bot?
If you don't already know what a bid bot is, take a trip to https://steembottracker.com/ and you'll have a pretty good idea. Every 2.4 hours, a bot shares its 100% upvote between users who have placed a bid for a share of that vote.
Well, people have already created bid bots, why is this code relevant?
Yes, there are already bots in existence, some of them are huge. But a lot of that code is closed source, it would be bad business practice to share it.
One bot owner, made a post sharing their code which I thought was very generous...
However I like to do stuff from the ground up so I can have an intimate understanding of the code. I also noticed his code didn't have some features I was after and was difficult to read.
My bot, , is now finished, unfortunately I'm not able to get it onto Steem Bot Tracker because:
- It has too little steem power.
- I live in student accommodation and we're not allowed static IP addresses.
Feel free to send it a bid though, it still works.
Features
- Auto-payout to delegators every 24 hours
- Choose payout percentage
- Blacklist delegators to prevent refund loops with other bots
- Choose minimum delegation ammount
- Keeps earnings in an external file
- Steem Bot Tracker API compatability
- Automatic refunds
- Memo explaining why bid was invalid
- Age
- Already voted
- Already bid
- Invalid URL
- Bid too small
- Memo explaining why bid was invalid
- Comment upvoting
- Can deal with blockstream downtime (still needs a little work)
- Updates JSON metadata to let people know bot is down
- Keeps a log of downtime
- Accepts SBD and STEEM
- Payouts to delegators in both
- Converts both to USD at payout using Coin Market Cap for optimal accuracy
Use
Running this script requires a few other things.
Python anaconda
To make this I've been using Anaconda for Python and the Spyder IDE. I strongly recommend it if you're on windows as I had problems with the scrypt library on base python. Here's a great guide.
Additional Packages
Hosting
You only need this bit if you plan on putting your bot on steem bot tracker.
WAMP
My script saves the data file to c:/wamp64/www/
WAMP is an Apache server for windows and allows you to host files on your PC by making it into a server. Out of the box, it's only designed for local networks so you'll need to do some tinkering.
Of course, this is for windows users on home PCs, if you have a better option I urge you to go for it.
- Set yourself a static IP (I can't do this thanks to my ISP so unfortunately haven't been able to test past this point).
- Open port 443 on your PC (since steem bot tracker requires https, not http).
- You'll also need to mess around with the settings files (there's loads of tutorials online) so Apache knows to use https/SSL port 443 instead of http port 80.
- Change some more settings so Apache accepts connections from external machines.
- Get an SSL certificate for your IP/domain name. Using openSSL won't work as a self signed certificate is considered unsafe. Hosting your own webside becomes a huge advantage here as you likeley already have SSL certificates and a domain name.
- Buy a domain and bind it to your IP.
Alternatively
Online code hosting services
https://www.heroku.com/ lets you run python scripts on their site. However their services are more geared towards web hosting and dJango applications - I'm also not sure how file storage works on there and users have said applications hosted on there have a habit of going to sleep which would be unacceptable for a real-time script like this.
https://www.pythonanywhere.com/ is also a possible choice, they do have limited hardware usage for free. You can only make so many requests or use so many process cycles per second - not great for a script running two threads at a time. I also tried installing steem python on their bash console and got errors, I tried the custom Scrypt fork from the Anaconda tutorial but it seems to be only for windows.
Maybe there's a way around this but I don't know of it yet.
Customisation
Posted on Utopian.io - Rewarding Open Source Contributors