Decrypting the Mysteries of a Cross-Chain Arbitrage Bot
And how to visualize its trading strategy for optimization.
TLDR
Being an old-timer, this cross-chain arbitrage bot worker really hard to bring BANANA between chains. It made a revenue of $150 in one day.
Time is not friendly for cross-chain transactions, MEV as well.
EigenTx is a useful tool to visualize several cross-chain transactions in one graph, making it easier to understand the strategies.
Cross-chain arbitrage opportunities have become more prevalent in decentralized finance as new bridges connect previously siloed blockchains. By monitoring transactions across multiple chains, arbitrage bots are able to detect price discrepancies and execute profitable trades. These cross-chain MEVs have been there for a while. This post will walk you through the strategies of an early adopter of cross-chain MEV, who went for BANANA in the first arbitrage, at which we are going to take a close look.
Going Banana
The early cross-chain arbitrage robot, 0x9Bb417E9Ab6a8AC057f250DA964B2559909bd255, utilized MultiChain (formerly Anyswap) for conducting cross-chain arbitrage trades. In the fourth quarter of 2021, it found opportunities between BSC and Polygon, primarily trading the BANANA-USDC token pair. The graph below shows a typical cross-chain arbitrage trade, where the feature, Multi-txs in One Chart, of EigenTx combined four affiliated transactions into a comprehensive token flow graph. One can easily identify the corresponding chains by the chain icon tagged with the token flow. And the transaction steps are marked in chronological order of occurrence by capital letter-number.
Let’s move closer.
Steps A-0 to A-6 (Oct-28-2021 20:55:00): The bot swapped 6000 USDC for 3322.8542 BANANA on BSC through an aggregator contract 0xbaf.
A direction change makes it easier to look at.
Steps B-0 (Oct-28-2021 20:55:15): The bot transferred 3322.8542 BANANA from BSC to Polygon.
Step C-0 (Oct-28-2021 20:56:32): The bot received 3322.8542 BANANA at the same address on Polygon. The bridge charged no fee in this direction, and the cross-chain process took about 1 minute.
Steps D-0 to D-12 (Oct-28-2021 20:57:08): On polygon, the bot swapped 3322.8542 BANANA for 6028.4604 USDC through an aggregator contract 0x114.
In the end, the bot gained revenue of 28.4604 USDC on Polygon and would occasionally rebalance assets on these two chains, as shown later.
This entire cross-chain arbitrage process took about 2 minutes, and the total gas cost was about $1.35.
Cross-Chain Rebalance
After arbitraging, the bot needed to adjust its positions on two chains. There was a certain transaction fee when transferring assets from Polygon to BSC.
The Bot Loves Bananas!
After less than 30 minutes, the bot did it again. This time, the bot was too late to transfer the token across the chain and failed to catch the arbitrage opportunity. But it found that the price on the original chain became better, then it transferred the tokens back to the original chain for arbitrage.
Steps A-0 to A-5 (Oct-28-2021 21:21:34): The bot swapped 6000 USDC for 3339.2443 BANANA on BSC through an aggregator contract 0xbaf.
Step B-0 (Oct-28-2021 21:21:55): The bot transferred 3339.2443 BANANA from BSC to Polygon.
Step C-0 (Oct-28-2021 21:34:36): The bot received 3339.2443 BANANA at the same address on Polygon. The bridge charged no fee in this direction, and the cross-chain process took about 13 minutes!
Step D-0 (Oct-28-2021 21:37:36): The bot might find no arbitrage opportunity on Polygon anymore, thus transferred 3339.2400 BANANA back to BSC.
Step E-0 (Oct-28-2021 21:42:26): The bot received 3335.9008 BANANA on BSC. This time, the bridge charged a tiny fee, and the cross-chain process took about 5 minutes.
Steps F-0 to F-6 (Oct-28-2021 21:43:26): The bot swapped 3335.9008 BANANA for 6058.1946 USDC on BSC.
Here is a separate view of transaction F on the BNB Chain.
In this trade, the bot gained revenue of 58.1946 USDC on BSC.
The entire cross-chain arbitrage process took about 22 minutes, and the total gas cost was about $2.66.
Doing Cross-Chain MEV? Time Is Not Your Friend!
The archaeological analysis above reveals that early cross-chain arbitrage bots were still in their infancy. Uncertainties in the performance of cross-chain bridges significantly impacted cross-chain arbitrage profits. For instance, the instability of cross-chain time consumption often led to the disappearance of arbitrage opportunities, necessitating manual monitoring and operation. However, the transaction fees for some mainstream tokens across chains were not high, and trading gas fees on BSC and Polygon chains were much lower than on the Ethereum network.
By combining transaction data from blockchain explorers and EigenTx, we can understand this bot's daily performance. On October 28th, 2021, the bot successfully executed 16 valid cross-chain arbitrage trades on the BANANA-USDC trading pair. Of these trades, 10 were profitable, and 6 incurred losses, yielding a win rate of 62.5%. The bot generated total revenue of approximately $150 and adjusted its position five times throughout the day.
Follow us via these to dig more hidden wisdom of DeFi:
Website | Discord | Twitter | YouTube | Substack | Medium | Telegram