0x Roadmap 2019: Introducing the Coordinator

星球君的朋友们
本文约4974字,阅读全文需要约20分钟
The first DeFi liquidity solution that offers competitive pricing.

Editor's Note: This article comes fromEthereum enthusiasts (ID: Ethfans)Ethereum enthusiasts (ID: Ethfans)

main points

  • , Author: Tom Schmidt, translation & proofreading: Min Min & A Jian, reproduced by Odaily with authorization.

  • first level title

  • The coordinator model integrates the two relayer models of order matching and open order book: market makers can cancel orders for free and instantly, and users/developers can use the fillable contract liquidity mechanism (CFL) to drive independent Ethereum applications.

introduce

first level title

introduce

image description

In this article, we are going to discuss a solution that integrates two relay modes: Coordinator, the full name is Trade Execution Coordinator (TEC). The main purpose of this model is to allow market makers to provide aggressive bid-ask spreads and deep liquidity, while also allowing third-party smart contracts to consume this liquidity in a more flexible way. The coordinator model is the first DeFi liquidity solution that provides competitive pricing for third-party contracts and their end users.

image description

first level title

MakerDAO

What we usually call "fillable contract liquidity (CFL)" means that by combining different smart contract systems, users can decide how to consume liquidity. Essentially, under this liquidity mechanism, smart contracts can be invoked in any order to execute transactions. This enhances interoperability between different protocols, reduces development time, and lowers the cost of acquisition. Projects using the liquidity mechanism of fillable contracts include:

If you want to close a pledged debt warehouse, you must buy enough DAI to pay off the debt in the pledged debt warehouse, and buy enough MKR to burn it, and then you can get back the pledge. This is all done automatically with one transaction.

dY/dX

-Automatic management of pledged debt warehouses-

In the process of opening or closing a position with margin, the user needs to lock the collateral and fill in the order to open the position at the same time. Wouldn't it be nice to take advantage of the liquidity of a decentralized exchange and do it with just one transaction? In addition, the liquidity of decentralized exchanges can also be used to automatically avoid liquidation risks.

image description

Forwarder contract

transaction contract

secondary title

transaction contract

There are many arbitrage opportunities on the blockchain. Many trading bots utilize common proxy contracts to simultaneously trade across multiple decentralized exchanges, reducing the risk of arbitrage to zero. In this example, the trader was able to earn 0.759 ETH risk-free.

first level title

The key to a market or exchange is to ensure there is an order book that is priced reasonably and provides a great experience for both buyers and sellers. To do this, an exchange needs to be created where market makers can profitably provide liquidity. Without creating a profitable environment for market makers, it is impossible for an exchange to maintain liquidity in the long run.

Arbitrageurs will violate the interests of market makers, especially in decentralized exchanges. Arbitrageurs can automatically arbitrage risk-free through smart contracts, and the high latency of the Ethereum blockchain will lead to order books and markets. deviation. Decentralized exchanges that implement off-chain order on-chain settlement mode (0x relayers) need to cancel orders through on-chain transactions, which leads to relatively slow price updates. Decentralized exchanges (Kyber, Uniswap, Bancor) that run entirely on-chain also require on-chain transactions to update prices. Arbitrage veterans often front-run and cancel orders to benefit themselves at the expense of liquidity providers (see frontrun.me). In this case, market makers have to widen the price difference to hedge against this risk, making decentralized exchanges less competitive than centralized exchanges in terms of price.

This shows that an ideal decentralized exchange model should be composable, while making it difficult to use the high latency of the network to achieve aggressive arbitrage. Our goal is to satisfy both of these requirements in the initial version of the coordinator model.

soft cancel

The key to creating a price-competitive liquid market is the ability to update prices quickly without the risk of front-running. The order matching model already achieves this - users can ask operators to "soft cancel" their orders without going through an on-chain transaction. Because there is an operator who is responsible for submitting the settlement results to the blockchain, the operator only needs to promise not to settle the canceled orders on the blockchain. Although the existence of the operator brings trust risks to the entire system, this will make the entire process auditable, and it is possible to take measures to further reduce financial risks. Usually, if an operator commits fraudulent behavior by not adhering to the "soft cancellation", he will be punished much more than he can profit. In addition, orders can also be canceled through on-chain transactions, so adding soft cancellation is a major improvement.

The coordinator also adopts a similar soft cancellation mechanism. Market makers can create orders and quickly update prices without paying any fees. This reduces the risk of arbitrageurs filling stale orders and allows market makers to provide liquidity at a lower cost. According to data from June 14th to July 2nd on Bamboo Relay, there were approximately 237,000 soft cancellations. If these were all hard cancellations that occurred on-chain, it would consume about 18.4 ETH in gas fees.

Selective delay transaction (Select Delay)

While soft cancellation alone can greatly increase liquidity, the coordinator model is designed to enforce additional trading rules—different trading mechanisms—to get better prices. For example, with a 1-second delay between submitting a fill request and actually executing the trade, market makers can cancel orders before they are filled and offer lower spreads to make a profit. When combined with selective delays and soft cancellations, market makers are less likely to lose money on stale prices while effectively eliminating many arbitrage opportunities.

In order to compete with large equity exchanges, more and more start-up exchanges are favoring selective delays, such as IEX in the United States and TSX alpha in Canada. They have introduced selective delays into their trading mechanisms, taking away volume from traditional exchanges in North American stock markets and, in the process, delivering huge benefits to initial users. For example, Edwin Hu (2018), an economist at the U.S. Securities and Exchange Commission (SEC), once conducted a survey on how small retail investors obtained better prices during the price wars of these start-up exchanges. Importantly, the adoption of optional delays appears to be driving growth. Two Canadian exchanges saw monthly volume increases of around 4% immediately after the adoption of selective delays (Market Press 2018).

  • first level title

  • many in one

  • The coordinator model uses special extension contracts and server design to achieve soft cancellation, and adopts new transaction mechanisms such as selective delay, while ensuring composability. These extended contracts are relatively simple to understand - 0x orders are matched through smart contracts, and can only be traded after the approval of the corresponding coordinator. In summary, the order transaction is divided into the following steps:

  • The taker needs to be approved by the corresponding coordinator to fill a 0x order.

  • The coordinator waits for 1 second.

If the order is not canceled, the coordinator approves the order and indicates the transaction validity period.

Before the expiration of the order validity period, the order taker can fill the order at any time.

image description

-The user requests the coordinator to approve the order, and then the order is executed-

first level title

Next step?

The first coordinator demo is intended to serve as a proof of concept and reference implementation, though we think the 0x team has a lot of room to innovate and improve on this basic model.

Resolution of transaction conflicts and front-running transactions

In the current implementation of the coordinator, the coordinator may issue a signature license to multiple order takers at one time, allowing the order takers to complete an order. Therefore, if two traders try to fill the same order at the same time, only one of them will succeed and the other will fail. The portion of the gas consumed by the failed transaction is wasted. This problem also exists with the current open order book relayer model, and will become more common as DEX volumes increase.

However, if the coordinator only issues permission to one user at a time, there may be users who demand to fill all the orders on the order book, but the transaction is delayed. This way, they prevent other users from making transactions, and gain a risk-free arbitrage opportunity as long as the cost of stalling the order is zero. There are many interesting solutions to explore here. For example, users who want to close orders can be required to lock a part of the collateral; or to prevent sybil attacks by punishing delays in orders.

Thanks to Amir Bandeali and Peter Zeitz for writing the first draft of this article.

appendix

first level title

appendix

secondary title

Note on arbitrage

Arbitrage refers to placing buy and sell orders in different markets at the same time, and earning the difference from them. This behavior is crucial for regulating prices between different markets. However, arbitrage can adjust prices in a variety of ways, and not all adjustment mechanisms are equally beneficial to exchange users.

One such adjustment mechanism is passive arbitrage. Passive arbitrage means that market makers will create and cancel limit orders on multiple platforms, and provide liquidity on platforms with favorable prices. For example, assuming a large buyer takes up all the ETH sell orders on Binance, the market maker will transfer its limit sell orders to Binance to fill the short-term lack of liquidity on Binance. Likewise, the maker will want to update their quotes on other exchanges, pushing the quotes up to match the quotes on Binance. Under passive arbitrage, price adjustments occur silently without causing a spike in trading volume. Similarly, when adjusting prices through passive arbitrage, sudden price fluctuations will not cause market makers to suffer losses.

Another adjustment mechanism is aggressive arbitrage. Aggressive arbitrage refers to the situation where the order maker continuously scans the order book of the exchange, looking for limit orders that do not meet the market price, and then makes a lot of money. Whenever there is a sudden price fluctuation on a certain exchange, you can go to other exchanges to find this kind of limit order that does not meet the market price, but this opportunity is fleeting. Automatic taker robots take advantage of this opportunity to fill orders before the order maker cancels the order. Under the influence of aggressive arbitrage, a sudden price movement on one exchange is followed by a surge in trading volume on other exchanges. Additionally, market makers often suffer huge losses during periods of spikes in trading volume.