Be a crypto hero in the market by logging in

Don't you have an account? Sign in

Token price

  • BTC

    8,422,726.0KRW

    1.2%

  • ETH

    179,264.2KRW

    2.8%

  • XRP

    224.4KRW

    1.0%

  • USDT

    1,240.4KRW

    0.1%

  • BCH

    294,124.5KRW

    1.3%

  • BSV

    219,942.7KRW

    0.8%

  • LTC

    54,759.1KRW

    -0.5%

  • EOS

    2,912.0KRW

    1.6%

  • BNB

    17,065.7KRW

    3.4%

  • XTZ

    2,096.3KRW

    1.5%

  • XMR

    66,424.7KRW

    2.2%

  • XLM

    51.6KRW

    1.2%

  • HT

    4,586.4KRW

    5.0%

  • ADA

    40.0KRW

    0.8%

  • TRX

    14.8KRW

    1.1%

  • USDC

    1,237.8KRW

    -0.1%

  • CRO

    60.4KRW

    2.8%

  • DASH

    84,335.2KRW

    0.9%

  • ETC

    6,370.5KRW

    1.3%

  • HEDG

    2,167.2KRW

    2.3%

  • NEO

    8,839.4KRW

    2.7%

  • ATOM

    2,533.2KRW

    3.5%

  • XEM

    47.4KRW

    2.1%

  • ZEC

    41,095.9KRW

    2.7%

  • MKR

    390,291.5KRW

    5.3%

  • ONT

    485.0KRW

    3.5%

  • PAX

    1,236.8KRW

    -0.1%

  • DOGE

    2.3KRW

    0.4%

  • BAT

    184.1KRW

    3.0%

  • ELAC

    402.2KRW

    1.1%

  • VET

    4.0KRW

    1.0%

  • LINK

    485.1KRW

    2.0%

  • TUSD

    1,237.1KRW

    0.1%

  • HBAR

    41.3KRW

    -0.0%

  • DCR

    14,802.9KRW

    2.9%

  • BTG

    9,021.5KRW

    -0.7%

  • ICX

    295.4KRW

    0.8%

  • QTUM

    1,589.6KRW

    2.2%

  • ALGO

    223.9KRW

    12.9%

  • LSK

    1,210.0KRW

    0.7%

  • INB

    390.2KRW

    1.1%

  • REP

    12,157.1KRW

    1.0%

  • ZRX

    193.2KRW

    1.1%

  • WAVES

    1,178.6KRW

    -0.1%

  • CNX

    2,112.5KRW

    1.4%

  • BCD

    611.8KRW

    2.5%

  • RVN

    19.2KRW

    0.8%

  • XIN

    204,092.1KRW

    -0.6%

  • XIN

    204,092.1KRW

    -0.6%

  • NANO

    744.2KRW

    7.1%

  • MONA

    1,496.6KRW

    0.7%

  • ENJ

    120.5KRW

    7.9%

  • MCO

    6,202.1KRW

    1.8%

  • OMG

    687.4KRW

    1.4%

  • KCS

    1,176.3KRW

    1.6%

  • DGB

    6.8KRW

    4.4%

  • THETA

    100.5KRW

    7.2%

  • STEEM

    221.8KRW

    -4.8%

  • NEXO

    139.5KRW

    2.3%

  • QNT

    6,137.1KRW

    -3.4%

  • BTM

    71.6KRW

    1.9%

  • BTM

    71.6KRW

    1.9%

  • SC

    1.7KRW

    3.6%

  • SNT

    20.5KRW

    -4.6%

  • ABBC

    119.4KRW

    1.7%

  • VSYS

    33.0KRW

    11.5%

  • KMD

    509.4KRW

    -13.7%

  • BTS

    21.7KRW

    3.0%

  • SXP

    937.0KRW

    -4.8%

  • HC

    1,245.3KRW

    1.6%

  • BCN

    0.3KRW

    12.6%

  • XVG

    3.2KRW

    1.0%

  • ZIL

    5.0KRW

    2.5%

  • INS

    1,233.7KRW

    2.5%

  • IOST

    4.0KRW

    1.6%

  • ELF

    83.4KRW

    6.1%

  • GNT

    43.5KRW

    -0.7%

  • ARDR

    40.7KRW

    0.8%

  • CHZ

    8.7KRW

    4.9%

  • WAX

    36.3KRW

    -0.4%

  • MATIC

    14.4KRW

    1.2%

  • XZC

    3,957.6KRW

    2.1%

  • AE

    126.3KRW

    2.7%

  • RIF

    62.8KRW

    2.8%

  • LRC

    34.7KRW

    0.1%

  • STRAT

    346.1KRW

    0.3%

  • MANA

    32.5KRW

    1.4%

  • NPXS

    0.1KRW

    2.1%

  • AION

    79.9KRW

    0.6%

  • ANT

    917.0KRW

    -3.0%

  • POWR

    68.7KRW

    -1.2%

  • MAID

    63.9KRW

    0.7%

  • ELA

    1,525.9KRW

    10.2%

  • TRUE

    345.0KRW

    1.6%

  • CTXC

    106.6KRW

    -9.1%

  • ETN

    2.6KRW

    -1.5%

  • ORBS

    12.3KRW

    1.6%

  • ARK

    199.7KRW

    1.1%

  • RDD

    0.8KRW

    8.6%

  • OCEAN

    67.3KRW

    15.3%

  • PAI

    16.0KRW

    0.3%

  • PAI

    16.0KRW

    0.3%

  • GRIN

    604.0KRW

    4.3%

  • TOMO

    328.0KRW

    1.0%

  • WTC

    294.1KRW

    3.8%

  • WAN

    164.3KRW

    0.1%

  • BORA

    30.1KRW

    6.5%

  • BEAM

    333.7KRW

    3.2%

  • FCT

    2,151.0KRW

    -2.3%

  • NAS

    341.2KRW

    4.0%

  • DAI

    1,258.0KRW

    1.5%

  • LOOM

    18.0KRW

    0.1%

  • PIVX

    303.9KRW

    -1.5%

  • CVC

    24.6KRW

    3.1%

  • QASH

    46.8KRW

    3.0%

  • IGNIS

    21.0KRW

    -0.4%

  • BNT

    228.1KRW

    0.9%

  • GRS

    198.5KRW

    -0.5%

  • PPT

    276.9KRW

    2.1%

  • DAD

    223.6KRW

    2.6%

  • FET

    18.2KRW

    1.4%

  • LAMB

    18.8KRW

    20.1%

  • NXS

    186.9KRW

    1.2%

  • MOAC

    193.3KRW

    1.3%

  • POLY

    24.2KRW

    1.2%

  • DENT

    0.1KRW

    0.8%

  • TTC

    25.3KRW

    -0.6%

  • AOA

    1.5KRW

    -1.2%

  • ODE

    45.6KRW

    1.9%

  • ABT

    99.0KRW

    6.0%

  • MBL

    1.7KRW

    2.5%

  • CET

    11.6KRW

    0.7%

  • GO

    9.1KRW

    1.6%

  • SYM

    123.7KRW

    3.0%

  • GTO

    11.8KRW

    -0.3%

  • CPT

    2.4KRW

    --%

  • FTM

    4.1KRW

    3.4%

  • REPO

    67.2KRW

    26.3%

  • COSM

    11.0KRW

    1.2%

  • CELR

    2.0KRW

    -1.5%

  • ANKR

    1.8KRW

    1.4%

  • GUSD

    1,244.4KRW

    1.1%

  • AERGO

    26.5KRW

    4.0%

  • MOC

    18.5KRW

    0.7%

  • NAV

    97.3KRW

    -0.1%

  • R

    13.1KRW

    0.2%

  • FLETA

    6.8KRW

    2.2%

  • SOC

    3.8KRW

    4.5%

  • UPP

    15.9KRW

    0.8%

  • PAY

    38.4KRW

    8.7%

  • BCV

    5.0KRW

    1.5%

  • TROY

    2.4KRW

    -0.7%

  • AMO

    0.3KRW

    -0.0%

  • MIX

    2.0KRW

    0.3%

  • APIX

    0.6KRW

    2.1%

  • FNB

    1.6KRW

    4.2%

  • RFR

    0.7KRW

    -0.3%

  • PROM

    599.5KRW

    -0.0%

  • BAAS

    0.6KRW

    -7.4%

  • HUM

    6.2KRW

    6.8%

  • PRO

    54.7KRW

    5.5%

  • DCC

    0.9KRW

    --%

  • MVL

    0.3KRW

    5.0%

  • EOSC

    2.5KRW

    5.6%

  • eDEL

    2.4KRW

    -0.7%

  • RBG

    0.7KRW

    1.0%

  • AKRO

    1.9KRW

    50.4%

  • ABL

    8.0KRW

    3.8%

  • VRA

    0.5KRW

    6.4%

  • BWX

    46.1KRW

    -7.1%

  • EGG

    4.3KRW

    4.0%

  • AIDUS

    3.9KRW

    -2.0%

  • XST

    44.1KRW

    -1.2%

  • LYM

    1.7KRW

    6.3%

  • RBTC

    8,285,913.8KRW

    1.2%

  • KARMA

    0.2KRW

    19.2%

  • CLB

    2.0KRW

    3.7%

  • NGC

    13.6KRW

    10.8%

  • PTON

    0.1KRW

    -1.8%

  • UBEX

    0.3KRW

    0.4%

  • PXL

    24.7KRW

    -6.1%

  • LKY

    17.9KRW

    --%

  • YEED

    0.2KRW

    2.2%

  • ISR

    3.7KRW

    2.1%

  • CLR

    5.7KRW

    10.0%

  • TEMCO

    0.2KRW

    -2.0%

  • WET

    4.4KRW

    2.4%

  • FREE

    0.0KRW

    7.4%

  • AMON

    0.9KRW

    -0.8%

  • MEETONE

    0.3KRW

    0.5%

  • ZPR

    0.4KRW

    22.7%

  • XRA

    5.6KRW

    --%

  • ADT

    0.7KRW

    -85.6%

  • QDAO

    6,317.5KRW

    1.1%

  • BBC

    0.8KRW

    8.7%

  • NEWS

    1.5KRW

    16.0%

  • WIKEN

    0.9KRW

    -10.0%

  • NPER

    3.6KRW

    --%

  • IQ

    48.9KRW

    5.8%

  • HORUS

    0.2KRW

    -37.5%

  • PUB

    0.1KRW

    -3.4%

  • SEAL

    0.2KRW

    --%

  • VANTA

    0.1KRW

    8.6%

  • STAR

    0.5KRW

    -11.3%

  • PUT

    2.0KRW

    4.9%

  • CCH

    0.0KRW

    --%

  • KNT

    0.0KRW

    -3.1%

  • DRM

    8.8KRW

    97.2%

  • UOS

    1.0KRW

    49.0%

  • BLACK

    0.3KRW

    2.3%

  • RCD

    3.0KRW

    --%

  • MCC

    3.6KRW

    --%

  • INC

    0.1KRW

    0.7%

  • BZKY

    0.0KRW

    --%

  • CRE

    0.8KRW

    5.9%

Community

Loopring 3.0 Overview: From A to zkSNARKs

Loopring | 06.26| 165

This post is meant to provide a quick overview of how Loopring 3.0 works, and how we use zkSNARKs to enable scalable, secure DEXs. For a deep dive, you can check out the full design doc on GitHub.

Introduction

The third version of the protocol tackles the scalability problem of decentralized exchanges. Previous versions of the protocol already did the order matching off-chain, but the settlement was completely on-chain. This still has a high computational and storage cost on-chain.

Protocol 3.0 solves this by moving almost all data off-chain as well as moving all computations for all requests off-chain using zero-knowledge proofs (zkSNARKs).

Merkle Tree

Data is stored in a Merkle tree using an account model. Each user has a single account with a one-to-one mapping to his Ethereum address. This account can store balances for all tokens the exchange wants to support and also stores all the trading history data for the user. Requests modify the Merkle tree and the state transitions are verified on-chain using proofs.

Blocks

For efficiency reasons, requests are batched together in blocks. The cost for verifying a proof remains constant no matter the number of requests in a block, but we are limited in how many requests we can include in a block, otherwise, the proof verification on-chain would not be efficient anymore. How many requests we can include in a block depends on the complexity of the request. If multiple requests types would be included in a block there would be some overhead of doing computations that are only necessary for a single request type so we limit blocks to a single request type for now.

We currently support 5 different requests:

  1. Trade settlement
  2. Deposits
  3. On-chain withdrawal
  4. Off-chain withdrawal
  5. Off-chain order cancellation

Only the first three are necessary for building a fully functional DEX. The other two provide some extra flexibility for users and exchanges.

Once the DEX operator has committed a block on-chain he also needs to submit the proof for the block within a time limit. The commit of the block and the submitting of the proof is done separately because the proof generation currently takes some time. By allowing the DEX operator to commit the block first without having to wait on the proof generation allows other operators to create new blocks that build upon the state of the latest committed block and also allows the proof generation to be done in parallel. Once the proof is generated the operator can send the proof on-chain so the state transitions done in the block are verified. If the operator fails to submit a valid proof in time he is punished and the state is automatically reverted to a valid state.

Data Availability

Only the Merkle tree root is stored on-chain. This is sufficient for users to prove (using a Merkle proof) that they own a certain amount of tokens on the DEX. Even when the DEX operator doesn’t cooperate any more users can withdraw any funds they have in ‘withdrawal mode’.

Users need to be able to create a Merkle proof. For that, they need to have access to the complete Merkle tree, not just the Merkle root. In the best case, this data is made available somewhere by the DEX, but there is no guarantee that this is actually the case. To make sure all data is available for all users this data is sent on-chain (this is done using CALLDATA, not storage, which is cheaper and more future proof). Currently, this still has a high cost on Ethereum (though this will improve in the future) and this limits the maximum throughput that can be achieved. This is why we also support disabling on-chain data availability, DEXs are then free to implement some off-chain solution for this.

User Flow

Depositing

To start trading users first need to deposit some funds to the exchange smart contract. This is done using a normal on-chain transaction and the request is added to the on-chain deposit queue. Once the DEX operator includes the deposit request in a block the user can start trading.

Trading

A user signs an order a single time and the order contains all the data needed for a DEX to settle the order. The protocol supports

  • Maker/taker orders (using the same order)
  • Market orders
  • Fee payments to the DEX
  • Rebate payments from the DEX to an order owner
  • Automatic order scaling
  • Partial order matching
  • Dual-Authoring to prevent the stealing of orders and/or ring settlements

How the orders are matched is fully up to the DEX, but the settlement will respect the wishes of the order creator in all cases.

The DEX creates a ring settlement request by matching two orders and sends the request to the DEX operator who will include the request in a block to receive the fee specified in the request. The operator can then commit the block on-chain.

Withdrawing

If the user wants to withdraw their tokens from the exchange they need to do a withdrawal request. If the user does an on-chain withdrawal request the DEX needs to include it in a block in a reasonable time. If a certain amount of time has passed since the withdrawal request was done we first force the operator to process it by only making it possible to commit on-chain withdrawal blocks. If the operator still refuses to process the withdrawal request the exchange goes into ‘withdrawal mode’. ‘Withdrawal mode’ is irreversible and completely shuts down the exchange, the only thing that’s still possible is for the users to withdraw their funds. This ensures that users remain in full control of their money in all cases without having to trust anyone.

About Loopring

Loopring is a decentralized exchange protocol utilizing zkSNARKs to bring highly scalable, non-custodial trading to the masses. You can sign up for our bi-weekly update, and learn more at:

⭑ Twitter: twitter.com/loopringorg
⭑ Reddit: reddit.com/r/loopringorg
⭑ Telegram: t.me/loopring_en & t.me/loopringfans (Chinese)
⭑ Discord: discord.gg/KkYccYp
⭑ GitHub: https://github.com/Loopring
⭑ Kakao: open.kakao.com/o/gJbSZdF (Korean)


Loopring 3.0 Overview: From A to zkSNARKs was originally published in Loopring Protocol on Medium, where people are continuing the conversation by highlighting and responding to this story.

Comment 0

delete

Are you sure you want to delete this post?