$NEAR: Positioned to Become the Leading Orderbook Chain

A Proximity Labs Research

Proximity
14 min readSep 21, 2022

(Disclosures: Proximity Labs holds $NEAR and tokens that may be associated with other protocols mentioned in the article. These statements are intended to disclose any conflict of interest and should not be misconstrued as a recommendation to purchase or sell any token, or to use any protocol. The content is for informational purposes only and you should not make investment decisions based solely on it. This is not investment advice.)

Index

  1. Introduction: Review the evolution of DeFi, the increase in both spot and derivatives on-chain trading activity, the differences between the AMM and Central Limit Order Book models and learn why decentralized orderbooks are vital to DeFi and the NEAR ecosystem.
  2. NEAR — Positioned to Become the Leading Orderbook chain: learn how Orderbooks leverage NEAR’s technology & unique sharding design, get to know the first orderbook to integrate the Private Shard solution offered by Calimero Network and review how other L1/L2 solutions are not suitable for high performance and decentralized on-chain orderbooks.
  3. Case studies: deep dive into three current solutions that are building on NEAR and the key characteristics of each

a) Orderly Network: a decentralized trading platform and infrastructure layer with deep liquidity for applications to build upon

b) Spin: on-chain orderbook DEX on NEAR, the first to offer perpetuals

c) Tonic DEX: on-chain orderbook DEX on NEAR, the first to offer liquidity incentives via USN rewards.

Introduction

The growth of DeFi in the past few years has been astonishing, with Decentralized Exchanges (DEXs) quickly becoming the DeFi segment leader: spot DEX volume per month surpassed the $200B mark in May 2021 and November 2021, as seen in Figure 1. Not only has the volume increased in absolute terms, but it has also gained market share from Centralized Exchanges (CEXs). As depicted in Figure 2: spot DEX volume currently represents 10% of the spot CEX volume, with a peak of 17% during the aforementioned months.

Figure 1. DEX volume from Nov 2018 to Sep 2022
Figure 2. DEX to CEX Spot Trade Volume (%)

Such growth has been made possible thanks to the Automated Market Maker (AMM) model, a design pattern well-suited for the long latency and low liquidity of early tokens and blockchains. While popular, AMM-based DEXs do suffer some disadvantages such as limited order types (market only), high slippage, high commissions, long execution time and risks of poor UX and execution due to transaction failure or front running, among others. Recently, numerous solutions have been brought to market to address these problems. Products like Gelato enable more order types like limit orders, and others have adjusted the AMM curve to improve the slippage impact for certain asset types (stableswap model). Others have integrated anti-MEV solutions to solve the front-running issue. The launch of Uniswap v3 and its concentrated liquidity model was particularly notable, even rivaling orderbooks’ efficiency in many instances.

AMMs arose as an alternative to the Central Limit Order Book (CLOB), the model used by centralized exchanges in both crypto and traditional markets. CLOBs are a tried and true model for price discovery at scale. Until recently, they were not particularly well suited for DEXs, due to the difficulty of implementing them on-chain and their inefficiency when it comes to highly illiquid markets: if the liquidity is low it may take hours or even days to find a match. Thus, we can conclude that AMMs are suitable for illiquid markets and retail users while Orderbook-based DEXs are preferred for high frequency trading (HFT) and sophisticated pro traders.

When it comes to derivatives trading, the market exploded with an increase of 358% in 2021 compared to 2020, with a total of $56 trillion traded on exchanges. The perpetual market is the most popular, accounting for more than half of the entire derivatives market. In July 2022, derivatives made up to 69% of total crypto volumes. Figure 3 shows how the demand for derivatives is booming, with the vast majority of volume occurring on CEXs thanks to its CLOB infrastructure: about 60% of the market share belongs to Binance.

Figure 3. Monthly spot vs. Derivatives volume from August 2020 to July 2022.

CEXs offer a great user experience and are highly efficient and fast thanks to its CLOB model and centralized infrastructure, but they do come with several drawbacks. CEXs are centralized and custodial, which presents a security risk for the users as assets can be frozen (eg. Celsius’ case) or IPs blacklisted, as the private keys are possessed by the exchange, and also require an intermediary for order book management and execution. Oftentimes, users do not fully estimate all of the risks associated with CEXs such as evolving regulatory risks, hacker risk, data breaches, locked funds and lack of transparency. As famously known in the Web 3.0 space — “not your keys, not your crypto”. Centralized Exchanges, such as Coinbase, have published that, in case of bankruptcy, users’ funds are owned by the exchange and subject to such liabilities. Contrary to CEXs, DEXs offer increased privacy, global accessibility with minimal restrictions, and composability and permissionless APIs for developers to work with.

As Web 3.0 evolves towards a more decentralized future, it is clear that developing a decentralized order book model is crucial to improve the overall DeFi trading experience. Demand for DEXs is clear, as seen in Figure 4: although still far from Binance, Uniswap’s volume rivals that of Coinbase. Offering a decentralized CEX-like experience on-chain is the next step to onboarding more users into DeFi, especially when it comes to trading derivatives. However, this is not an easy task as CLOB features are challenging to implement onchain. Figure 5 shows how AMMs (especially the constant product model: x*y = k) have dominated since the beginning of 2020.

Figure 4. Trading volume (7DMA) — while Binance is clearly the leader, Uniswap is very close to Coinbase and generates similar trading volumes, which proves the demand for DEXs and how far the AMM model has gone.
Figure 5. DEX Mechanism volume share.

This difficulty stems primarily from high throughput and low execution cost requirements of an order book. That is, in order for a CLOB to effectively operate on-chain, gas fees must be cheap and transactions must be very fast. Given such difficulties, in order to achieve a CEX-like experience, some Orderbook-based DEX have opted to develop an off-chain peer-to-peer order book. This means that the activity occurs outside the blockchain and only settlement occurs on-chain, which offloads activity and reduces gas costs and increases speeds. This currently requires some trust in the platform that will process the orders, though efforts to decentralize the off-chain orderbooks are well underway.

As more and more professional traders and market makers enter the DeFi space, demand for Orderbook style DEXs will continue to increase, especially for derivatives. However, very few of them are currently able to provide the trading experience required by these market participants. Many fall short on liquidity, speed of transactions and cost of trading.

And here is where NEAR comes in.

NEAR: Positioned to Become the Leading Order Book Chain

We consider NEAR Protocol to be the best solution in the market for Orderbook-based DEXs thanks to NEAR’s unique architecture. As explained in the previous article that Proximily Labs released, NEAR is a sharded blockchain modeled as a single Layer 1: shards are not different chains but execution environments supported as smart contracts. Also, NEAR does not use a Beacon Chain, which makes it more scalable than other solutions and offers true scalability and cross-shard composability in a way no other blockchain has been capable of. This effectively creates the perfect solution for extremely demanding products such as orderbooks.

NEAR’s tech allows Orderbook-based DEXs to offer market-leading execution with the highest throughput and lowest latency on DeFi, minimal fees and a CEX-like user experience. A key benefit is that an orderbook built on NEAR can have its own shard, which technically makes it an L1-like Order Book, enabling maximum throughput and performance without sacrificing composability or adding the additional overhead and security burden of running an independent chain.

And this is available today! For example, Spin recently announced that they are integrating the Private Shard solution offered by Calimero Network which can support up to 200,000 TPS. Calimero Network is a sidechain built on top of NEAR and shards communicate with each other over a bridge which is able to seamlessly perform cross-shard contract calls. It also offers customizable modifications such as block speed, gas amount, gas token, etc. Private shards on Calimero allow for privacy, which is highly important when it comes to order books as retail and, especially, institutional investors can keep their classified information private, having the possibility to share the data they choose by using encrypted channels. Such privacy allows for highly advanced features such as private forums or private trading systems that allow institutional investors to trade without exposure until after the trade has been executed and reported, not unlike what are commonly referred to as “dark pools” in traditional finance.

Orderbook projects are starting to realize that there doesn’t exist any other viable blockchain solution to challenge the CEX supremacy, bring pro traders to DeFi, and change forever the on-chain trading landscape. Non-sharded blockchains would all hit an upper limit of what the network could handle eventually, creating congestion issues that make the network extremely slow, as well as presenting a lack of customization and flexibility for dApps. To solve this, you can create an L1 Orderbook, but it requires a lot of work and creates liquidity fragmentation.

“There were a few choices, but NEAR is the best and only viable solution for our product given its innovative sharding mechanism which makes it highly scalable and offers top-tier performance and great customization and flexibility. NEAR is built using Rust, which is a highly performant, statically typed, and memory-efficient programming language. It eliminates different types of memory-related bugs at compile time and allows dev teams to spend more time focusing on the logic of their program instead of hunting for bugs” — The Orderly Team

The most well-known case is dYdX, which utilizes StarkWare infrastructure. They cited “performance” concerns about Ethereum L2s as the main reason to move to Cosmos. However, even though this allows dYdX to build its own L1-Orderbook, it still lacks NEAR’s cross-chain composability features: users need to constantly bridge over, liquidity gets fragmented, and composability with other L1-dApps in the Cosmos ecosystem is restricted. With Spin’s private shard using Calimero, users can seamlessly change between mainnet and the shard without noticing while still being able to interact with other shards thanks to cross-shard contract calls. Orderly Network offers concentrated liquidity to all the applications that build on top of it and a shared trading infrastructure that can be even used by both Spin and Tonic. Composability in NEAR has reached a whole new level and Orderbooks, AMMs, DEX aggregators, options and any other trading-related DeFi protocol will highly benefit from it.

Building an ecosystem where DEX Order Books can thrive needs a scalable and composable infrastructure, the core value of decentralization and strong teams that deliver such milestones. Orderly, Spin, and Tonic are building on NEAR with the explicit intention of creating decentralized protocols that have CEX-like trading experiences. It is important to note that they are different though: Spin and Tonic are DEXs whereas Orderly is a decentralized trading infrastructure that allows for applications (such as DEXs) to build upon. One could analogize Spin and Tonic with dYdX while Orderly is more akin to Serum. Let’s analyze the three of them individually:

Case study: Orderly Network

Orderly is a permissionless and modular protocol, incubated by WOO Network and NEAR Protocol, that brings high throughput, low latency, low fees, tight spreads, and composability for DeFi devs to build upon. Think of it as Serum on NEAR. Orderly provides an off-chain Central Limit Order Book (CLOB) and other tools and infrastructure, to enable third-party platforms and protocols to utilize existing frameworks, saving them time and lowering the entry barriers to build on NEAR DeFi. Thanks to existing partnerships with leading Market Markers such as Kronos Research, they can offer deep, aggregated liquidity to all applications.

Orderly will highly leverage NEAR’s innovative sharding mechanism: Nightshade. Orderly’s infrastructure requires a sustainable long-term scalable blockchain to support such a large number of orderbooks, options vaults, and other DeFi instruments without causing any congestion on-chain. Serum, for example, has suffered from Solana’s congestion issues, which have made the network slow after being frequently halted for several hours. Orderly, in order to avoid that, has chosen NEAR as a more scalable solution.

Figure 6. Advanced user interface on WOO DEX testnet, built on top of Orderly Network.

Orderly recently raised a $20M Series A round and successfully launched the testnet with over 75,000 users and is now gearing up towards the mainnet launch. Apart from WOO Network, Ref Finance will be the next one to build an Order Book DEX using Orderly’s infrastructure. Soon, other types of dApps will join, such as wallets, yield optimizers, index funds, dex aggregators, bridges, and lending & borrowing protocols. In the future, we are told to expect:

  • Mainnet by Q4 2022
  • Perpetual futures trading infrastructure to be ready by Q1 2023
  • Move from off-chain to on-chain orderbook by Q1 2023 to transition into a fully decentralized platform
  • Community lending pools where liquidity providers lend assets to market makers while enjoying single-sided liquidity provision with sustainable yields
  • Enabling options
  • Hundreds of DeFi applications built on top of Orderly

“In Q4 2022 we will introduce the on-chain orderbook. With the finality, speed and transaction cost of the NEAR protocol, we are confident in being able to provide the CEX experience, in a decentralized environment. Moving on-chain will remove the trust element of order executions and make them visible to ALL users who wish to see them” — The Orderly team

Case study: Spin

Spin is a decentralized trading protocol with a CLOB model that provides a CEX-competitive experience to DeFi users on NEAR. The protocol first launched on Solana but realized that NEAR was a more suitable solution. Contrary to other protocols, Spin offers a fully on-chain order book which means that not only settlement occurs on the blockchain, making it decentralized and fully transparent. Spin recently increased its max cap from $100 to $500 and, despite the small amount, they have already surpassed $2,000,000 in trading volume and averages around 2,000 transactions per day.

You can already trade spot on mainnet, whereas the early beta access for their perpetual contracts platform will be live, also on mainnet, on the 6th of September, being the first Orderbook-based DEX to offer futures on NEAR. Decentralized option vaults are also on testnet. Currently, Spin supports the broadest amount of assets across the order books on NEAR, including WBTC, ETH, NEAR, PARAS, AURORA, REF, USN, USDT and USDC on spot and the NEAR-PERP contract on perps. The Spin infrastructure also unlocks the opportunity to offer different DeFi products such as quarterly futures, power perpetuals, floor perpetuals, options, exotic options, everlasting options, basis trading, fixed yield structure products and more. Another feature is an integrated swap that emulates the traditional AMM model. These swaps are executed directly through the on-chain order book as market orders, which means less slippage and a better quote without the user even realizing what is happening under the hood.

Figure 7. User interface on Spin. You can easily change between spot, perpetuals, vaults. The goal is to offer a CEX-competitive experience while keeping the core values of decentralization & performance.

One recent announcement worth noting is that the protocol will soon integrate the Private Shard solution via the Calimero Network, allowing up to 200,000 TPS; potentially making Spin the DEX Orderbook with the highest performance that is currently live on all DeFi. Calimero Network is a sidechain built on top of NEAR and shards communicate with each other over a bridge which is able to seamlessly perform cross-shard contract calls. Spin users will be able to switch between NEAR Protocol and Calimero Shards easily according to their needs. One of the main goals for Spin is to offer top-notch performance, so the idea is to do everything that is already working but faster due to the fact that validators will process only Spin’s transactions. It also allows for changed block parameters, gas token or gas amount. These shards are also great for Order Books since Spin could return the gas back or use Spin’s token to pay for gas.

Liquidity will soon be bootstrapped by distributing rewards to market markers according to a formula that will take into account several factors for a fair distribution. The protocol will also develop a community style pool to be used for market making purposes and users will easily get incentives without actively market making. Stay tuned to start trading on Spin and get such incentives!

Case study: Tonic DEX

Tonic is a decentralized trading platform based on the CLOB model that offers a CEX-like experience to NEAR DeFi users. They also provide an on-chain order book. Tonic is live on mainnet and doesn’t have a cap limit on deposits or trading activity.

Thanks to this, Tonic hasmanaged to be the first Orderbook-based DEX to launch USN liquidity incentives, starting with 50,000 USN. This program started on the 12th of September and will last for a month! The program rewards are different from yield farms many users are familiar with: users will be rewarded when they create limit orders within 2 bps of $1.00 with the main goal to incentivize concentrated liquidity on the orderbook. Since Order Books are more capital efficient than AMMs, liquidity incentives on Tonic might provide the deepest liquidity for USN/USDC across any DEX on NEAR. Tonic’s goal is to incentivize traders to actively provide liquidity on the orderbook. The Tonic SDK makes it easy for developers to create their own automated market making strategies to trade with.

Figure 8. User interface on Tonic. You can easily change between advance and simple, with simple being the traditional AMM-swap interface that DeFi retail users are familiar with.

The team is currently focused on the spot market, contrary to competitors such as dYdX, although they will also release perps and options soon. Tonic is currently working on passive liquidity programs to provide liquidity on the orderbook from a familiar pool interface, similar to a community pool lending model.

“Serum v3 was actually our inspiration but we found out that it was difficult to develop on it due to Solana’s devX not being that great; we built our platform on NEAR with developers in mind from day 1. Our SDK is easy to use, we are 100% open source and listing markets on Tonic can be done with a single command” — The Tonic team

About Proximity Labs

Proximity is a research and development firm focused on supporting the NEAR DeFi ecosystem. Consisting of former members of the NEAR Foundation, Binance, Consensys, Facebook, and more, Proximity works closely with projects building on NEAR, whether through its grant program, investment arm, or by deploying its deep expertise to help design impactful strategies and serve as a bridge between DeFi teams and ecosystem participants. It has advised numerous bluechip DeFi projects contributing to both NEAR and Aurora’s recent success.

Website · Twitter · Get in Touch

--

--

Proximity

Proximity is a R&D firm supporting projects building DeFi applications on NEAR and Aurora through grants, advisory services, and developer support