Decentralized Limit Orderbook (DLOB)

An order book is a real-time, continuously updated list of buy and sell orders on an exchange for a particular financial asset, showing the quantity of the asset being bid on or offered at each price point. It facilitates transactions where buyers and sellers can match their orders according to prices and quantities. nftperp v2 uses a smart implementation of a fully onchain limit order book.

nftperp DLOB Overview

nftperp's decentralized limit order book gives users complete control over their trades in the form of order submission, direction, prices, and size. The order book is fully onchain. Historically, storing and sorting thousands of orders on the chain has been very expensive. We solve this problem using the following approach:

  • For every pair, there are ticks. Most pairs in our platform have a tick (price point) size of 0.01 ETH that stores all buy and sell orders at that price.

  • When someone creates a market order, all orders belonging to that tick are matched. If the order is not filled, the onchain matching engine goes to the next tick and matches the limit orders in that tick. This process goes on until the market order is matched.

In this way, by smartly dividing and storing limit orders in a tick, we have created a fully onchain limit order book that can scale to tens of thousands of orders without significantly increasing gas cost for market orders.

Last updated