It is no secret that “every nanosecond counts” in traditional trading due to its “winner takes all” nature. While decentralized finance (DeFi) differs from traditional finance in many ways, this victor mentality and the need to quickly send and receive data remains essential. Yet, there are few studies that actually quantify the extent to which quickly sending and receiving transactions helps with DeFi trading.
By Professor Aleksandar Kuzmanovic, bloXroute Labs Co-Founder & Chief Architect
Sending Transactions Fast
bloXroute attempted to quantify how much speed impacts the probability of a transaction getting mined in the next block. In the context of popular DeFi applications, such as Uniswap, getting a transaction mined in the next block directly affects the price captured.
Indeed, the distribution of Uniswap (currency) pairs is highly biased, i.e., the top 10 Uniswap pairs approximately account for 50% of the entire transaction volume. Such pairs are thus highly “contested,” meaning if a transaction is not executed in the current block, executing it in the next block will come with a monetary loss.
To model the latency at the network layer, we assume a slow and fast network path as described using the following parameters:
Delta: The amount of time, in milliseconds, by which a fast-path route transmits a transaction faster than a slow path. (For the technically minded: this amount of time is defined as Delta = Latency_slow — Latency_fast.) While this value is variable in reality, in our model we use a constant value for simplicity.
Critical Delta: In order to compute the probability that a transaction is generated during a critical period (aka the period in which it’s possible for a transaction to be included in the next block), we define the critical delta period.
Assuming the next block will be mined by a pool, consider a moment (t1 in Figure 1) as the deadline for the mining pool to decide on the contents of the block. If a transaction needs to reach the mining pool prior to the deadline (t1), and the latency to the mining pool is the time period we’ve labeled here as “Latency_fast,” then the transaction needs to be sent prior to t1 minus Latency_fast. In other words, if a transaction is sent via a fast path prior to t1 minus Latency_fast, it will reach the mining pool before the deadline and will be eligible to be included in the next block. At the same time, if a transaction is generated during the critical delta period seen above, and then sent via a slow path, it will not be possible for it to be included in the next block. It will not reach the mining pool prior to the deadline.
Next, we want to compute the probability that a fast-path transaction is generated during the critical delta. We approximate this probability by dividing the critical delta period by inter-block time (aka time between blocks). The results of the computation for various values of Delta are shown in Figure 2 below.
We found that latency improvements at the order of hundreds of milliseconds can lead to a significant benefit in one’s trading strategy (e.g., in this scenario, a 900ms reduction in latency leads to a 12% improvement in the probability of a transaction getting mined in the next block).
Receiving Transactions Fast
In terms of receiving transactions faster from the network, such an ability can lead to lucrative trading opportunities. Consider a simple example of a transaction (A) that will move the market by 10%. Hypothetically, someone buys a large amount of one currency at a Uniswap currency pair, leading to a significant shift in the exchange ratio for the pair. Such transactions are not impossible in DeFi applications such as Uniswap.
A trader that quickly hears about the above transaction A can act accordingly. For example, she might generate a transaction (B) that buys a currency at the existing, pre-market moving rate, and ensure that such a transaction is mined before the market-moving transaction A is mined. In particular, the trader can enter a mining fee for transaction B that is larger than transaction A’s fee. In addition, if the trader has the advantage of receiving transaction A fast and sending transaction B fast, then there is a high probability that transaction B will be mined sooner than transaction A. Note that when two transactions are mined in the same block, the transaction with a higher fee is mined sooner. To conclude the example, in addition to generating transaction B, the trader can generate a transaction C in the near future. Transaction C can trade in the reverse direction from transaction B, thus benefiting from the updated exchange rate. If you are a pro trader, you want to hear about transactions as early as possible.
If the above reminds the reader of front-running in traditional finance – that’s because it is. Front-running bots are a common case in DeFi. This necessarily opens up new problems. In particular, a scenario in which a front-running transaction (B) has a negative impact on the original transaction (A) (e.g., takes the trading opportunity from transaction A), is necessarily considered problematic for the trader that generated transaction A. Luckily, a solution to this problem emerged recently, i.e., bloXroute provides private transactions, which are not made publicly known until they are actually mined, giving peace of mind to traders.
DeFi trading, much like traditional trading, is an activity that calls for high speed and strategy: traders must capitalize on every millisecond of speed improvement possible in order to glean advantages over the competition. Our research shows that fast latency can increase the probability that a transaction is included in the next block by 12%, and thus gives traders an advantage because their transaction can be propagated faster than through the P2P network. Moreover, real-time transaction data adds to this advantage by enabling traders to learn about relevant transactions sooner and act accordingly. To protect users from malicious front-running attempts, bloXroute recently introduced private transactions as part of its front-running protection solution, which only reveals transactions to the public after they are mined. Indeed, every millisecond counts!
Notice: Information contained herein is not and should not be construed as an offer, solicitation, or recommendation to buy or sell securities. The information has been obtained from sources we believe to be reliable; however no guarantee is made or implied with respect to its accuracy, timeliness, or completeness. Authors may own the crypto currency they discuss. The information and content are subject to change without notice. Visionary Financial and its affiliates do not provide investment, tax, legal or accounting advice.