Skip to content
Branch: master
Find file History
Type Name Latest commit message Commit time
Failed to load latest commit information.
ABI/version30 Revert "Update abi (#272)" (#273) Jul 15, 2019
circuit Update CMakeLists.txt Jun 14, 2019
contracts [Protocol3] Add check for invalid accountID for token transfers (#263) Jul 12, 2019
docker [Protocol3] add script for contracts docker image build (#277) Jul 18, 2019
ethsnarks @ d0effc7 [Protocol3] add ProtocolFeesUpdated event (#258) Jul 11, 2019
migrations [Protocol3] Misc small improvements + More tests (#241) Jul 2, 2019
operator [Protocol3] Some minor cleanup/enhancements + More tests (#253) Jul 4, 2019
test [Lightcone_V2.js] add grpc-web dependency (#252) Jul 8, 2019
util [Protocol3] Misc small improvements + More tests (#241) Jul 2, 2019
.gitignore [Lightcone.js] successful (#238) Jun 28, 2019
.soliumignore protocol3: fix lint issues (#57) Mar 28, 2019
.soliumrc.json Protocol3: split exchange code into multiple small libraries. (#58) Mar 29, 2019
.travis.yml remove Errors.sol (#26) Mar 23, 2019 [Protocol3] Misc small improvements + More tests (#241) Jul 2, 2019
CMakeLists.txt move packages to packages dir Mar 18, 2019 [Protocol3] Revert design updates Jun 5, 2019
LICENSE move packages to packages dir Mar 18, 2019
Makefile fix test on mac Apr 26, 2019 Update (#254) Jul 4, 2019 move packages to packages dir Mar 18, 2019 move packages to packages dir Mar 18, 2019
globals.d.ts [Protocol3] WIP: signing in JS May 30, 2019
install remove Errors.sol (#26) Mar 23, 2019
package.json [Protocol3] rename ProtocolFeeManager to ProtocolFeeVault (#250) Jul 3, 2019
truffle.js [Protocol3] Misc small improvements + More tests (#241) Jul 2, 2019
tsconfig.json [Protocol3] Calldata compression (#221) Jun 25, 2019
tslint.json [Protocol] Fee model update Jun 5, 2019

Loopring Protocol (V3) using zkSNARKs


This is a very early version of Loopring's order-based DEX protocol (version 3.0). The code base is still being tested and is not production ready.

To understand several concepts introduced by the Loopring Protocol, such as order-ring, ring-matching, dual-authoring, free-burning, please read our whitepaper for Loopring Protocol 2.x.

To understand the overall design for Loopring 3.0, including Ethereum smart contracts and zkSNARKs circuits, please refer to the DESIGN doc. The design of the backend relayer system is and will not be covered by this document. We welcome any feedback regarding the design and our implementation, feel free to email us or submit pull requests.

Top Features

  • Onchain data-availability (DEXes can opt out for even greater throughput & lower cost)
  • All ERC20 tokens and Ether are supported by default
  • Multiple on-chain DEX instances with isolated state and dedicated event stream (different from 2.0)
  • Onchain deposit + on-chain & offchain withdrawal support
  • Support offchain order cancellation and order time-to-live settings (inherited from 2.0)
  • Allow partial order matching (aka partial fill) and offchain order-scaling (inherited from 2.0)
  • Multiple circuit permutations for different request batch sizes
  • Use any ERC20 token or Ether as the trading fee to reduce friction(inherited from 2.0)
  • DEX can buy down fee token burn rate (inherited from 2.0)
  • An enhanced version of dual authoring prevent orders/trades from being stolen by a middleman (enhanced on top of 2.0)
  • On current Ethereum mainnet, throughput is about 60 trades/second with on-chain data-availability, and ~350 trades/second without data-availability -- which can be further optimized in the near future.
  • A built-in mechanism to force DEX operators to fulfill duties in time (especially for handling deposits and withdrawals)
  • Support DEX operators to stake tokens to "buy" credit
  • Support a "maintenance mode" for DEX operators to upgrade backends within a time window
  • Support a unique feature called Order Aliasing (new to 3.0)
  • 100% secure for end users, even when DEX operators are evil (same as 2.0)
  • and more...


  • SNARKs require trusted setups
  • Circuits not yet audited (smart contract auditing should be easy and we are very experienced)
  • Can switch to better hash function
  • and more...


npm run build // first time or npm run compile or npm run watch.


The code of our circuits is currently not open source. If you have access to the private repo protocol3-circuits please clone it and update the circuit_src_folder variable in circuit/CMakeLists.txt so it points to the correct folder.


Run Unit Tests

  • run npm run ganache from project's root directory in terminal.
  • run npm run test from project's root directory in another terminal window.
  • run single test: npm run test -- transpiled/test/xxx.js
  • print info logs in tests: npm run test -- -i
  • print more detailed debug logs in tests: npm run test -- -x

Running all tests takes around 3 hours on a modern PC with a CPU with 4 cores. Creating proofs is computationaly heavy and takes time even when multi-threading is used. Run individual tests when you can.

Verifier/Prover keys are cached in the keys folder. When updating the circuits make sure to delete the keys of older circuit versions because this is not automatically detected.

You can’t perform that action at this time.