one of the absolute best things about blockchain is you can create Arbitrage based crypto trading Bots with flash loans that absolutely print money while you sleep like this developer who made over $20,000 in the last 7 days all 100% verifiable on the blockchain but how do you make one of these Bots that's actually profitable well that's exactly I'm going to show you this video today as a blockchain developer myself who's done this so if you're new around here hey I'm Gregory and on this channel I turn you into a blockchain master so if that's something that you're interested in then smash that like button down below subscribe all right so let's get into this let's talk about how to create an Arbitrage based crypto trading bot now if you clicked on this video I bet that you probably understand what Arbitrage is basically it's just buying cryptocurrency on one exchange and selling it on another exchange for a profit but you don't want to do this on centralized exchanges like binance or coinbase because by the time that you do the transaction the price might move on you and the trade might no longer be profitable okay so what you want do instead is use decentralized exchanges like Unis swap or pancake Swap and create a blockchainbased trading bot that swaps across these types of exchanges here's why so number one these Bots don't require any of your own money to trade you can completely borrow it for free with flash loans and number two is you can't actually lose any money on these trades or lose the money that you're borrowing because this bot is powered by smart contracts the blockchain just won't let that happen so how exactly can you do this well I'm going to break down each step in this video but if you want to jump past all these steps and actually steal my Arbitrage based crypto trading bot that make sure you hold your spot for the trading bot master class next Thursday on January 16th inside I'm going to give away my flash loan Arbitrage crypto trading bot and show you how to set it up step by step so trust me you don't want to miss this hold your spot the link down below all right so step number one is to pick a blockchain that you're going to perform the arbitrages on so what you have to understand is anytime you're doing blockchainbased crypto Arbitrage you have to be on the exact same blockchain you can't exactly effectively do cross chain arbitrages at the time of recording this video so let's look at some different criteria for a chain that you're going to want to select number one the chain must have lots of tokens uh number two it must support lots of exchanges that you can actually find places to Arbitrage between it must support Flash loans you can actually take out loans to do this and then finally it should be evm compatible so that you can take your code and put it on many different blockchains so if you want to get some ideas you can go to a website like defy.com click on the chains tab here and you can see all the different blockchains that support these types of strategies okay so obviously the number one is ethereum with the largest market share uh it's going to support solidity smart contracts but if you can write this for ethereum you can also write for many other blockchains like Tron like binance smart chain any of the ethereum layer 2os like bass arbitrum etc etc and all the ones that I just mentioned satisfy the criteria I said a second ago all right so step number two is to pick two different exchanges that you want to Arbitrage between because again you're buying on one exchange and selling on another exchange for a profit and again these need to be decentralized exchanges powered by smart contracts that you can do this completely on the blockchain and the price can't move on you so I'm going to give you two examples like Unis Swap and pancake swap okay so why have I chosen both of these well for starters Unis swap version 3 and pancake swap basically have the exact same code interface so if you can learn to trade on Unis swap version 3 you can implement this on on pancake swap as well lots of other reasons are that they have a lot of liquidity with lots of trading Pairs and they're also deployed to multiple different blockchains and layer twos so if you understand how to trade on these exchanges you have lots of different places that you can do this but if you want to get some other ideas you can also go back to defi llama click on the forks Tab and you can see all the different decentralized exchanges that implement this type of strategy so again if you can learn to trade on just one decentralized exchange and learn how to use that code then you unlock the door to trade on multiple different exchanges and that's what the fork is basically Forks are just software that's been copied from somewhere else so if you go here and you click on something like Unis swap version two or even version three which I just mentioned there's over 134 different exchanges that use the exact same codebase that you could potentially employ one of these strategies on and you can rinse and repeat that for all the different Forks that are listed on this site and so once You' picked some exchanges what you're going to do is essentially watch for the different trades that are coming through on one exchange and seeing if it causes a price discrepancy to where you can do an Arbitrage onto the second exchange so how can you do that well basically you can listen to every single trade that comes through the decentralized exchange uh by monitoring the events so basically events are just things that are emitted on the blockchain that anyone sub subscribe to to get notified that that thing happened and in this case it's a swap event so for example Unis swap version 3 has a swap event that you can subscribe to every single Swap that comes through you can monitor it and basically if it caused the two prices to fall a sync on these exchanges where there's a big enough price discrepancy then that's an Arbitrage opportunity and that's something that you can capitalize on all right so step number three is to pick a token trading pair okay so people wonder all the time like hey how can I research tokens to start doing Arbitrage well the first and easiest thing is to just look at the top tokens that are available on something like ether scan okay so I realize this is just for the ethereum blockchain but many of these tokens are also going to be available on other blockchains and their market share and ethereums probably going to correlate to these other chains as well so if you get ether scan io/ tokens you can see you know thousands of different tokens listed on this page that's one way to start looking at this now another way is to actually use a DEX Explorer like a DEX screener or Dex tools birdy GMG whatever you want to do but Dex screener is a pretty good starting point basically you can just pick on the chain that you want to start arbitraging on I just clicked on ethereum for example purposes here I sorted by volume and I'm just going to take chain link as an example it's the number one at the top so what you can do is you can take a token like chain link you can search for it here all right and what you want to do is see that yes it has a lot of volume at least on one exchange there but it's also supported on many other exchanges on the exact same blockchain also with a significant amount of trading volume and once you verify that then you've potentially found a token that's worth watching to try to jump on an Arbitrage now the final thing to understand about the tokens that you're arbitraging is that of course you know number one they all have to be on the exact same blockchain like I was saying before but in the case of this strategy they all need to be erc20 tokens okay so what is that well basically this is just a standard that specifies how tokens should work so if you're in on any of the blockchains that I mentioned previously these are probably all going to be erc20 tokens and you have to understand how this code works so basically they're just smart contracts that have these functions like transfer transfer from okay total Supply these are the types of function that you're going to need to understand whenever you're doing these arbitrages okay so final Point here is you're not going to directly be able to uh swap like native gas tokens to a blockchain like ethereum or ether for example you're going to need to use the wrapped versions of this like uh wrapped ether okay or if you're going to do something like Bitcoin you also need to do a wrapped version of Bitcoin but these are all erc20 versions of those underlying cryptocurrencies all right so step number four is to pick a flash loan provider so really quickly just a recap of what flash loans are in case you're not familiar basically this is a technique where you can borrow up to millions of dollars of cryptocurrency on the blockchain completely for free with no down payment no money down as long as you pay it back in the exact same transaction okay so um if you don't know which flash loan provider to choose uh my preference is balancer okay so balancer is a liquidity protocol it's got an AM amm excuse me but they also support Flash loans okay so why do I like balance or Flash zon well it's the easiest to set up basically here's the template for you can basically copy and paste into your smart contract with minimal customization um it has no fees for the flash loans and then finally it is multi-chain so it doesn't do cross chain but it works on multiple different blockchains so basically it's got some pretty simple functionality here's the function that you call whenever you want to ask for the flash loan and here's the function that you uh put in your smart contract to receive the flash loan and you just simply Implement your codra these three dots are to actually do the Arbitrage tra all right so step number five is to actually create a smart contract that implements the actual Arbitrage trading itself so you're going to want to create a smart contract that takes out flash loans but then once it gets the flash loans it actually needs to be able to make a trade between two different exchanges now before I was saying you want to try to start off by picking two exchanges use the exact same coat interface that's why I said you know uni Swap and pancake Swap and then what you want to do is learn how to make the trade with code inside your smart contract so I'm going to use Unis swap version three as an example so what you can do is you can just go to the Unis swap version 3 documents and say like Hey how do I just Implement a swap inside my smart contract and here is the answer right here basically you have to import the Unis swap you know smart contract into your smart contract so that you can actually talk to them and then it's just some basic qu code to set up the parameters for your Swap and what you're going to do is use the exact input single a swap exact input single function that's what unisoft version 3 uses to swap and you're just going to you know add these parameters like what tokens are you trading uh who's the recipient of the funds you know when is the deadline how much are you putting in etc etc and then add that to your smart contract to do the swap on the first exchange and then you're just going to do the reverse on the other exchange to trade the opposite direction to get more tokens back than when you started with all right so step number six and this is the final step is to create a Searcher bot that actually watches for opportunities in the marketplace and then calls your smart contract in order to execute the trades so what you have to understand is once you've created smart contracts that can take out flash loans and actually do Arbitrage trades the smart contract only does what it's told and once you put it on the blockchain it's not going to just magically start doing arbitrages you might see like YouTube videos where people say like hey just copy and paste this code and remix and it's going to do Arbitrage those are scams are going to steal your money so what you actually have to do is basically put a smart C on the blockchain but then create a second bot okay that lives offchain that runs on your computer that watches for the opportunities and then calls your smart contract to actually execute the trades so you can see a diagram on my screen here basically you've got a bot offchain and then onchain you have your contract that hooks into both exchanges takes the flash loan and then does the trade so how do you create one of these Bots well the easiest way to do it is in JavaScript with something like node JS so what is no. JS basically it's just an environment that let you run JavaScript on your computer okay because it natively runs in your web browser so if you use no. JS you can wrate a single page script that essentially runs 24/7 that watches for these opportunities and then calls your smart contract whenever it finds a profitable trade so how do you watch for the opportunities well it goes back to the events like I was saying before every single time a swap goes through on an automated Market maker like uni swap or pancake swap it emits an event okay and that also has a price change if the price changes enough you can listen for that event and then do the calculations to see if it's a profitable trade and then call your smart contract so you can do that with a library like ether's JS inside your no JS script you can see the code here basically for uh monitoring events basically it's the contract. on method okay you just tell what Advent you're watching for and some extra parameters and then inside that callback function you can just monitor the data that came through do the calculations and then call the swap on your contract of course you want to calculate the price difference for the swap with gas fees to see if it's profitable uh in order to make the trade all right so that's an overview of how to create a profitable Arbitrage crypto trading bot with flash loans in 2025 but again if you want to steal my Arbitrage bot then make sure you hold your spot for the trading bot master class next Thursday on January 16th inside I'm going to give you away my flash flow and Arbitrage trading bot and show you how to set it up step by step trust me you don't want to miss this hold your spot with the link down below so that's all I've got for today make sure you smash the like button down below and subscribe and until next time thanks for watching dap University