I finished opening most of my untamed packs, and I found myself with too many cards at the moment. Instead of trying to sell them, I decided to put them to work for me. Using a Node JS app and PM2 to manage the task I am running four bots playing Splinterlands off and on.
Still got some more battles before I will let them rest
Could run them 24/7 but with the DEC capture rate I figured I should let them play till they are around 75% and then let them recharge. The amount of resource credits needed is something I am still trying to figure out, I think somewhere around 25 HP should be enough to run the bots down to 75% DEC capture rate and recharge around 10 hours later.
https://github.com/alfficcadenti/splinterlands-bot
Using alfficcadenti's bot, its based on HTML and Javascript.
Using puppeteer the bot is able to goto websites, reload them and click their way through the options. First is to log in, then to refresh pages a few times to get rid of notifications, to battle, to make a team and finally picking cards and submitting them.
Thought the picking of cards would be random but I was wrong. In this app a database is queried on which are the best cards to use for each battle. I question how accurate some of the choices are, as sometimes it leaves alot of mana on the table not being used in battles.
Figuring out how to start a bot proved to be pretty difficult, I checked the Splinterlands discord but did not find much searching. Looked on Hive and Steem and could not really find anything besides someone talking that paid for Version6 bot. I tried a few different bots from Github, but found alfficcadenti's to work the best for me. The others seemed outdated and were not designed to run on the Hive blockchain. Many of the bots were pre-Hive and not updated. Even saw some for sale (Version6) but with open source projects I was able to get this one working for free. I installed it on a Linux VM just to see how it all worked. Giving the machine around 6GB of RAM and a couple CPUs to work with.
Their github where I cloned from
Fixed
Upon trying to install there was a package conflict, it was coming from the package.json
file. I used nano to check it out and found the problem. It was listing puppeteer twice in the config. So I removed the second line and got rid of the markings in the file.
Up next was configuring to use my bots posting key, an environment variable was needed so I added the ACCOUNT=
and PASSWORD=
to /etc/environment
and restarted.
That config worked well for one bot and I tried it out for a few rounds. I kept getting Error: NO TEAMS available to be played
I thought maybe I added too many cards, or not a balanced set of cards.. Like too many Commons but not enough Epics. Was not really sure the problem. I logged into the account on Splinterlands.com and looked at my cards.
Error: NO TEAMS available to be played
looks like this in Splinterlands.
I realized there is a cool down when transferring and delegating, so eventhough my account had the cards they could not play with them yet. So I waited 5-7 days, for the cool down and tried again. And it worked much better and did not miss anywhere as many battles.
Now that I got a single instance working, next was to scale. As I had over a thousand cards and able to take many lower level cards and put them in their own accounts. So I created a second bot account using my RCs and tried out adding an .env file in the working directory of the alfficcadenti's splinterlands bot. Made sure it was on the .gitignore
file as it contains my bots posting key. I removed ACCOUNT=
and PASSWORD=
from /etc/environment
and added it to the .env
file in the working directory and restarted.
I made working folders for each of the bots accounts, placed them all in my documents folder and gave them a number in front to easily switch between directories.
I did this for both of my bots, and then used PM2 as a task manager to create two tasks each with their own .env
file holding the bots logins. They ran great! I scaled up to four and all was working pretty well. Running these on the VM really took up alot of CPU, as the VM was not using my video cards resource as well as on a bare metal system.
Check out my bots card collection:
https://peakmonsters.com/@solo00/collection
https://peakmonsters.com/@solo01/collection
https://peakmonsters.com/@solo02/collection
https://peakmonsters.com/@solo03/collection
https://peakmonsters.com/@solo04/collection
Decided to move my bot cluster to a dedicated machine. Using one of my milk crate rigs I installed Ubuntu and got Node JS setup and everything all updated.
Using a bare metal machine it ran much more smoothly. Though this machine is only a temporary home. I ordered a Raspberry Pi with 4GB of memory to see if I can get it running on there. As the milk crate rig is over powered and waste electricity just running that.
It is fun to use, its like a computer 'rat rod' built of all kinds of weird parts.
Wiring of this milk crate is pretty messy, and I handled the power and reset buttons in an unusual way.
The power and reset 'buttons' are just bare wires I push together to activate.. lol!
Running these bots I am keeping track of their earnings in a spreadsheet, they just finished last season playing for only two or so days by the end. And I was surprised by what one of my bots won, a level 3 Gold Fire Spitter! I was amazed, my little bot got a $15 card on its first season reward.
With the two days of playing the bots got up into Bronze II mostly. Though this season I have gotten at least one of them into Silver III.
So whats my end goal using these bots? To get more cards actually, I got 2 tracts and a few dozen plots of land. And when its all built out I am thinking I will need alot more than what I got.
By making my low level monsters get more monsters maybe I will have enough. I guess I had the right idea buying alot of packs, now my packs can make me more packs and DEC. So when the land goes active I plan to move some or all of these bots into the land to work on it. Hoping I have more than enough monsters using what I have earned between now and then. So I wont even need to take any of them offline. I think eventually there will be bot leagues and that would be cool to have mine in that. Glad I am able to run this bot on Hive where there are no transaction fees, my only costs were each bots Spell books at $10 and the accounts were created from my resource credits using Peakd. Each account creation used around 7% of my RCs.
Next is to get my Raspberry Pi 4 with 4GB of RAM and set it all up on there. Hope the rendering of the websites is not too much for it, I tried running this all headless but it seems it needs the Chromium browser open and working to make the whole app work. Otherwise I may need to keep it on a computer with a dedicated video card, not a powerful one (Mine is a r7 250x). Could probably run on much lower end cards too as it only uses around 20% of its pipeline capacity using radeontop