Introducing Block Trade on Loopring: Giving L2 Users Self-custodial Access to Multiple Liquidity Sources

Steve Guo
Loopring Protocol
Published in
5 min readMay 15, 2023

Loopring is introducing a new feature this week that enables users to seamlessly swap specific token pairs by tapping into centralized exchange (CEX) liquidity. Now any user can access leading liquidity and low slippage from across crypto, from the security of their own self-custodial wallet.

For small to medium-sized decentralized exchanges (DEXs), a significant obstacle to active trading is the lack of liquidity or market depth, particularly for larger traders. When users attempt large swaps, the automated market maker (AMM) pool may not have sufficient liquidity, leading to a substantial price impact. Loopring’s solution aims to address this problem.

By leveraging its underlying protocol, Loopring offers a new feature called “Block Trade” that utilizes multiple liquidity sources, particularly CEX liquidity, to serve users while they remain in control of their own assets. These swap transactions occur directly between dedicated entities and do not affect existing DEX liquidity or the prices for other users. This process is similar to block trading systems found in traditional stock markets, where large, privately negotiated transactions take place outside of the open market through private purchase agreements.

To better understand this process, let’s introduce a Market Maker (B) with accounts on both Loopring Layer 2 (L2) and a CEX.

Suppose a Loopring user (A) wants to sell LRC tokens for USDC. The process would proceed as follows:

After the transaction, A receives USDC, and B receives LRC. Since B has already sold the same amount of LRC on the CEX, their assets remain balanced across both accounts (Loopring L2 and CEX). This allows B to fulfill A’s request and facilitate the trade immediately.

The example above is a simplified illustration. In some cases, B’s L2 asset balance might not be sufficient for the trade. When this scenario happens, user A must choose between:

  1. Trading as much as possible at the desired price, potentially waiting for B’s account to rebalance before receiving all tokens.
  2. Trading immediately at the desired price, but only trading the amount currently available in L2 to receive the tokens instantly.

Once A submits an order with a specific amount, B will execute a corresponding trade on the CEX, making the transaction irreversible. Based on A’s choice, B will know how much to trade on the CEX.

In either scenario, A’s tokens remain locked until B’s L2 account has enough tokens to complete the transaction, ensuring that A’s assets are always securely held in their own self-custodial wallet. The rebalancing between B’s L2 and CEX accounts can be event-triggered or time-triggered to guarantee A receives tokens within a predetermined time frame.

One additional aspect to consider is the pegging between USDT and USDC. In the decentralized finance (DeFi) space, USDC is more commonly used, while in centralized finance (CeFi), USDT is preferred. The final solution will incorporate this USDC-USDT conversion for a complete experience.

It’s important to note that any entity could theoretically act as a market maker in the future, though currently Loopring Labs fulfills this role.

Risk Disclosure:

When using Loopring’s innovative Block Trade solution, it is essential for users to understand any potential risks involved. This system offers two options for swapping tokens: immediate liquidity on Layer 2 or waiting for the maximum swap amount. While these options provide flexibility, they also vary in some risks that users should be aware of.

Option 1: Trade as Much as Possible

In this case, users may need to wait for the market maker to rebalance their L2 liquidity by sourcing additional funds from the centralized exchange (CEX). While waiting, users’ tokens may be locked for up to 24 hours. The risks associated with this option include:

  • Inaccessibility: During the lockup period, users cannot access, use, or withdraw their locked tokens for up to 24 hours
  • In the rare case that the market maker fails to provide the necessary liquidity within 24 hours (something happened to Loopring relayer or market maker), the user would have to wait indefinitely for these services to be back online for the swap to execute — in this worst case the user could make the the choice to do a protocol level force withdrawal of their original funds back to Ethereum L1, but this can take up to 14 days in some cases — but good to note that the users original funds are still never at risk of being lost or stolen as they always remain in the users custody

Option 2: Trade Immediately on L2

In this scenario, the process operates like a regular swap. Users can see the amount of tokens they will receive, and the relayer facilitates the swap between the market maker’s L2 account and the user’s L2 account. There is no risk in this scenario, as it operates very similarly to a L2 DEX swap from the user’s perspective.

The benefit of this scenario is near immediate execution, with CEX level liquidity and low slippage, which could be better execution than other options directly on L2.

It is crucial to remember that Loopring’s L2 is a zkRollup Layer 2 architecture built on Ethereum, ensuring that users always maintain self-custody of their funds. This means that users do not need to trust Loopring to keep their funds safe, and in the worst-case scenario, they can force a withdrawal back to the Ethereum network without Loopring’s permission.

By understanding the potential risks and the safeguards in place, users can make better informed decisions when using Loopring’s token swaps, ultimately benefiting from its innovation and flexibility.

About Loopring

Loopring is an Ethereum Layer 2 zkRollup protocol for scalable, secure DeFi and NFT applications. Loopring builds non-custodial, high-performance products atop our L2, including the Loopring Wallet — a mobile Ethereum smart wallet, and the Loopring L2 web app — an L2 orderbook and AMM DEX. To learn more, follow us on Medium or see Loopring.org.

TwitterDiscordRedditGitHubDocsYouTubeInstagram

--

--