Analysis of Loopring: Using zk-Rollups to Scale Decentralized Exchanges
Source: Cryptopedia
Compiled by: Hu Tao, Chain Catcher
What is Loopring?
Loopring is a Layer 2 scaling protocol for decentralized exchanges (DEX) based on the Ethereum blockchain, capable of processing thousands of transactions per second. The Loopring technology serves as a protocol layer used in DEX, and the platform also offers Loopring Exchange, a non-custodial trading platform that provides secure, fast trading without any gas fees.
Loopring utilizes zero-knowledge proofs (ZKPs) to allow anyone to build high-throughput, non-custodial DEXs. Loopring also uses its native LCR token to reward zero-knowledge rollup (zk-Rollup) operators and liquidity providers.
Loopring's Zero-Knowledge Rollups (zk-Rollups)
Many DEXs like Uniswap utilize automated market makers (AMMs) to match buyers and sellers. These AMM protocols automatically execute trades using liquidity pools instead of traditional order books, with liquidity pools being crowdsourced asset pools used to provide liquidity. Compared to centralized exchanges (CEXs) that use order books, DEXs often have lower trading fees and support a wider range of digital assets. However, centralized exchanges still benefit from stronger liquidity and higher throughput than DEXs. Loopring aims to bring the best of centralized exchanges into the decentralized ecosystem by leveraging advanced innovations in blockchain technology—zk-Rollups.
zk-Rollup is a Layer 2 functionality—meaning this technology operates above the main blockchain—it integrates with the Ethereum network to enhance scalability. zk-Rollup can bundle hundreds of transactions together and convert them into a single, minimal data zero-knowledge proof, which is then batch confirmed on the Ethereum network. This allows for a higher transaction throughput than what Ethereum currently handles individually. The zk-Rollup computation occurs off-chain, while the data and transactions never leave the Ethereum blockchain. Integrating the zk-Rollup process with DEX protocols enables more complex computations, which means lower transaction fees and significantly improved liquidity optimization.
In the broader context of the Ethereum network, using zk-Rollups to validate transaction blocks is faster and cheaper because less data is included, and only smart contracts are needed to verify the final, lightweight cryptographic proof. These transactions are also written to the Ethereum blockchain as calls to reference data, which requires much less computation compared to extracting data from the network. By combining all these features into a single open protocol, Loopring accelerates the adoption of blockchain technology by enhancing the efficiency of the entire Ethereum ecosystem.
Loopring's Cryptographic Technology Unbundling: OCDA, Ring Miners, Order Rings, Order Sharing
While zk-Rollups represent the technology powering Loopring, it is their implementation that makes the multifaceted protocol so useful, especially through its latest Loopring 3.0 update. Loopring features an on-chain/off-chain switch called OCDA, which can significantly speed up transaction times when data is available for off-chain computation. Loopring also leverages high-throughput arbitrage mechanisms that utilize order rings, order miners, and order sharing systems to achieve near-instant internet-scale liquidity.
On-Chain Data Availability (OCDA): The Loopring cryptographic protocol employs a feature known as on-chain data availability (OCDA). This hybrid method of data storage allows users to choose whether their data is stored on-chain or off-chain. When the OCDA feature is turned off, data is stored on-chain, enabling the network to achieve 2,025 transactions per second (TPS). However, if OCDA is enabled and data is stored off-chain—using a so-called Validium model—throughput can reach 16,400 TPS. By utilizing innovations like OCDA in Loopring 3.0, non-custodial exchanges may be able to match the performance of their centralized custodial competitors.
Ring Miners: The Loopring protocol uses a unique consensus protocol that bypasses traditional order books and AMM mechanisms for managing liquidity pools. Instead, network participants known as ring miners are responsible for quickly filling orders before they are executed or canceled. Those operating as ring miners receive service fees in the form of LRC tokens (the native token of the Loopring protocol) or share in the margin on the order amounts.
Order Rings: When ring miners complete an order ring, Loopring's smart contracts determine how to fill it. If it can execute the order on either side of the trade, the smart contract will perform an atomic swap—transferring directly from the smart contract to the user's wallet. Order rings also facilitate ring matching, which is the process of completing orders by stringing together orders and settling multiple trades across several users. Order rings distinguish the Loopring protocol from other DEXs like Waves, IDEX, and Bancor.
Order Sharing: The order sharing feature can also be implemented through order rings on the Loopring protocol. In cases where the Loopring protocol's DEX smart contracts cannot execute an order in a single transaction, order sharing is used to break the order into partial components until the original order amount is fulfilled. Ring matching technology aggregates multiple individual orders into a single order ring. After the Loopring protocol's smart contracts validate the orders, each party receives assets in exchange. Orders run as part of subsequent order rings through the order sharing system until these partial orders are fully executed.