Understanding Loopring and Dolomite
We at QuikNode spend a lot of time understanding different Web3 protocols & applications which have the potential for significant adoption. Loopring and Dolomite both use QuikNode infrastructure to achieve high-performance and comfort while building their products.
Loopring Protocol, Dolomite DEX, and the evolution of Web3 tech
We at QuickNode spend a lot of time understanding different Web3 protocols & applications which have the potential for significant adoption. Loopring and Dolomite both use QuickNode infrastructure to achieve high-performance and comfort while building their products. Today, we will deep-dive into Loopring’s inner workings, and also look to understand Dolomite, its neat interface and modular approach to building a decentralized exchange (DEX).
The Loopring Protocol
Loopring is the name of restless innovation to build a decentralized exchange protocol. If you follow their development, you will understand Loopring’s thirst for problem-solving in the DEX protocol space.
A few months back, Loopring introduced protocol version 3.0. In this version, Loopring is leveraging a Zero-Knowledge Proofs (ZKP) system to achieve high-transaction throughput. The key idea is to use Ethereum’s blockchain as data storage (efficiently), and the ZKP system to validate the system’s transitions.
To achieve scalability, Loopring designed a Merkle tree. Every participant in Loopring’s ecosystem will have an account in this Merkle tree. The Merkle tree also maintains the token balances, as well as trading history for all the participants using the Loopring protocol.
By maintaining balances off-chain, updating balances becomes cheap and fast, as we do not need to create a blockchain transaction whenever we update the balance.
This Merkle tree’s data persists on Ethereum blockchain to provide data-availability, and anyone can re-create the whole Merkle tree by processing the state transitions stored in Ethereum’s blocks.
How Does Loopring Work?
- A Maker creates a buy order. This order goes into an Exchange’s centralized order book. Once this order is matched, an Operator will step into the picture for further processing (*an Exchange can be an Operator too).
- The Operator’s task is to validate the order and create a Zero-Knowledge Proof (ZKP) for the trades, so Loopring Smart Contracts can perform trade settlement.
Let's stop here and first understand the role of an Operator in detail:
What is an Operator?
In Loopring’s ecosystem, an Operator’s task is similar to that of a miner (e.g. a Bitcoin miner in Bitcoin’s protocol). At any given point in time, this Merkle tree represents the state of the whole Loopring protocol. The state of the Merkle tree transitions to new states when an Operator creates a block.
Every block (remember, this is not an Ethereum block) represents a state transition. Deposits, withdrawals, and trades (like events) need to be updated in the Merkle tree by using these state transitions.
Operators combine multiple trades and other information in a block and commit these blocks to the Ethereum blockchain. This process is speedy and cheap, but remember this state transition is still not verified.
To verify that an Operator has followed the correct rules for creating a block defined by Loopring, the Operator needs to generate a proof for the committed block. This proof will be produced using zk-SNARKs (a Zero-Knowledge system), which is a time-consuming and computation-heavy task.
So we now have a “Commit and Verify” system. In the Commit part, an Operator creates a block and commits it on-chain, so other Operators can start building on this newly committed state. In the meantime, the Operator begins working on the proof generation (Verify part). Once the proof is generated, the Operator commits the proof on-chain and the block is verified. This verification is the real finality, as this state can’t be reverted if block is verified and all its previous blocks are also verified in sequence.
- Loopring Smart Contracts verify these blocks and allow state transition. Once the state is transitioned, Loopring Smart Contracts emit events. Exchanges listen to these events and inform traders about trade settlements.
Operators or Exchanges Going Rogue
A question always comes to mind: what if an Exchange or Operator do not perform their duties, or create a hostile situation? Loopring’s protocol design also prevents these types of cases:
- To create an Exchange, you need to stake LRC tokens. In a situation where an exchange goes rogue or shuts down abruptly, Loopring protocol starts slashing its stake.
- Let’s say an Operator does not verify its committed blocks in a given time, Loopring protocol starts withdrawing its committed blocks.
Loopring Performance in Numbers
Using off-chain balances and zk-SNARKs, Loopring has the potential to become the fastest DEX protocol in whole Ethereum ecosystem. In Loopring 3.0, it has achieved a high trade throughput with minimum on-chain cost.
Loopring Token Model
The most fascinating part is Loopring’s token incentive change. There are two significant changes from previous versions:
- LRC is no longer a fee-token for trades.
- LRC can be staked to provide security, reduce trade fees, earn reputation, and reap participation rewards.
Protocol Fee
In version 3, Loopring introduced a protocol fee, from 0.001% up to 0.255%. The protocol fee is applied to the token being bought, on the amount bought.
Yes, now LRC is not a fee-token anymore. This is not only an improvement in LRC token’s utility model, but will also help in DEX User-Experience (UX). Traders needn’t worry about the protocol fee as DEXs will be responsible to pay this fee on behalf of traders.
Protocol Pool Staking (Global)
Now, anyone can stake LRC and get a part of 70% of the protocol fees of all exchanges built atop the Loopring protocol.
- Who: Anyone
- How much: User receives an amount proportional to the amount staked + how long it is staked
- How long: Each token needs to be staked for at least 90 days.
Protocol fee pool distribution
- 70% to LRC stakers
- 20% to the yet-to-launch Loopring DAO
- 10% burned
This model gives a huge incentive to hold LRC as you can stake them to earn protocol fee.
Security and Fee reduction
An exchange built atop Loopring needs to stake LRC tokens to operate. This up-front stake ensures user security as DEXs will be punished for their irregular behavior. A DEX can also stake LRC to get a discount on the protocol fees, as well as earn reputation. For more details, read here.
Loopring version 3.0 design has been stress-tested and the numbers are fascinating. If you want to understand Loopring’s new design in detail, read here.
Now let’s talk about Dolomite DEX!
Dolomite DEX
Now that we understand how Loopring is going to change the DEX landscape, let’s also look at Dolomite, a decentralized exchange built using Loopring v3!
What is Dolomite?
Dolomite is a decentralized exchange with goals to solve scalability and UX problems (common among DEXs), using the Loopring protocol. Dolomite takes a modular approch for building a DEX and aims to build all the blocks which will provide for a complete trading experience for traders.
How does Dolomite work?
Let’s understand Dolomite in comparison to a centralized exchange (CEX).
- In a CEX, exchanges take the custody of your funds. With Dolomite, Smart Contracts take custody of your funds (these Smart Contracts are openly-verifiable and audited).
- When you create an order on a CEX, it goes to a central CEX database. With Dolomite, it’s the same. A cryptographically signed order will go to Dolomite’s centralized database.
- When an order matches, the CEX executes the order and updates your token balances. In Dolomite, when an order matches, Dolomite sends the request to Loopring’s protocol, which then settles the order.
The main point to notice here is that Dolomite will never have control of your funds, eliminating the security risk. Funds are controlled by Smart Contracts created by Loopring and governed by the Ethereum blockchain. If a user wants to withdraw their funds, the protocol ensures that no one restricts the withdrawal.
Why is Dolomite different?
Most DEXs suffer from a liquidity problem. Ethereum process around 15 transactions/second and every dApp built atop Ethereum has to share this transaction throughput. Dolomite and Loopring both understand this problem and use the Ethereum blockchain optimally (only for final trade settlement).
By using the Loopring protocol, Dolomite is ready to achieve >200 transactions/sec throughput, which is quite remarkable (as most DEXs process around 2–5 transactions/second). Loopring not only provides high transaction throughput but also solves the front-running problem with Dual Authoring.
The front-running problem paralyzes DEXs, where an order is fulfilled by entities who are responsible for processing the order/transaction (e.g. Miners, Relayers, Ring Matchers, or Operators).
Dolomite Tech
Dolomite has one of the fastest matching engines, built using the Akka framework (written in Java/Scala). It enables Dolomite to process more than 5 million trades/sec.
Dolomite Portfolio Manager
Dolomite has also built a Portfolio Manager, which shows their commitment to building an open & transparent DEX solution, and providing all useful tools to their users. Even if you don’t do crypto trading, you can still use the Portfolio Manager as a stand-alone solution. It shows all of your transactions and trades in a single place, with beautiful visualizations. The best part is that Dolomite does not retain this information.
Try Dolomite
Dolomite is currently in beta stage, but you can check out the platform and play around with it. Dolomite also created APIs for third-party apps, so if you are a developer, you can build cool things with Dolomite.
DEXs & Traders using QuickNode
QuickNode is used by DEXs and traders alike.
DEXs require speed to deliver a fast & fluid user experience. QuickNode dedicated Ethereum nodes are some of the most performative Ethereum nodes in the ecosystem.
With 8 node locations around the world, dApp operators can minimize network hops and latency by spinning up a node closest to their web/app servers and users.
Most web3 and eth APIs (httpProvider or websocket) are supported, including txpool
and pendingTransactions
, as well as event subscriptions (PUB/SUB) and transaction batching.
Receive data quicker, react quicker.
Traders also use QuickNode to their advantage when the Ethereum blockchain becomes congested (or public node services are degraded), also giving them the ability to push more transactions per block.
QuickNode and Web3 Infrastructure
QuickNode is all about helping developers and entrepreneurs build applications for the Web3 ecosystem. We worked with both Loopring and Dolomite to provide powerful Ethereum node infrastructure, and also reducing their business and developer costs for maintaining Ethereum nodes in-house.
QuickNode Ethereum nodes provide a high-performance API endpoint so Web3 products can deliver the best user experience to their customers.
QuickNode is fully committed to providing the most high-performing and reliable Web3 infrastructure, and supporting the ecosystem in every manner.
Need help with your project or have questions? Contact us via this form, on Twitter @QuickNode, or ping us on Discord!
About QuickNode
QuickNode is building infrastructure to support the future of Web3. Since 2017, we’ve worked with hundreds of developers and companies, helping scale dApps and providing high-performance access to 16+ blockchains. Subscribe to our newsletter for more content like this and stay in the loop with what’s happening in Web3! 😃