All Projects → fluidex → fluidex-backend

fluidex / fluidex-backend

Licence: other
Building the first permissionless layer2 orderbook DEX on Ethereum, powered by PLONK zk-rollup

Programming Languages

shell
77523 projects
Makefile
30231 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to fluidex-backend

uniswap-python
🦄 The unofficial Python client for the Uniswap exchange.
Stars: ✭ 533 (+2120.83%)
Mutual labels:  dex, orderbook
eth-mimblewimble
Ethereum 9 3/4's zk-SNARKs circuits and the python library for Mimblewimble on Ethereum
Stars: ✭ 77 (+220.83%)
Mutual labels:  zk-rollup
NinjaDroid
Ninja Reverse Engineering on Android APK packages
Stars: ✭ 224 (+833.33%)
Mutual labels:  dex
plonk-by-fingers
Implementation of Plonk by Hand in rust
Stars: ✭ 32 (+33.33%)
Mutual labels:  plonk
jitana
A graph-based static-dynamic hybrid DEX code analysis tool
Stars: ✭ 35 (+45.83%)
Mutual labels:  dex
dusk-blindbid
Implementation of the blindbid logic within Zero Knowledge Proofs
Stars: ✭ 18 (-25%)
Mutual labels:  plonk
binance-websocket-examples
Example code in Nodejs that demonstrate how to subscribe to Binance Websocket server.
Stars: ✭ 124 (+416.67%)
Mutual labels:  orderbook
wyvern-ethereum
Project Wyvern Ethereum Smart Contracts
Stars: ✭ 209 (+770.83%)
Mutual labels:  dex
typescript-eth-starter
🔌 Ethereum Dapp Basic Typescript Starter
Stars: ✭ 125 (+420.83%)
Mutual labels:  layer2
k8s-ldap
Kubernetes - LDAP authentication with Dex
Stars: ✭ 59 (+145.83%)
Mutual labels:  dex
atomic-swap-kit-android
Atomic Swap Android library for Bitcoin (BTC) and Bitcoin Cash (BCH) swaps in decentralized manner. Implemented on Kotlin.
Stars: ✭ 17 (-29.17%)
Mutual labels:  dex
exchange
simple decentralized exchange using eos smart contract
Stars: ✭ 24 (+0%)
Mutual labels:  dex
sso
Single Sign On with OAuth2 and OpenID Connect, independent of LAIN
Stars: ✭ 22 (-8.33%)
Mutual labels:  layer2
orderbook modeling
Example of order book modeling.
Stars: ✭ 38 (+58.33%)
Mutual labels:  orderbook
serum-vial
Real-time WebSocket market data API for Serum
Stars: ✭ 154 (+541.67%)
Mutual labels:  dex
idex-sdk-js
IDEX v3 SDK built with TypeScript, supporting both web and Node environments.
Stars: ✭ 35 (+45.83%)
Mutual labels:  dex
entry
Attach to LAIN app container via `lain enter`
Stars: ✭ 71 (+195.83%)
Mutual labels:  layer2
dalvik
Dalvik parser in pure Rust.
Stars: ✭ 28 (+16.67%)
Mutual labels:  dex
dexdeps
查看dex中class, field, method内部与外部依赖
Stars: ✭ 23 (-4.17%)
Mutual labels:  dex
botdexdamar
🤖 multichain trading bot with sniper, frontrun, backrun, sandwich
Stars: ✭ 124 (+416.67%)
Mutual labels:  dex

FluiDex Backend

FluiDex team is building the first permissionless layer2 orderbook DEX on Ethereum, powered by PLONK zk-rollup.

This repo contains all the backend stuff, including exchange matching engine, rollup state manager, prover cluster (master and workers), and zk circuit codes. You can read through our design rationale here.

Currently it is only a demo/PoC version, and many features are still WIP.

Architecture

Components & Submodules

Submodules:

  • circuits: ZK-Rollup circuits written in circom. It lies in the rollup-state-manager submodule.
  • dingir-exchange: the matching engine server. It matches eddsa-signed L2 orders from users, and generates trades. It writes all the 'events' (e.g., orders/trades/balance updates) to the global Kafka message bus.
  • rollup-state-manager: maintaining the global rollup state Merkle tree. It fetches events/transactions from the Kafka message bus, and updates the Merkle tree accordingly, and generates L2 blocks.
  • prover-cluster: a master-workers cluster for proving PLONK ZK-SNARK circuits. It loads L2 blocks generated by rollup-state-manager, then proves them, and writes the proofs to databases.
  • regnbue-bridge: a L1-L2 bridge for fast withdrawal/deposit. Currently in the demo version, it acts like a faucet, sending some initial tokens to each new user of the FluiDex zk-rollup network.

Some external services:

  • Kafka: used as the global message bus.
  • PostgreSQL: the main database we use. It stores the match engine history/state, prover-cluster state, rollup (L2 blocks/L2 txs) state etc.
  • TimescaleDB: time-series databases, used for exchange market data (e.g., K-Line).

Some zero knowledge development tools developed by Fludiex team are used to process the circuits, including snarkit and plonkit

How to run it

Ubuntu 20.04 is the only supported environment currently. You could speed up the building following https://doc.rust-lang.org/cargo/guide/build-cache.html#shared-cache, and more documents can be found here.

# install some dependencies and tools
# including rust / docker / docker-compose / nodejs etc.
$ bash scripts/install_all.sh

# compile zk circuits and setup circuits locally
# start databases and message queue with docker compose
# and launch all the services
# and a mock orders/trades generator
$ bash run.sh

# stop all the processes and destroy docker compose clusters
$ bash stop.sh

Some useful commands have been added to Makefile:

# print the L2 blocks status, total block number, prover block number, etc.
$ make prover_status

# print the latest trades generated by matchengine
$ make new_trades

Now you can also attach a prove client cluster to the backend, see the document

Persist Data

NOTE: for the first time, DO NOT set DX_CLEAN before run.sh. set env DX_CLEAN with false (case insensitive) to skip data purging stage when execute stop.sh.

TODOs

  • Data availability. And change original inputs as private, then use their hash as the (single) public input.

Known Issues

  • In order signature verification, user nonce and order id should be, but haven't yet been, signed.
  • For test convenience, common reference string (CRS) is setup locally rather than by MPC.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].