laitimes

The Evolution of Order Book DEXs: What's Changed in the Decade?

author:MarsBit

原文作者:LINDABELL

原文来源:chainfeeds

The Evolution of Order Book DEXs: What's Changed in the Decade?

As the throughput of the chain increases, decentralized transactions will eventually return to the order book model

LINDABELLAPR 23, 2024Share

The Evolution of Order Book DEXs: What's Changed in the Decade?

In recent years, DEXs based on the AMM model have flourished. However, for users who trade frequently, although the AMM model avoids the risk of entrusting assets to centralized participants, it still has the problems of high gas fees, unsuitable for large transactions, and poor user experience. Ethereum OG Gollum also pointed out in Twitter Spaces that the biggest advantage of AMMs is gas efficiency, but their transaction form does not conform to PMF. In contrast, the order book offers the advantages of flexibility, capital efficiency, and the ability to implement a variety of complex trading strategies through APIs. He believes that as the throughput of the chain increases, decentralized transactions will eventually return to the order book model. That's why he chose to become a Degate Evangelist evangelist.

Of course, whether it's an AMM or an order book, it's security, user cost, and user experience that ultimately determine its adoption. This article selects a few representative projects, some of which are still being explored, while others have disappeared. Maybe we can find something out of it.

Bitshares:EOS 创始人构建,DeFi 发展基石

In 2014, Dan Larimer launched BitShares, the first decentralized exchange. BitShares introduced a series of new concepts, many of which were later borrowed by DeFi projects. First of all, BitShares launched a market-anchored asset system, including bitUSD, bitEUR, bitCNY, and more. The value of these assets on the BitShares platform is equal to the value of real money, e.g. 1 bitUSD is equivalent to 1 USD, but requires BitShares' native token BTS to be backed as collateral and automatically liquidated by a smart contract to guarantee cashability. Second, BitShares employs a delegated proof-of-stake based algorithm that allows those who hold BTS to participate in the network's running and decision-making. Each BTS token is equivalent to one vote, and the top 101 holders with the most votes can package and settle the transaction and receive fee income from it. In addition, BitShares has made use of a technology called graphene to increase transaction processing speeds, and transaction fees are very low, with a fee of less than $0.01 per transaction.

The Evolution of Order Book DEXs: What's Changed in the Decade?

Although BitShares' trading fees and speed are comparable to centralized exchanges, it hasn't continued to grow as expected. One of the reasons for this may be that the cost of awareness and education of users about this new type of exchange is too high. In addition, BitShares simply moves the form of order book trading on-chain, which is unattractive.

BitShares forked in 2020 because in the BTS 4.0 version upgrade, some developers modified the code of the voting system without a community vote, which caused dissatisfaction and controversy in the community. In 2018, BitShares founder Dan Larimer launched EOS, a smart contract blockchain known as the "Ethereum killer".

Etherdelta: The mode is simple, but there are performance bottlenecks

In June 2017, EtherDelta was officially launched and registered with the U.S. Securities and Exchange Commission (SEC) before going live. Similar to Bitshares, Etherdelta is also an order book DEX. On EtherDelta, users can issue, revoke, and match buy and sell orders through trading contracts, while paying gas fees. Once the counterparty clicks on the order, the trading contract automatically deducts the buyer's assets and sends them to the seller, all transactions occur on-chain and are recorded by the smart contract, while the user's assets are always kept in their own wallets. In addition, EtherDelta charges a 0.3% transaction fee, which is borne by the buyer. While EtherDelta has low transaction fees and fast transaction speeds, it also has some issues. For example, the transaction matching process requires manual user operation, Ethereum's throughput limits lead to slower transaction speeds, and the delay in the order book can lead to transaction failures and wasted gas fees.

The Evolution of Order Book DEXs: What's Changed in the Decade?

Despite these problems, EtherDelta has a simple model, and with the development of the Ethereum ecosystem and the improvement of user education, it has accumulated a considerable number of users and considerable trading volume in less than a year after its launch. Unfortunately, however, in October 2017, EtherDelta was hacked, and at least 308 Ethereum and other potentially hundreds of thousands of dollars worth were stolen. Subsequently, the SEC charged it with violating the Securities Exchange Act, and founder Zachary Coburn agreed to settle with the regulator and paid a $388,000 fine. Next, Zachary Coburn put EtherDelta up for sale. On February 18, 2018, it was revealed that EtherDelta was suspended from trading. On February 19, 2018, the EtherDelta founding technical team announced a fork and launched a new trading platform called ForkDelta.

Loopring: The first ZK Rollup to go live, with a focus on differentiators

With the advent of the DeFi boom, the transaction throughput problem of the L1 network has begun to become prominent, and DEXs have begun to explore the expansion to Layer 2. Launched in late 2019, Loopring is the first Ethereum-based DEX protocol built on ZKRollup, leveraging ZKP technology to enable high-throughput and non-custodial transactions. Loopring has gone through several iterations, with the initial version only supporting bookbook trading, the second version enhancing privacy and security by introducing ZKP technology, and the third version adding support for AMM mode to make the DEX more liquid.

The Evolution of Order Book DEXs: What's Changed in the Decade?

As you can see, Loopring combines both DEX and ZK narratives. In terms of performance, Loopring uses ZKP technology to complete all the matching logic off-chain, and submits it to the chain by generating proofs, which not only ensures the efficiency of transactions, but also ensures its security and validity. In addition, Loopring has also launched an order sharing model. When a smart contract is unable to execute the entire order in a single transaction, this feature splits the order into smaller parts for trading until the original order amount is completed. Specifically, Loopring's on-chain transaction ring matching technology will aggregate multiple individual orders into an order ring, and after the smart contract verifies the order, each participant will exchange assets according to the rules of the order ring. The order-sharing system continues to operate until all partial orders have been fully executed. For example, if Investor A wants to sell A tokens, Investor B wants to buy A and sell B tokens, Investor C wants to buy B and sell C tokens, and so on until Investor A gets the desired currency. This trading cycle guarantees the best price to all trading participants and also provides access to a higher level of liquidity.

In terms of security, Loopring uses ZKP technology to ensure that every off-chain match will generate a proof and submit it to the chain to prove that the result is correct. In addition, even in the extreme case of an exchange outage, users can still claim the legitimacy of their assets by providing valid Merkle proofs, which can be obtained from data on Ethereum. However, Loopring is currently still STAGE 0 on L2Beat, mainly due to the lack of an exit window. The Loopring team also previously said on the call that it is currently working on creating a safety committee and is working to increase the security level on L2Beat, with some updates planned for this year to provide users with more layers of security.

Compared to other DEXs, Loopring focuses on differentiation, which is why it has introduced many new features and products designed to provide users with a unique experience. For example, the smart wallet product has built-in support for the Loopring ZKRollup solution, opened up the fiat currency channel, users can easily recharge through credit cards and bank cards, launched a block trading function similar to the traditional stock market, and provided a complete set of Layer 2 NFT solutions, including open minting, pending order trading and transfers. In addition, it is worth noting that Loopring founder Dong Wang and former Loopring Chief Architect Brecht Devo also co-founded the EVM-equivalent ZK Rollup project Taiko in 2022 and closed a $15 million Series A funding round in March this year, led by Lightspeed Faction, Hashed, Generative Ventures, and Token Bay Capital. To date, Taiko has raised a total of $37 million through three rounds of financing.

dYdX: Focusing on the derivatives market, it is committed to achieving a completely decentralized operation

Another DEX that has moved to L2 due to L1 throughput issues is dYdX. Unlike Loopring, dYdX focuses on the derivatives market and chose to build on the StarkEX L2 solution provided by StarkWare. Initially, dYdX was deployed on the Ethereum mainnet and was only a margin trading protocol. However, with the soaring Ethereum gas fees, dYdX could not afford the gas fees for users, so it decided to migrate to Layer 2 and set up an order book-based trading system.

StarkWare's StarkEX L2 solution was chosen because it was more in line with dYdX's needs. The solution is not only capable of processing transactions in batches, but is also compatible with a wide range of smart contracts. Although developing an application on Starkware requires learning its unique language, Cairo, the advantages that come with it are more appealing than the other advantages it brings, including significantly lower gas and transaction fees, traders can trade multiple perpetual contracts using a single margin account, resulting in increased capital efficiency when trading multiple token pairs, cross-margining and higher scalability, allowing for real-time liquidation, and more.

With StarkWare's infrastructure, dYdX has established itself as a unique position in the decentralized exchange market. However, dYdX wants to achieve a fully decentralized operation model, so it decided to launch a dedicated chain based on the Cosmos SDK to manage order books and other businesses in a completely decentralized way. dYdX V4 is designed to be fully decentralized, end-to-end, with the front-end run by the dYdX Operations SubDAO and the order book and matching engine managed by active validators around the globe.

The Evolution of Order Book DEXs: What's Changed in the Decade?

Specifically, the user makes a transaction on the frontend, and the order is routed to a validator, who broadcasts the transaction to other validators and full nodes to update the order book. The consensus process selects a validator as the proposer and is responsible for matching the order and adding it to the next proposed block. The proposed block goes through a consensus process, and if more than two-thirds of the validators confirm the block, it is submitted and saved to the on-chain database of all validators and full nodes, otherwise it will be rejected. Once committed, the updated on-chain data is transferred from the full node to the indexer, where it is ultimately made available to the frontend and other external services via APIs and Websockets.

At present, dYdX has open-sourced its V4 code, and plans to focus on building a permissionless marketplace in 2024, including allowing users to list any market at any time, providing instant liquidity through LP vaults, etc., to further improve the core trading functionality and user experience. In terms of security, dYdX V3 is currently STAGE 1 on L2Beat.

DeGate: Focus on security and create the ultimate user experience

DeGate is an Ethereum-based decentralized order book protocol based on ZK Rollup, positioned as a Layer2 focusing on decentralized transactions. DeGate is the only ZK Rollup project on L2Beat to achieve a STAGE 2 rating, which means that DeGate does not rely on human intervention and social consensus, and has a high degree of trust assumptions. In DeGate's security architecture, the state-validity verification and data availability are effectively guaranteed by the ZK Rollup technology. And through mechanisms such as non-custodial storage of assets and "escape mode", the security of user assets and the accuracy of transactions are ensured.

The Evolution of Order Book DEXs: What's Changed in the Decade?

DeGate effectively reduces transaction costs and improves transaction speed through off-chain order matching and order book management, but how to ensure the correctness of off-chain state changes is crucial. First of all, DeGate is built on ZkRollup, mainly because ZK Rollup naturally guarantees the correctness of its state through zero-knowledge proof cryptography, and does a better job of extending the trustless attribute of L1, without introducing additional security assumptions that are difficult to evaluate.

The Evolution of Order Book DEXs: What's Changed in the Decade?

In the DeGate structure, users access the DeGate website through the wallet and initiate a transaction request, and then the DeGate trading system processes the user's order, in which the Operator plays an important role, responsible for processing each batch of ZK Rollup events according to the rules, generating the DeGate L2 block zkBlock, and calling the circuit (ZKP-Worker) to generate the zkBlock proof, which is submitted to the on-chain contract to confirm the state change. At the same time, the Merkle tree updates the accounts, assets, and orders of the DeGate protocol. As you can see, the DeGate circuit is at layer 2, it receives zkBlock as input data and checks the input data for accuracy before generating zero-knowledge proofs to prevent inconsistencies that could lead to irreversible errors.

DeGate chose Groth16 for its zk-SNARK construct because of its shorter verification time and smaller proof size, which means less data needs to be transferred to the blockchain, reducing the gas cost of processing transactions on the Ethereum blockchain. While Groth16 is more compliant with DeGate, its biggest drawback is the need to perform a trusted initialization for each circuit. To support more features, DeGate plans to adopt more advanced zero-knowledge proof schemes such as Halo2 to reduce transaction costs and meet more demand while protecting user privacy and asset security.

As for privacy, DeGate's privacy design focuses on protecting users' personal information and assets, rather than being used in privacy systems. Through various encryption technologies, such as digital signatures and public key cryptography, DeGate provides adequate protection for the user's original information. Every transaction on DeGate's Layer 2 is settled on-chain, and the zero-knowledge proof generated by the circuit contains all user asset changes, and all transactions are open and transparent.

In addition, in DeGate, users have full control over their funds because the assets are held in custody in a smart contract. The order signature is valid until the order is fully filled, and the circuit verifies the signature and expiration date of the order to reduce the risk of manipulating the order. And DeGate also offers the option of on-chain cancellation, which guarantees 100% trustlessness. Once the DeGate node aggregates this cancellation request transaction on-chain, the order will be marked as closed and will never be matched again.

DeGate also has a built-in "escape mode" that allows users to withdraw their own funds when the DeGate off-chain Operator is unable to process the transaction. "Escape Mode" is triggered if the forced withdrawal has not been processed for more than 15 days. Once triggered, users can directly call the DeGate smart contract to retrieve the asset. In "Escape Mode", the smart contract will reject new Rollups, which means that the state of all DeGate accounts and assets will remain the same as the final state of the Rollup before activating "Escape Mode". The smart contract will then process all assets based on the final state, and users can use a third-party service to parse the latest account and asset status and retrieve their assets from the smart contract. This mode has been successfully tested. In November 2022, DeGate shut down its L2 node on the Rinkeby network, and the community and team tested the "escape mode" and successfully retrieved the assets.

On the premise of ensuring security and decentralization, DeGate has also introduced a series of innovative trading mechanisms to provide users with a more efficient and convenient trading experience:

  • Batch spot trading mechanism: Although ZK Rollup can significantly reduce the data size, it is still inefficient. According to the data, it takes 72 bytes to complete a transaction match in a traditional ZK Rollup order book. To this end, DeGate has introduced a bulk spot trading mechanism that intelligently bundles and compresses multiple transactions before being added to a DeGate Layer2 block, and then cryptographically generates validity proofs and submits them to the Ethereum mainnet. It is reported that this mechanism can bundle more than 9 transactions between different users, and only consumes 83 bytes before being put on the chain.
  • Decentralized grid trading: The function of AMM is implemented through limit orders, without the need for smart contracts as the underlying support. By bundling constants such as the number of levels of a grid policy, grid bias, and so on into each grid transaction signature, DeGate eliminates the need for users to sign multiple transactions, simplifying the complexity associated with users.
  • Decentralized Auto-Investing: There is no additional fee for DeGate's auto-investing feature. This feature is an ideal choice for users who are looking for stable income, which not only allows users to have custody of their assets, but also is cost-effective and efficient.

DeGate officially entered the mainnet stage on January 9 this year, and its TVL has exceeded $61.82 million, and the cumulative turnover has exceeded $1.04 billion. As infrastructure and ZK technology evolve, DeGate is working to improve scalability and reduce transaction costs. These include measures such as improving ZK computing efficiency and deploying DeGate to other active Layer 2s. At the same time, in order to be compatible with the Ethereum scaling roadmap and EIP-4844, DeGate plans to launch DeGate 2.0. This release will leverage the blob data scheme introduced by EIP-4844 to increase DeGate throughput and further reduce user gas charges.

summary

From BitShares to DeGate, we can clearly observe the evolution of the orderbook DEX. Initially, the project simply migrated the traditional orderbook model on-chain. Over time and the development of the market, there has been a growing awareness of the high cost of gas and the lack of user experience. Against this backdrop, projects are constantly exploring new transaction models to address these pain points. For example, Loopring combines an order book and AMM model and differentiates to bring users a unique experience, while dYdX focuses on the derivatives market and launches a dedicated chain, while DeGate chooses to provide users with a CEX-like experience while maintaining the highest level of security. There is reason to believe that with the introduction of measures such as EIP-4844, the user experience of order book DEXs will be further improved.

Read on