Hi guys, Julia Dev here. I have decided to test the potential of ChatGPT by seeing if it can generate anything interesting or useful in decentralized finance. Specifically, I asked it to generate a trading bot that utilizes defy liquidity Paris to take advantage of certain arbitrage opportunities for earning passive income. What it generated was incredible. The bot allows you to automatically trade given tokens from the Ethereum blockchain without needing to manually transact through traditional methods. It takes advantage of decentralized finance platforms such as Uniswap to sandwich transactions for arbitrage. Essentially, it sniffs mempools for pending transactions within a block, allowing us to inject our transaction with a higher gas fee than the transaction trying to be entered. This allows us to process our transaction first and then process a sell order right after in the same block. By doing this, we can take advantage of the slippage difference in the transaction.
If this sounds complicated, don’t worry. It’s really not. I’ve been using this bot to earn passive income for weeks, and you don’t need any coding experience whatsoever since the script was generated entirely by ChatGPT. Let’s get started.
First, make sure you have the MetaMask browser extension installed and connected to the Ethereum mainnet. Then, head over to Remix, a web 3 application that allows us to develop, compile, deploy, and launch smart contracts coded in the Solidity language. I’ll put a link to Remix in the description below.
For the first time on Remix, it may ask you to agree to their terms. I’ve already done it. Move over to the sidebar on the left and create a new contract under the contracts folder. Name it ‘bot.sol’. In the description, I’ve included a link to the bot’s source code. Copy this code and paste it into the file ‘bot.sol’ you’ve just created. This is our bot.
After pasting the code, look at lines 55 and 56. These should be the address for Wrapped Ether token. Feel free to check it on Etherscan to make sure it’s correct. Back to Remix, now that our bot file is ready, let’s compile it. Click on the ‘Compile bot.sol’ button and wait for the bot to compile.
Now, we’re going to deploy the contract from our wallets. Head over to ‘Deploy and run transactions’ on Remix. Here, you’re going to want to select ‘Injected provider’ as the environment. MetaMask will pop up, just connect it to deploy the contract on the blockchain. You need to pay gas fees, which are commissions on the Ethereum network for smart contract deployment.
Now, the deployment utility is ready to go. Click ‘Deploy’. I always set gas fees to high as there is usually not much of a difference, and it puts the transaction through faster. Now, we wait for the transaction to confirm. Once confirmed, our smart contract is deployed.
Now, you can see the four actions for our smart contract: ‘Start’, ‘Enable’, ‘Withdraw’, and ‘Stop’. ‘Start’ enables the bot to start snipping the mempool, ‘Withdraw’ stops the bot and transfers the funds back into your wallet. Token name and token symbol aren’t particularly relevant for now.
To fund the contract with Ethereum to snipe liquidity pools, copy the smart contract address and head over to MetaMask. Make sure you’ve got the right address in there. You need to fund the contract with exactly 0.2 Ethereum or more for the bot to function properly. Obviously, the more you put in, the larger transactions you’ll be able to sandwich and the more profit you’ll be able to accumulate over time.
For instance, say you’re only depositing a few hundred dollars, you won’t be able to create as much slippage in the price compared to inserting something like ten thousand dollars. Once funded, the contract is ready to start sniping mempools to find different liquidity pairs for transactions.
After running the bot for a little over a day, I have already made a profit of 1.26 Ethereum. The bot will continue to run until you click the ‘Withdraw’ button. When you click ‘Withdraw’, the bot will exit the liquidity pool and return the total amount of Ethereum you entered initially, including the profit, back to your wallet.
I’ve even had weeks where I’ve made eight to ten Ethereum, sometimes more. The profits will fluctuate week to week. If you have any questions, feel free to ask me on Telegram. Guys, share your profits in the comments below, drop a like, and don’t forget to subscribe for more profitable ways to make passive income using AI and web3 tools.