Skip to content

A decentralized, non-custodial platform for instant Nexa assets exchange across supporting blockchains.

License

Notifications You must be signed in to change notification settings

avasdao/nexa-exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nexa Exchange banner

Guide | API Docs | Consulting | Community

Built with ♥︎ by Ava's DAO

Nexa Exchange

Build Status Telegram Chat

Nexa Exchange is a high performance exchange trading server. The core matching engine is a fully async, single threaded, memory based matching engine with thousands of TPS.

Features

  • order matching
  • order state change notification
  • user balance management
  • market data

Non Features

  • user account system
  • cryptocurrency deposit/withdraw

Technical Details

Language: Node.js API Interface: JSON-RPC Server framework: Express Storage: NOSQL Databases Persistence: (a)Append operation log and (b)Redis-like fork-and-save persistence

The architecture is heavily inspired by Redis and Viabtc Exchange

Prerequisite

  • cmake
  • librdkafka

Ubuntu / Debian

# apt install cmake librdkafka-dev

RedHat / CentOS / Fedora

# dnf install cmake librdkafka-devel

MacOS

$ brew install cmake librdkafka

Todos

  • push notifications using websockets
  • API documentation
  • Better test coverage

Example

# Simple test
$ cd $DingirExchangeDir

# Lanuch the external dependency services like Postgresql and Kafka
$ docker-compose --file "./orchestra/docker/docker-compose.yaml" up --detach
$ make startall # or `cargo run --bin matchengine` to start only core service
$ cd $DingirExchangeDir/examples/js ; npm i

# This script will put orders into the exchange.
# Then you will find some orders got matched, trades generated,
# and users' balances updated accordingly.
$ npx ts-node tests/trade.ts

Release

We uses cross to generate release builds for Linux Distributions. For example, you could generate a static release build via the below command.

RUSTFLAGS="-C link-arg=-static -C target-feature=+crt-static" cross build --bin matchengine --target x86_64-unknown-linux-gnu --release

And a new Docker image could be generated by the release script.

# In root directory of this project
./release/release.sh YOUR_DOCKER_REGISTRY_DOMAIN.COM:YOUR_DOMAIN_PORT NEW_IMAGE_TAG

Related Projects

Peatio: A full-featured crypto exchange backend, with user account system and crypto deposit/withdraw. Written in Ruby/Rails. It can process less than 200 orders per second.

viabtc exchange server: A high performance trading server written in C/libev. Most components of the project are written from scratch including network, RPC. It can process thousands of orders per second.

About

A decentralized, non-custodial platform for instant Nexa assets exchange across supporting blockchains.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published