Set up my own Splinterlands bots

in Splinterlands9 months ago (edited)

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

August 2021 update: I have written a guide on how to set up this bot for yourself.. see post below.

https://peakd.com/hive-13323/@solominer/a-guide-to-setting-up-your-own-splinterlands-bot

Sort:  

Hi @solominer I'm Alfficcadenti, and I've just found this post (a bit in late 😀).
I didn't realize I pushed that issue on the package.json, so thanks for pointing out. Recently I've also made other improvements to the code and updated the battles database and I have automation for the new rules coming ;)
I'm glad you mentioned the source in the post. I appreciate honesty and I'm happy you leveraged it so much to get lands!!! I've just bought some and I'll keep buying it waiting for the feature to comes out, which of course will require bot update! 🤣
Btw, I've actually also made it run on raspberry pi. the code needed some changes for the browser but I was able to run it for 4 accounts on a single raspberryPi.
Ah, I'm a beekeeper too 😉

Hey there! Glad you found my post, I have been getting updates from your Github over the last few weeks. Looks like you have been quite busy getting it all caught up. I think the rulesets were causing the most issues, as when you coded it a few years back there were many less rules than there are now. Hopefully you got them all added so it does not surrender as much.

@almightymelon took your base code and completely rebuild the bot, and that is what I am running now. But I will give yours a try and see how it does, maybe after this season.

Oh thats great you got it working on ARM (Raspberry Pi). I tried doing this but chromium would refuse to launch. Which RPI were you able to get 4 account to run on? A 8GB RPI4?

I run 9 bots on a dedicated x86 machine, it has 32GB of RAM and a Ryzen 7 CPU so it handles just about whatever I throw at it.

Nice! I need to go check on my bees soon.. haha

Hello, Alfficcadenti.

I do indeed owe you a thank you. I took your old master and to begin with just got it working and ran it on a few accounts. But over the last few months, working with another coder, we did a complete code restructure, we have written out own format for the hand list, a new hand finder script, and a puppeteer rewrite.

Now ours is something quite different but has its own issues that we're having to deal with.

I didn't know Node well before this process, and your bot was a great template for experimentation and learning. So thanks again for that. I appreciate it. Congrats for getting yours running on a Raspberry Pi! That's really exciting. My code would probably catch one on fire.

Take care.
AlmightyMelon.

Do you think someone with no coding knowledge could set one up? seems to complex for me but would like to try !

Yeah its all copy and paste, but.. now a new rule was put in place if you flee from battle you cannot play after it happening enough times until a cooldown happens. So I wouldnt recommend using this bot now with this new change.

Your bot ran and was working pretty well. Good work by @solominer

Ah thank you, seems it's doing pretty well now.

I am surprised they tolerate so many obvious bot accounts in the game. I take pleasure in defeating those I encounter and sometimes it's all bots. I want to play against people. I think part of the reason for changing the rules was to make bots less profitable. Just my opinion.

If they really wanted to prevent bots they would add re-capthca. Oh wait, that doesn't work well either.. 🤦

https://threatpost.com/researcher-breaks-recaptcha-speech-to-text-api/162734/

It's a constant arms race to deal with bots. The question is, can the dumbest human be smarter than the best bots?

Listening into the splinterlands meetings I got a feeling of what they will tolerate and seems bots are the least of their worries. Maybe a bot league will be implemented in the future.

There bots are pretty good to me.. maybe I really suck but I've lost numerous battles to bots.

It just gets boring to be fighting bot after bot some days. It looks like a lot of them are around the silver and gold leagues, but I expect they cannot get higher and so their winnings are limited. No idea who is behind enminer/neminer bots.

You must have a better eye for bots than me. When I play if I did not see their username I would not know they were bots. But maybe if I played more I could tell better.

I'm going by the name. Many make it obvious.

Se ve muy interesante lo explayado en este post, gracias por compartir, te dejo mi voto y te sigo.

Thanks alot glad you found it interesting.. appreicate your support.

Pretty awesome!

The power and reset 'buttons' are just bare wires I push together to activate.. lol

Lol so many memories. I used to do that too back in my uni days ahah.

Haha it's the easiest switch ever. I was worried I would get shocked doing this but I guess they have little to no voltage and amps going through the wires.

Impressive!

Thanks alot

WOW, you're so savvy.
I'm a traditional player... I play only when I have time to play.
I don't even understand much of what was said here, hehehe!
Good luck running your bots, and may you generate more cards in the process!

Hehe yeah tech is my thing, well thats all good I hope you enjoy the game. I sure do..

thanks much! its been alot of fun playing with the bots.

Very cool and I hope that I destroy all your bots. :) It seems like for the time spent there are ways to earn more $$$. But... I understand... We do this cause we are compelled to. Great post!

Hehe best of luck! yeah I have already made half my money back in two seasons of battles. So seems its a pretty good way to earn DEC and monsters.

Its all about that passive crypto income :-)

recently im giving this error but really i dont know where to look for fix it.

18
INPUT: 18 Standard [ 'fire', 'water', 'earth', 'life', 'death', 'dragon' ]
END Error: TypeError: Cannot read property 'includes' of undefined
at C:\NJ\splinterlands-bot-master\possibleTeams.js:46:80
at Array.every ()
at availabilityCheck (C:\NJ\splinterlands-bot-master\possibleTeams.js:46:64)
at C:\NJ\splinterlands-bot-master\possibleTeams.js:103:18
at Array.filter ()
at C:\NJ\splinterlands-bot-master\possibleTeams.js:102:22
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Object.possibleTeams (C:\NJ\splinterlands-bot-master\possibleTeams.js:114:25)
at async startBotPlayMatch (C:\NJ\splinterlands-bot-master\index.js:66:27)
at async Task.execution (C:\NJ\splinterlands-bot-master\index.js:141:9)

Yeah the bot is missing logic for new rules, I wouldnt recommend using it as there is now a penalty for missed battles.

Did you update it ?
Or stop using it?

I am working with a team of splinterlands players to get it updated so it works again.

I have stopped using it in the mean time.

Will do a follow up post once I have a working replacement.

I came up your post here and was wondering if you made progress with the update

Hey @kurukiel yes progress has been made on the bot. But the devs that improved it want to keep the code private. So unfortunately I am unable to share it out of respect to them.

Hola como estas? sigue funcionando el bot, por que lo descargar y no puedo hacerlo andar.

If you have a github account goto the issues tab and report it.

https://github.com/alfficcadenti/splinterlands-bot

Hey this is a great article. I don't have any coding background. And I can't find any instructions on how to install and run the bot. I was wondering if you were willing to do a step by step on how I would go about installing it and running it so I can use it on my account. Thanks

Ah thanks alot, yes I can make a guide on how to run alfficcadenti's bot.

Though I am not using his bot at the moment I can surely spin it up and make a guide.

Give me a few days.

Thanks the guide was perfect.

The August update is appreciated yet do you know of anyone that can set it up with mobile access to my machine? be happy to pay in cryptocurrency if this is possible, someone here with little time and ability in this realm yet would like to have a few of my Hive accounts doing some work... ? or know anyone that does this maybe if you don't?

I am sure some people would be happy to do that.. Go ask @a1492dc on their discord below.

https://discord.gg/dqEaAzCgkD

Or ask AlmightyMelon#6301 on Discord via DM.

I suggest you ask them because I am not the creator of these bots. I would rather the devs that made them get the chance to earn if they are interested. If not I can indeed set you up on a ubuntu machine, but pleas be aware the free version of this bot can time out and cause surrenders. So Id hate to set you up a bot and then it not be very stable. If you get ahold of @a1492dc ask him about the subscription service that makes his bot much more stable.

 2 months ago Reveal Comment