paco0x / amm-arbitrageur

An arbitrage bot between Uniswap AMMs
Do What The F*ck You Want To Public License
1.93k stars 826 forks source link

Good script, but hard to make it work #46

Open yoongyy opened 3 years ago

yoongyy commented 3 years ago

Hi, I have tried many front-running and arbitrage scripts from Github. I also modified it (use to MySQL to store the spotted potential pairs so that next round I can check in DB if match it can start the arbitrage directly instead of check all again & again). I also deployed a full node on AWS i3.xlarge instance, I run the script in that VPS. I managed to run the attack just less than 50 mini seconds after the bot spotted an opportunity and fire a transaction to a smart contract written by me. The smart contract will execute the Tx if it check it is profit and revert the transaction if it is not.

Here is the summary I can tell: 1) When the bot spot an opportunity, let say you can buy BNB cheaper in ApeSwap and sell higher price on Pancakeswap. Current block is 19000, so when you send a transaction now, it will be ALWAYS at least in block 19002 (2 blocks behind because BSC have Min of 2 blocks or 6 seconds confirmation). So the opportunity you spotted on block 19000, you are impossible to send a transaction there (because it already passed at least 6 seconds when your Tx is confirm)

2) Even you listen to the pending transactions events using Web Socket with web3 (which I done), and repeat the same process, my Tx is ALWAYS at least 10 position behind a spotted Tx. And there is always one Tx that just sit ONE position behind the spotted Tx. Which it is nearly impossible to done by people like us, the most possibility is those running as validator which are able to place and re-arrange the Tx orders when their validate the transactions. You can go and search MEV issues on Ethereum, BSC or Polygon. Because i believe even I upgraded the AWS instance, I still can't win whose guys because all the transactions at the end are being validated on their full node. And surely they already modified their GETH so that they can re-order the TX and place their Tx just any position they like in the block their validating... So no matter how good is your bot, you will never win in the race. The only way you can win is become one of the validator and changing the Tx order on it lolx...

You must think out of the box, or other way to run it. This is what I have experienced and doing research to find out. If anyone interested can contact me at TG @PancakeSwapUniSwapBot and we can discuss more.

ccoop1 commented 3 years ago

You raise a great point. I messaged you on TG

changzhi1990 commented 3 years ago

You raise a great point. I messaged you on TG

Maybe we can create a TG group to discuss it together.

changzhi1990 commented 3 years ago

You raise a great point. I messaged you on TG

Maybe we can create a TG group to discuss it together.

I have created group https://t.me/amm_arbitrage

yg0x01 commented 3 years ago

@changzhi1990 It's a channel not group. Cannot discuss.

changzhi1990 commented 3 years ago

https://t.me/joinchat/vPNwgmeWEmQxNjU1

binggao commented 2 years ago

If I make a complex arbitrage bot, can frontrun bots recognize it and still front run?

ccoop1 commented 2 years ago

Oh yea. They’ll make short work of it. Best option is a temporary reentrancy bot software with your arb bot and have your arb bots address be exempted so it doesn’t attack you, and then run them at the same time and hope whoever is using front runners at the time has contracts with weak security to allow for your temporary reentrancy. In theory it should move all of the funds their bot has access to into a temporary wallet so the bot isn’t able to make the transaction happen. What other ideas do you guys have for front running defense when using your bots?

On Mon, Apr 25, 2022 at 10:13 AM binggao @.***> wrote:

If I make a complex arbitrage bot, can frontrun bots recognize it and still front run?

— Reply to this email directly, view it on GitHub https://github.com/paco0x/amm-arbitrageur/issues/46#issuecomment-1108705278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVAJNT5PCEWTFMIVN5GVDPTVG2ZAFANCNFSM5DY7RWMQ . You are receiving this because you commented.Message ID: @.***>