How to use efficient Mempool service to profit from DeFi?

--

his article is from encryption Valley Live (ID: cryptovalley) , Author: Keeper DAO, translation: Olivia, Odaily Daily Planet was reprinted with permission.

Traders analyze the Ethereum Mempool (mempool), which can greatly increase the probability of profit

What is Mempool (memory pool)

Mempool is a group of Ethereum transactions that have been broadcast to the network and are waiting to be packaged into blocks. Mempool service can directly track the life cycle of transactions. When the transaction is broadcast to the node by the user, it will wait in the Mempool, and then the transaction will be packaged into a block or abandoned by the network. A good Mempool service will monitor every transaction that exists in this process for you. You can learn more about Mempool here.

How is Mempool used for DeFi transactions?

Traders analyze the Ethereum Mempool to greatly increase the chance of obtaining MEV (miner extractable value). There are many different types of trading strategies that Mempool can apply. Some of these strategies involve looking for trading opportunities that didn’t exist. Therefore, since these Mempool services entered the market, the DeFi transaction ecosystem has undergone tremendous changes.

  • Front running: Determine the Gas price required to win the Gas auction.
  • Back running: According to the transaction result of another user, predict the transaction opportunity and pack it into the future block.
  • Sandwiching: predicting trading opportunities, by pushing another user’s trading opportunities to the maximum slippage limit, thereby predicting future blocks, which will lead to arbitrage opportunities at a later time (usually within the same block).
  • Generic predator (predator): hijacking transaction calls, hoping to run Gas auctions in Front running to obtain MEV (miner extractable value). This is usually done by replacing the address of the original trader with the address of the Predator and submitting a new transaction at a higher Gas price.

Contestant

Although the companies and products we discuss below provide a variety of products and services, the focus of our discussion this time is their Ethereum Mempool function.

BloXroute

BloXroute is a blockchain acceleration network (BDN) that uses a global server network to optimize network performance. They invested a lot of resources to build network infrastructure for Ethereum DeFi traders and builders. You can learn about their development on their blog. Their Mempool feature is called “Subscribe to NewTX Stream” and can be found on their product pricing page. There you will find various other useful features, many of which will help you build a more powerful DeFi product and gain trading advantages in the market.

BloXroute sends you Mempool events via websocket connection. They are very fast and contain all the information, which means you can filter transactions in your terminal. Therefore, if you are following transactions on Uniswap, you can simply filter based on the Uniswap address of interest.

Blocknative

Blocknative operates a global Mempool data platform that spans Bitcoin and Ethereum. They specifically provide Mempool services for Ethereum DeFi traders and builders. You can read their latest development on their blog. Their Mempool feature is called “Mempool Browser”, and you can find relevant information on their products.

Blocknative will send you Mempool events through webhooks based on your watch list, which is hosted on Blocknative’s server. Therefore, if you are following transactions on Uniswap, you can simply add the Uniswap address to your watch list and then you can start receiving webhook events.

Alchemy

Alchemy will provide basic Bitcoin and Ethereum node facility services. They provide a very convenient API endpoint for Ethereum DeFi traders and builders. Their Mempool function is called “alchemy_newFullPendingTransactions” and can be found in their documentation.

Alchemy sends you Mempool events through a websocket connection. These events contain all the information, which means you have to filter on your terminal. Therefore, if you are following transactions on Uniswap, you can simply filter based on the Uniswap address of interest.

Performance benchmark

We have used these three services extensively in DeFi transactions and have seen huge differences in their performance. Below is an overview of the performance test results and all the data obtained, where performance is measured in milliseconds of delay. We connect all three services to our keeper robot and monitor Uniswap’s router contract, and record the time when each service reports incoming transactions. Once recorded, this information is mapped out and made available to the public.

Assume that the baseline of each transaction is the baseline when the first Mempool service discovers the transaction. Therefore, the first service that discovers a transaction will be positioned with zero delay, and the delay of each service after that will be equal to the time difference between its discovery and the first service.

The data in this picture paints a very clear picture. The delay of BloXroute always runs on the zero line. The latency of Blocknative is always slightly worse than that of BloXroute. Alchemy’s situation is very bad, sometimes even several seconds later than other services.

If we zoom in further, Blocknative is always behind BloXroute by about 175ms. If you are operating a large transaction with hundreds or thousands of transactions per day, this will make a big difference.

BloXroute was the first to detect 228 transactions out of 235 transactions.

Why is it important to have the fastest Mempool service?

The above experimental results show that the trader’s choice of Mempool service directly affects their profitability. According to data from ethstats.net, the current Ethereum block time is only 13 seconds on average. 180ms behind, or worse, more than 1000ms will greatly reduce your trading profit and reduce the possibility of transactions being packaged in the next block. At the same time, lag will reduce your reaction time in the Gas auction.

Comparison of Websockets and Webhooks

It is worth comparing the two event delivery methods used by these Mempool services. Technically speaking, Websocket should be faster, but its reliability may be slightly worse. Using Websocket connection, the client may miss an event when disconnecting. When using Webhooks to connect, each Mempool event you receive has its own network connection, which pushes events for each Mempool event. This may add a small amount of latency overhead, but it also adds some reliability. It is worth mentioning that traders may prefer lower latency, while DeFi product builders may prefer relatively reliable.

Best performance and redundancy solution

If you are a trader and want the best of both worlds in terms of performance and reliability, here are some redundant solutions that might work for you.

Solution A) Use the fastest service, BloXroute, and connect to multiple gateways. You can run your own BDN gateway on your own server, or you can connect to multiple managed gateways. You can also specify that these gateways are distributed in different regions, so that if there is a problem with the network in one region, you will not completely lose access to Mempool within a period of time.

Solution B) Use multiple Mempool services. This way you can get data as fast as possible. If one service goes down for any reason, you have another service you can rely on. The only downside here is that it doubles the cost of your Mempool service.

price comparison

All price comparisons are based on 2020–12–4. Please note that the feature list and price structure of each service are variable at any time.

Compared with other services, BloXroute’s pricing is very generous. The $240 professional version is very valuable, considering that you get the best-performing Mempool service with zero rate limit, and a lot of other useful features.

Blocknative’s pricing is difficult to compare with BloXroute’s pricing for several reasons: First, they only provide Mempool service, so you won’t get anything extra like BloXroute. Secondly, they set a daily API event limit, which may not seem like a problem at first glance, but it is actually a huge limit. Let’s take a look at how this leverages the information from the benchmark test above.

Assuming you are a DeFi trader and you are using Back running, you will want to monitor all Mempool transactions that come to Uniswap. In fact, you will want to do this on a large number of agreements, much more than just Uniswap. But let’s keep it simple and just focus on a single Uniswap router used above. In the benchmark data, let us focus on the first and last data input so that we can get the approximate daily transaction volume for comparison with the daily limit of Blocknative API events.

The test starts from the first transaction and ends with the last transaction. That is, from 11381311 block to 11381328 block, the time span is about 4 minutes. During this time, we evaluated 235 transactions. There is approximately one transaction every second. Since there are 86400 seconds per day, this means there are approximately 86400 transactions per day. This is approximately 8 times the rate limit of Blocknative’s production plan. This pushes you to Growth, which is $833 per month. But this is problematic, because if Uniswap becomes more popular, you will be rate-limited and forced to jump to the $8,300 monthly leader plan (Leader). This can quickly become very expensive.

Alchemy’s pricing is usually very flexible. However, Mempool’s specific pricing is not friendly to your rate limiting performance. If you want to track transactions, which requires you to monitor all incoming transactions to Uniswap, you will eat your rate limit in a very short time. Alchemy even mentions this in their documentation.

The maintenance cost of the alchemy_newFullPendingTransactions subscription type is extremely high and requires a large number of calculation units, because it sends out complete transaction information, not just transaction hashes. We do not recommend non-enterprise users to keep this subscription type open for a long time.

Use these services VS to operate your own nodes

Generally speaking, it is not difficult to run and maintain your own node, especially if you simply use it for Ethereum calls. However, Mempool is a different way of operating. In the early days of Mempool transactions, traders will obtain Mempool information from their own nodes. This is where the competition is fierce. Whoever has a better Mempool infrastructure will have a slight advantage over others in every trading opportunity. And when you multiply this weak advantage by the hundreds of daily trading opportunities, you will have a huge advantage.

If you don’t want to use one of these services, you want to operate the network yourself. You will need a network of nodes scattered throughout the world. Ideally, you would also need Geth and Parity nodes because they behave somewhat differently. You may even want to configure various nodes in different ways to reflect the way you predict that miners may configure their nodes. Most miners today run Geth, so you may be able to run only Geth. But when you have a large trading operation, you have to cover your base as much as possible.

Cost is also an important factor. You have to consider the cost of running your own nodes on servers all over the world. At the same time, consider the time cost of your development of a system that can route all these transactions from your node network to your trading robot.

in conclusion

BloXroute is undoubtedly the best Ethereum Mempool service, suitable for automated DeFi traders of large-scale transaction operations. Not only do they provide the lowest latency, but they also have the most friendly rate limit (almost none) and reasonable prices. And although we believe in your own nodes, most traders are unlikely to operate their Mempool infrastructure as low-cost and high-performance as BloXroute.

--

--

比特币新闻 — 区块链新闻
比特币新闻 — 区块链新闻

Written by 比特币新闻 — 区块链新闻

区块链新闻,比特币行情,比特币价格分析,数字货币新闻资讯