Original title: 7 Steps for chatGPT to Write a Wallet-based MEV BOT
Original author:SsssswsZ, crypto analyst
chatGPT has been showing a lot of strength lately. Since it's so awesome, can we write some slightly more complex code, like a grid trading Bot or even a MEV Bot that could actually make us money? The results are pretty impressive. First, the conclusion:
1. 通过一些 input 调教,chatGPT 真的可以写出一个非常基础但是基本可用的 gird trading bot,并且能进行一些基础的优化。
2. To my surprise, it can write some simple MEV bots and even call different apis to write MEV bots that meet different conditions.
Simply put, you can get a working wallet-based mev bot by repeating the following steps:
1. Start typing simple business requirements (such as asking AI to write a grid trading bot)
2. Let the AI optimize the code several times by typing the command "optimize the above code"
3. Input more complex business requirements (such as asking AI to write a mev arbitrage robot)
4. Continue optimizing the code through commands
We try to enter a specific requirement in the Input field, For example, "write a grid trading bot with binance API", we get the following Python version of a grid buying code template (it even tells us what the idea is). Look closely, there are no obvious bugs. However, it should be noted that even if the command input is the same each time, the code version will be different, but chatGPT gives the same idea for the same problem.
, Of course, in a highly demanding manner, we can continue typing "optimize the code above" to get the AI to automatically optimize the code above. We can do this two or three times until we are satisfied. As you'll see, chatGPT gives you ideas for each optimization, and the optimized code becomes much more concise. These ideas are worth learning, especially if you're new to this type of development
, But if you're a grid trading bot, how can you just buy? So we tried typing "write a grid trading bot of sale" and found that we actually got a complete buying and selling grid trading bot. What's more valuable is that the code can be used without modification:
, We won't repeat the step of making the AI optimize the code, after all, this time we just want to see if it can write a slightly more complex logic of the code, for now, grid robot is not difficult to it. So, if it comes across a more complex MEVBOT, can it handle it? Let's enter "Writea MEV BOT in python" and find that the MEV robot is not the chain's maximal extractable value as we know, but the traditional grid trading bot based on Binance, It also inspires us not to be narrow minded, MEV is not just on the chain: ), I don't need to specify the programming language here. I just like python personally, and the main code versions given by chatGPT are Python and JS. You can also add your own qualifications, whether withflashbot or with thegraph, chatGPD can meet your needs.
But if we limit this MEV BOT to an On-chain MEV, can chatGPT handle it? So we can enter a very specific request in the Input: write a uniswap MEV BOT. The result is ………… It gave us a JS version of sniper bot! The Sniperbot is one of the simplest MEV bots. Just think of it as clips.
Taking a brief look at its logic and code structure, we can see that it is basically already a usable sniper bot. Even the feeAmount was considered. Of course, it doesn't have to create a new pool at the end, but we can tweak the logic to monitor the existing pool. Of course, you may enter the same command to generate code that doesn't have this logic in it, but it doesn't matter
, Since we are only this close, let's try to make it write its own sniper bot that can monitor DOGE/ETH pools. Let's go ahead and qualify. A simple EOA/ Personal Wallet based MEV BOT with few errors was generated
Then you can repeat to optimize the code, until you optimize a version that you are happy with, and then copy it and modify it a little bit and you can actually use it. Note here that the contract address in the code generated is the main network address, remember to change to the test network when you try. However, we know that real MEV bots trade through contracts rather than EOA, so if we wanted chatGPT to write a contract-based MEV BOT template for us, would it be able to do that? Welcome to try (e.g. input write a MEV BOT with smart contract). The version I got is as follows. Some of the function relationships in it may need to be adjusted, but the general logic and structure are OK
Overall, chatGPT's ability to generate logistically complex code such as trading bots and MEV Bots is truly impressive. More importantly, it also provides us with code optimization ideas, which I think we should really learn from. With its versatile features, it remains to be seen how much potential there is. Finally, attach a list of the required commands
· Write a grid trading bot with binance API (you can change to any trading platform API you like, or just write exchange API, or change the policy name)
· optimize the code above · Optimize the code above
· write a grid trading bot of sale (can be changed to your preferred strategy name)
· Write a MEV BOT in python (change the language freely)
· write a uniswap MEV BOT (add language restriction or change target DEX)
· write a uniswap sniper bot to snipe DOGE/ETH (change trading pairs and trading platforms at will)
Link to original article
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia