Order Matching Engine
Powering efficient order matching and trading on Carbon
Introduction
Carbon comes with a highly scalable, order matching engine that is advanced enough to support sophisticated markets and advanced financial instruments such as perpetuals and options.
Each validator node hosts a copy of the order matching engine, acting as witnesses to ensure all other nodes also process trade transactions correctly, thereby securing the network.
Using a batch-based matching system across all markets, Carbon is able to perform low latency on-chain order matching that fully eliminates front-running.
AMM-backed Orderbook
A key feature of Carbon is its fully decentralized central limit orderbooks.
AMM-backed orderbooks, powered by the Hybrid Liquidity Engine, are a novel component of the Carbon protocol enabled by the ability for Carbon's orderbook to integrate with the liquidity module.
Orders
Orders are created after they are accessed by the risk management engine and executed only at the end of each block.
The currently supported order types are: Limit, Market, Stop-Limit, Stop-Market, Take-Profit-Limit, Take-Profit-market.
The currently order options are: Post-Only, Reduce-Only (perps)/
Fees
Trading fees are charged by the protocol and can be found here.
Batch-Based Matching
On Carbon, orders in each block are treated as a single batch and are cleared in a mini-auction.
This means that all orders within a block are treated as having equal priority until they enter the orderbook.
For example, given an orderbook with a single ask at 3k, and a incoming bid for 4k and another at 3.5k, both bids will clear at the unit order price at 3k but the amounts will be prorated and divided up equally between the parties bidding for that quantity.
Carbon minimizes value extraction by adopting batch execution for its orderbook order matching mechanism.
What is Value Extraction? Transparency on the blockchain means that users are often moving and transferring their funds into what can be best explained as an exposed glass box, where transactions are visible for a time before they are executed on the blockchain. Malicious actors can take advantage of this by observing, tracking and manipulating the order of transactions within a block for their own benefit, and at the expense of the user. This is known as front-running in the traditional financial sector, but has been referred to as Maximal Extractable Value in the blockchain space.
In batch execution, orders within a batch are treated equally without prioritization (such as order received time or transaction processing priority).
This way the price at the time of execution is the same for everyone and any front-runner would only be able to profit by a very small amount as they would not be able to take advantage of the price difference between different trades.
Last updated