Grape Wars: Attack of the Bots

Today I was getting ready for the Grape Finance AMA. Everything seemed fine and dandy but then I saw a particular message that piqued my interest...

“Can we orchestrate an attack on the bot ruining the fun in Gladiators KoC Grape tournament? @Andy_Tomb and myself took him for a fair few grape last night but he's restocked and we don't want to have to have that fight again on our own!”

Bot? Ruining the fun? Not on my watch!

For some context, Gladiator King of the Colosseum is a sort of game where you have to hold your position as “king of the Colosseum” straight for a time duration (3 hours for the GRAPE KoC).

Any player can just send a transaction, pay a small amount of GRAPE (currently 1.08 GRAPE) and become the new king, so you have to defend your position day and night, stopping others from winning the grand reward pool.

However, the fun was ruined when one person decided to build a bot to do this. People had to defend their positions against a bot that didn't need to sleep, eat, touch grass or take a break in any way. It just kept entering.

Game plan: Counter the bot WITH a bot

I brainstormed ideas with people in the #ama-live-chat channel. We had a game plan: outbot the bot, make them give up.

Idea 1

Build a Node.JS bot to watch transactions, test the bot, rent a VPS, maintain this VPS... nah. This idea got scrapped because it's just too much effort and too much cost to just fuck over a bot messing with a game.

So then what?

Eureka! Using Gelato Network to automate transactions

We thought a lot and talked a lot in the chat which we now moved to the top secret OG-only #og-chat. Suddenly, it came to me and I sent a message in the thread.

https://gelato.network/ can be used to outsource the execution of tasks, i believe it's reliable enough to be able to send a transaction within a 3 hour range

Gelato Network. It's a system of bots that send transactions at specific times or whenever possible. These automated transactions are incredibly important for this!

Now, I didn't have to code in JS with a blockchain library like ethers.js which I didn't know so well. I could just code in Solidity, a language I've gotten very accustomed to!

It worked on the first second try

The code is very simple, the logic is only about a hundred lines (the interfaces don't count of course) In fact, you can check it out here at this address: 0x34521c12104f8af6c5cfe139a107e6d7f49ebd7e

I then hooked it up to Gelato Network, so it would scan every block, check if my transaction would execute, then if it did, run it to go kick out that piece of sh enemy bot.

Currently it's at about 5 executions on Gelato (and one test execution to kick that bot out manually!) at the time of this writing. You can see them all in the Events tab on Snowtrace.

Grape go brrr! https://grapefinance.app

#defi #bots #autonomy #gelato #p2e