header-langage
简体中文
English
Tiếng Việt
Scan to Download the APP
Partnered With:

In the dark forest, it is not only "running away" that can make a profit | Rhythm Research Institute talks about Ethereum Dark Forest Series 1

Read this article in 18 Minutes
In the magical DeFi world, not only can one step ahead of others to obtain arbitrage opportunities, but there is also an arbitrage mechanism called "Back Running".
Author: Rhythm Research Institute


Friends who know the dark forest of Ethereum must be impressed by the Front running arbitrage robot. These robot programs will always monitor the pending transactions in the transaction pool. When they find a transaction with arbitrage potential, they will initiate a transfer with a higher gas price to ensure that they can enter the block before the arbitrageable transaction.

 

To give the simplest example of rushing, at this time, 1 UNI can be exchanged for 2 USDC. Through monitoring, I found that There is a pending confirmation transaction in the transaction pool that uses Uniswap to convert a large amount of USDC to UNI (which can cause slippage). I will initiate a USDC to UNI transaction with a higher gas price than this pending transaction to ensure that my transaction can be queued. Confirmed before this transaction. Since the default standard for most Ethereum miners to select transactions is the gas price, in order to maximize their own profits, miners will choose transactions with high gas prices to enter the block first. Therefore, we exchanged to the corresponding UNI at the exchange rate of 2USDC/UNI. When the large-amount UNI exchange transaction is uploaded to the chain, assuming that the price change caused by slippage has raised the USDC-UNI exchange rate to 3USDC/UNI, at this time, if I exchange the previously exchanged UNI back to USDC, it will be fine. Achieve 50% profit.

 

However, in the magical world of DeFi, it is not only one step ahead of others to obtain arbitrage opportunities, there is also an arbitrage mechanism called "Back Running".


bZx "tail chase" event


2020 On July 13, 2019, bZx, a margin transaction lending protocol, carried out the IDO (Initial DEX Offering) of its governance token BZRX through Uniswap. The auction started at Ethereum block 10451767, with bZx offering a total of 5 million BZRX tokens.

 

As soon as the event started, a certain user "tail chased" and became the first participant of this IDO , and exchanged almost half of the total IDO BZRX tokens at a price slightly higher than the issue price (due to the slippage of the bonding curve). With the increase of participants, the price of BZRX has been rising all the way. A few minutes later, the user sold all the BZRX that was originally exchanged at a price of 10 times the issue price, and successfully pocketed a profit of nearly 550,000 knives.

 

It sounds simple, but in fact, in order to complete this "tail chase" operation, the user prepared More than 700 Ethereum accounts, and the transaction pool is closely monitored.

 

In order to make it easier for everyone to understand what "tail chasing" is, let's give an easy-to-understand example. Suppose a platform announces that it will hold an activity of exchanging 1 ETH for 100 BTC at midnight on Double Eleven. This activity is a permissionless activity and all users can participate. The platform will use the official address to initiate a transaction on the chain at zero o'clock to announce the start of the event. The first user who transfers 1ETH to the official address will successfully obtain the opportunity to redeem and declare the end of the event. All transfers made before the platform announced the start of the event and after the end of the event will be recorded as invalid.

 

Users do not know which block the transfer initiated by the platform will be included in, and users cannot It is judged that this transaction will be the first transaction in this block. So if you want to be the first to transfer money to the platform after the event starts, you can only rely on luck to get this redemption opportunity?


Different winning strategies


To solve For this question, we need to review the mechanism of transfer ordering in blocks. First of all, miners will select transactions to be confirmed from the transaction pool and put them into the blocks they build. In most cases, as mentioned above, the default selection criteria of miners is Gas Price, that is, Say, the transfer with the highest Gas Price will be the first transfer in the block. Of course, miners do not necessarily have to select transfers according to this standard. For example, miners who want to do evil can fill blocks with transfers that are beneficial to them.

 

After clarifying this point, the strategy we can adopt is to monitor the official address of the platform and initiate a transfer when the platform is found And quickly initiate a 1ETH transfer with a very high gas price to the platform address after going up the chain to ensure that our transfer becomes the first transfer in the next block.

 

However, unless the platform transfer is the last transfer in the previous block, we can ensure that we have 100% odds, but the odds of that happening are extremely low, so we need to come up with another countermeasure.

 

If we initiate multiple transactions at the same time, wouldn’t our chances of winning be greatly improved? Assuming that even if all transfers recorded as invalid will be returned intact by the platform after the event, there are still some problems with this strategy. First of all, the Ethereum account is limited by the nonce of the transfer number. Only one transfer can be initiated at a time, and the next transfer cannot be made until the result of the previous transfer appears. Secondly, if the user uses 100 accounts to initiate transfer at the same time, the user needs to prepare 100 ETH in advance, which is very expensive.

 

At this time, smart contracts come in handy, and smart contracts do not have nonce restrictions. If the smart contract we deploy wins the event, the prize still belongs to us. What we need to do at this point is to put 1ETH into our smart contract, and then prepare 100 accounts with enough Gas Fee. At the beginning of the auction, 100 accounts call this smart contract at the same time, and the smart contract will initiate a transfer to the platform.

 

But what if the platform does not start the auction on time? Or is there a delay in the network? A better way is to make good use of the information provided by the transaction pool, because the transaction pool can tell you everything that will happen in the future on this chain. Then what we need to do is to keep an eye on each transaction in the transaction pool, try to find out the transaction initiated by the address of the project party, and find out the Gas Price of this transaction, and then initiate 100 transactions with the same Gas Price as the transaction through the smart contract. transfer.

 

Why do you want to initiate a transfer with the same Gas Price as the target transaction? Still according to the logic of miners selecting transactions into blocks, since the transaction we initiate is the same as the gas price of the transaction initiated by the platform, there is a high probability that the transaction we initiate will appear in the same block as the transaction initiated by the platform, and it is very likely May "surround" the target transaction. If one of the 100 transactions we initiated happens to be the second transaction after the target transaction, we have successfully become the chosen ones of this event, and successfully exchanged 1 ETH for 100 BTC.


Operation of "The Chosen One"


Let's go back to the bZx incident and see how that user made $550,000 in just a few minutes.

 

If you want to log in to Uniswap to create a currency trading pair, you need to become a liquidity provider and provide Uniswap with the 50% of the liquidity of the currency and ETH, which will also determine the initial price of the currency, which is the IDO issue price. At 02:28:24 UTC on July 13th, Ethereum block 10451767, bZx provided 1000 ETH and 5 million BZRX tokens to Uniswap, starting the IDO with an issue price of 0.0002 ETH/BZRX.

 

The user’s strategy is to exchange ETH for as much BZRX as possible at the lowest exchange rate when the IDO starts ( The remaining part allows other users to continue to exchange), wait for other users to continue to push up the exchange rate, and convert BZRX back to ETH when the exchange rate reaches a high point to leave the market profitably. Since Uniswap is the only exchange channel, and there is only ETH-BZRX trading pair, under the condition that BZRX can be exchanged at the lowest exchange rate, all subsequent buying orders will push up the exchange rate and become the user's profit.

 

First, the user prepared 732 Ethereum addresses and pre-stored Gas Fee. Then the user deployed the smart contract less than an hour before the start of IDO, and prepared 650 ETH in the smart contract to exchange for BZRX. At the beginning of IDO, 732 Ethereum addresses simultaneously broadcast transactions.

 

In the end he succeeded, and one of the 732 transactions initiated by this user happened to be in bZx’s liquidity injection After the transaction (the transaction that starts the IDO). All but one successful deal failed.



Image source: <The fas test draw on the Blockchain: Ethereum Backrunning>


In addition to the winning user, there are other users who are also trying this strategy. In block 10451767, there were a total of 266 transactions, 141 of which were from the winning user, and two other users who tried to use this strategy issued 59 and 23 transactions respectively. The transaction Gas Price is exactly 60GWei. In the end, the winning user has been favored by God through hard work and dedication.

 

Successfully redeeming a large amount of BZRX at the lowest exchange rate is only half of the task completed. These BZRXs are all shipped at the high point to be considered a success.

 

Because Uniswap uses the bonding curve to calculate the exchange rate of trading pairs, when the BZRX reserves become less and less, the price increase slope will be Increase.

 

At the 14th block after IDO opened, he started shipping!


Image source: <The fas test draw on the Blockchain: Ethereum Backrunning>< /blockquote>


He will initially exchange 1,966,111 BZRX with 650 ETH (the initial issue price is 0.0002ETH/BZRX, but the slippage caused the final transaction exchange rate 0.00033ETH/BZRX) in batches within 190 block times and about 50 minutes (calculated at 15 seconds per block), with a total profit of about 550,000 knives and a total gas consumption of 1.47 ETH .


It is actually very difficult to become the "chosen child"


Although at first glance it is very tempting to use 1.47 ETH to get a profit of 550,000 knives, it is actually not as easy as imagined. First of all, all of this is based on the fact that you understand code and can write smart contracts, and you must ensure that there are no problems with smart contracts, otherwise the assets in smart contracts are very dangerous. Secondly, even if the contract is written, other users who can write the contract will compete with you for this arbitrage opportunity, and you may not be able to become the chosen one. Furthermore, even if you are the first to rush in and get a lot of tokens at the lowest exchange rate, if no one takes the order later, these tokens will still be in your hands. Finally, the most important thing is that you have to have 650 ETH first!


Reference article:

 

Start IDO transaction

 

Winning user smart contract address

 

< blockquote ><Ethereum is a Dark Forest>

 

<The fastest draw on the Blockchain: Ethereum Backrunning>

 


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

举报 Correction/Report
Choose Library
Add Library
Cancel
Finish
Add Library
Visible to myself only
Public
Save
Correction/Report
Submit