An extremely high performance matching engine written in Rust.

Related tags

Cryptography galois
Overview

Galois

License

Introduction

Galois is an extremely high performance matching engine written in Rust, typically used for the crypto currency exchange service.

Galois use Event Sourcing pattern to handle tens of thousands of orders per second or even better, depending on the performance of persistence. Basic architecture is shown below.

                  core dump(disk)
                       ^
                       ^
                  +----------+
event(mysql)  >>  |  galois  |  >> match results(mysql)/best n price(redis)
                  +----------+
                       ^
                       ^
                query request(TCP) 
                       

If you would like to use Galois in your product, you should implement the order/user management known as broker, as well as the blockchain client to handle crypto coin withdraw/deposition.

Getting Started

Dependencies

  • MySQL: persist the events and output the match result
  • Redis: output the best n price of the orderbook

Build & Run

git clone [email protected]:uinb/galois.git
cd galois
cargo default nightly
cargo build --release

# init mysql
mysql -u {user_name} -p {database} < sql/init.sql

# start redis
redis-server

# modify the configuration file galois.toml before start
target/release/galois -c galois.toml

Galois is now waiting for the incoming events and execute.

Some of the Instructions

mysql-schema:f_id, f_cmd, f_status, f_timestamp

f_cmd(json)
    cmd: u32,    
    order_id: Option<u64>,
    user_id: Option<u64>,    
    base: Option<u32>,
    quote: Option<u32>,
    currency: Option<u32>,
    vol: Option<Decimal>,
    amount: Option<Decimal>,
    price: Option<Decimal>,
    base_precision: Option<u32>,
    quote_precision: Option<u32>,
    taker_fee: Option<Decimal>,
    maker_fee: Option<Decimal>,
    min_amount: Option<Decimal>,
    min_vol: Option<Decimal>,
    enable_market_order: Option<bool>,

ASK_LIMIT | BID_LIMIT =>
    require:            
      base,quote,user_id,order_id,price,amount;
      price/amount is positive;
      order_id exists;
      (base/quote) symbol exsits and open;
       
CANCEL =>
    require:
      base,quote,user_id,order_id;
      order_id exists;
      order_id belongs to user_id;
      (base/quote) symbol exsits and open;
            
TRANSFER_OUT | TRANSFER_IN => 
    require:
      user_id,currency,amount
     

License

Galois is licensed under Apache 2.0

You might also like...
Rusty Hog is a secret scanner built in Rust for performance, and based on TruffleHog which is written in Python.
Rusty Hog is a secret scanner built in Rust for performance, and based on TruffleHog which is written in Python.

Rusty Hog is a secret scanner built in Rust for performance, and based on TruffleHog which is written in Python. Rusty Hog provides the following bina

SHA1: Rust vs. OpenSSL performance

SHA1: Rust vs. OpenSSL On an AMD Ryzen 7 3700X 8-Core Processor. Archlinux x86_64. Linux 5.15.5-arch1-1. Short = 8 bytes, long = 64 bytes and huge = 5

Rust DDC/CI high level library

ddc-enhanced-rs ddc-enhanced-rs is a cross platform Rust crate and Node package for controlling monitors with DDC/CI. Documentation Rust: https://docs

Spartan: High-speed zkSNARKs without trusted setup

Spartan: High-speed zkSNARKs without trusted setup Spartan is a high-speed zero-knowledge proof system, a cryptographic primitive that enables a prove

Authenticated Encryption with Associated Data Algorithms: high-level encryption ciphers

RustCrypto: Authenticated Encryption with Associated Data (AEAD) Algorithms Collection of Authenticated Encryption with Associated Data (AEAD) algorit

AMCOS - A high-peformance parallel monte-carlo simulation for estimating the fair value of options in finance

antoons-monte-carlo-options-sim A high-peformance parallel monte-carlo simulation for estimating the fair value of options in finance. Written in Rust

Deploy your Solana programs during high load.

solana-deployer IMPORTANT: There is a known bug with the current program that will be fixed soon. In the meantime you should deploy from Solana Playgr

Spartan2: High-speed zero-knowledge SNARKs.

Spartan2: High-speed zero-knowledge SNARKs. Spartan is a high-speed zkSNARK, where a zkSNARK is type cryptographic proof system that enables a prover

High-level networking library that extends the bevy_replicon library to allow snapshot interpolation and client-side prediction

bevy_replicon_snap A Snapshot Interpolation plugin for the networking solution bevy_replicon in the Bevy game engine. This library is a very rough pro

Comments
  • Questions

    Questions

    Hi, I’m interested in using your matching engine and was wondering if you could help me with the following?

    1. Is there any API documentation?
    2. can I run this fully in memory?
    3. What is the latency to add an order / match on the orderbook?

    Thank you for the help!

    opened by nikhilsaraf 4
Releases(v0.3.3)
Owner
UINB Tech
UINB Is Not Blockchain
UINB Tech
An easy-to-use, high-performance Interledger implementation written in Rust

Interledger implementation in Rust ?? Requirements All crates require Rust 2018 edition and are tested on the following channels: stable Connecting to

Interledger.rs 184 Dec 13, 2022
Extremely low-latency chain data to Stackers, with a dose of mild humour on the side

Ronin Hello there! Ronin is a ultra-speed Stacks API server. It's super lightweight, but scales easily. Why are we making this? Because we don't like

Syvita Guild 11 Mar 29, 2022
An open source, high performance limit order book for the Seaport smart contracts. Implemented in Rust using ethers-rs, this offers a turnkey option for digital asset marketplaces.

Quay Quay is an open source, high performance backend for the Seaport smart contracts. The project is implemented in Rust, using Postgres as a storage

Valorem Labs Inc. 169 Jun 23, 2023
A high performance blockchain kernel for enterprise users.

English | 简体中文 What is CITA CITA is a fast and scalable blockchain kernel for enterprises. CITA supports both native contract and EVM contract, by whi

CITAHub 1.3k Dec 22, 2022
High Performance Blockchain Deserializer

bitcoin-explorer bitcoin_explorer is an efficient library for reading bitcoin-core binary blockchain file as a database (utilising multi-threading). D

Congyu 18 Dec 22, 2022
A high performance blockchain kernel for enterprise users.

English | 简体中文 What is CITA CITA is a fast and scalable blockchain kernel for enterprises. CITA supports both native contract and EVM contract, by whi

CITAHub 1.3k Dec 22, 2022
Glommio Messaging Framework (GMF) is a high-performance RPC system designed to work with the Glommio framework.

Glommio Messaging Framework (GMF) The GMF library is a powerful and innovative framework developed for facilitating Remote Procedure Calls (RPCs) in R

Mohsen Zainalpour 29 Jun 13, 2023
A high performance Remote Procedure Call system.

A high performance Remote Procedure Call (RPC) system. Usage Add this to your Cargo.toml file. [dependencies] frpc = { git = "https://github.com/nurmo

Nur 5 Jul 28, 2023
Y-Octo is a high-performance CRDT implementation compatible with yjs

Y-Octo Y-Octo is a high-performance CRDT implementation compatible with yjs. Introduction Y-Octo is a tiny, ultra-fast CRDT collaboration library buil

null 79 Oct 5, 2023
A high-performance, highly compatible EVM Inscriptions Indexer

Insdexer A high-performance, highly compatible EVM Inscriptions Indexer by Rust. An accessible and complete version of the documentation is available

null 105 Mar 17, 2024