This developer portal provides technical information for software engineers and product managers to comprehend and adopt the solution. We welcome our community to send us feedback to enhance these documents.
Loopring is a layer-2 protocol that consists of multiple smart contracts to verify tradable orders and perform trade settlement on-chain while keeping all order management off-chain. Loopring features a generic design with matching-as-a-service, ring-matching, and anti-front running (dual-authoring technology). We strongly encourage you to read our new whitepaper and previous blog posts as it is the best way to understand the protocol. If you have any questions, you can send us an email, or post questions on StackOverflow or Reddit. You can also learn more about the Loopring Protocol here.
There is a significant lack of security, transparency, and liquidity in centralized exchanges. Loopring invented a new trading experience built upon blockchain and smart contract technologies. Through our whitepaper and this developer portal, you will see that Loopring DEXs are non-custodial and perfectly secure: all trades are verified and recorded on the blockchain for absolute transparency, and every Loopring order can be trustlessly shared with as many parties as possible, which allows for greater liquidity and trade price improvement.
The Loopring Foundation provides open-sourced, ready-to-deploy solutions for our community to develop the DEX frontend with apps (a.k.a wallets), the DEX backend (a.k.a relayers or matching engines), along with liquidity sharing middleware. We also provide free-of-charge consulting and technical support.
We have multiple patents in the US, the European Union, and China to protect the design and implementation of the Loopring Protocol. Before deploying a trading protocol on any public blockchain, please make sure your smart contracts don't include the ring-matching and dual-authoring features; otherwise, you must obtain our formal authorization for using our patents in writing.
All DEX solutions suffer low TPS (transactions per second) and high latency imposed by the underlying blockchains' slow block-times. Ethereum's current TPS is about 15 and block-time is roughly 15 seconds. Without a higher TPS, Loopring's trading experience won't be a match for centralized exchanges; but once Ethereum's TPS scales to 1000 or above, we believe the overall DEX trading experience will be even better than centralized exchanges.
Loopring and all DEX protocols are not designed for high-frequency trading (HFT). We do not view this as an issue, and seek to provide the best trading experience for regular traders and investors. Further, we believe HFT is not necessarily fair for regular traders, and has been dramatically misused for market manipulation of crypto prices.
Loopring and Kyber are designed for different use cases and are complementary to each other. Loopring features third-party matching-as-a-service (MAAS), whereas Kyber is a market-making protocol where market-makers offer their clients liquidity at promised prices within a given period. Kyber is more comparable to the Bancor protocol.
Loopring and 0x are both order-based exchange protocols. We share many common designs, including:
But we are also very different in many other ways:
Unlike the rigid business model of centralized exchanges, Loopring's technology offers you the ability to become part of the decentralized exchange ecosystem. Let's take a look at the Loopring DEX ecosystem illustrated by the image below:
Loopring can turn any application or web page into a DEX. A DEX retrieves and displays orders and trades and may show submit-order and cancel-order forms for users to manage their trading data. In our model, a DEX does not have access to users' private keys. If it does, we refer to it as a Wallex (Wallet + DEX). Orders generated by a DEX must be signed from within a wallet such as a Ledger or MetaMask before being sent to a relayer.
Loopring brings a new stream of income to DEXs and Wallexs- 20% of matching fees will be rewarded to a DEX that helps users generate their orders. This portion of fees will be automatically transferred to each DEX and Wallex's fee-collecting address by the Loopring Protocol after each trade has been settled, guaranteed!
Frontends have the option to connect to one or multiple relayers, given that permission is granted. In the graph above, "Frontend 8" connects to only one dedicated relayer. This is more like the centralized exchange model where liquidity is not shared, and there is a single point of relayer failure (albeit still non-custodial). "Frontend 7" connects to one dedicated relayer while also sharing large orders to "Relayer D" to speed up trading; "Frontend 5" always broadcasts orders to "Relay D" and "Relay C" to maximize trading speed and minimize price spread; and "Frontend 3" evenly shares liquidity across two liquidity sharing networks through "Relay B"and "Relay C".
Connecting and broadcasting users' orders to multiple relayers and the liquidity sharing networks increase the likelihood of orders being fulfilled. The network topologies and business relations between frontends, relayers, and the liquidity sharing networks are entirely up to each entity in the ecosystem; the Loopring Foundation doesn't impose any rules.
If you are not happy with 20% profit sharing, you can also run your own relayer cluster to collect further order fees.
Relayers manage orders and trades, and offer the non-custodial order-matching services as options. Relayers can receive orders from as many frontends as possible without trusting any of them. This opens the door to build a larger liquidity pool than any centralized exchange.
Relayers receive 80% of matching fees, but it doesn't come for free: Relayers must pay Ether as gas for ring-settlement transactions on the Ethereum blockchain, and pay fiat money for cloud services.
Besides liqudity sharing among different frontends using the same relayer, relayers can also share liquidity with each other by joining the same liquidity sharing network. The Loopring Foundation provides a pub-sub based implementation of such a network, but ecosystem partners can build their liquidity sharing network with their technology stack of choice. The Loopring Protocol does not have a standard for liquidity sharing.
Each liquidity sharing network may have their own internal economic model to incentivize order sharing: rewarding order producers and charging order receivers. This is not explicitly part of the Loopring Protocol.