Introducing Econia’s Atomic Matching Engine

Econia Labs
Econia Labs
Published in
4 min readJul 21, 2022

A Breakthrough in On-Chain Trading

Econia has shipped

In Econia Labs’ inaugural post, “Setting the Stage for Econia: Markets, Computers, and Global Economics,” Econia was introduced within a global macroeconomic context. With humanity’s present financial system plagued by various organizational and technical inefficiencies, Econia represents an innovative solution to the outdated markets of the past. Built on decentralized technology and optimized for parallel execution, Econia leverages the underlying architecture of the Aptos blockchain to provide a set of crucial performance enhancements over earlier generations of decentralized exchanges (DEXs), ushering in a new era of unified global markets.

In particular, Econia is designed from the ground up around Aptos’ Block-STM execution engine, which uses optimistic concurrency methods to streamline transactional throughput. The result is a hyper-parallelized on-chain order book, enabling two key innovations that push performance to the extreme: paraqueues, and an atomic matching engine.

At first, of course, these two features were only theoretical possibilities, but as of this past Sunday, one is now a proven architecture — because Econia Labs just shipped the world’s first on-chain atomic matching engine to the Aptos devnet:

Here, atomicity refers to the compressed nature of Econia’s matching engine, which settles market orders in one execution step: when a user decides they want to buy or sell a digital asset at the best price offered by the market, Econia v1 matches their order against another market participant’s limit order (an ask or a bid), updates positions on the book, and routes assets between counterparties, all within a single transaction.

Compared with Serum, a leading on-chain order book protocol built on the pessimistic concurrency of the Solana blockchain, Econia’s atomic matching engine thus collapses a two-transaction process into a single transaction. Cutting in half the number of transactions previously required for an on-chain matching engine, Econia offers a performance enhancement that would not be possible without the optimistic concurrency of the Aptos blockchain. The result is a high-performance decentralized exchange with less overhead, more throughput, and less time waiting for trades to go through.

Moreover, Econia isolates different markets into separate regions of computer memory, achieving a condition known as non-overlapping state, so that orders can clear in parallel across separate markets:

Calling all builders

Econia’s v1 release is now live on the Aptos devnet, accompanied by comprehensive documentation at econia.dev, and an open-source code repository that has been public since inception. Armed with all of the tools necessary to integrate Econia into their decentralized finance (DeFi) protocols, several developer teams have already started building on top of Econia, and interest is growing each day. With a community-oriented Discord server designed to facilitate technical discussions, and a rapidly maturing Twitter profile geared toward product announcements and social engagement, Econia Labs is building up an unstoppable collaboration machine that will extend far beyond v1.

As developers across the Aptos ecosystem begin testing out Econia for themselves, discussions are already underway for Econia’s v2 feature set, with early adopters providing feedback on how to make the order book protocol integrate as seamlessly as possible with their respective products. Soon enough, there will be rich, user-facing front ends for a suite of applications, powered by a rapidly evolving back-end system that already has a breakthrough innovation at its core, Econia’s atomic matching engine.

The iterative build cycle has just begun, and after several iterations, once the community has converged on a set of core features, attention will then turn to performance optimizations, most notably in the form of paraqueues — Econia’s other major technical innovation. By horizontally scaling inputs to the atomic matching engine, paraqueues will further reduce bottlenecks on high-traffic markets, allowing multiple users to place orders at the same time, rather than forcing them to place orders one after another:

On top of the parallelism already offered across different markets, paraqueues will bring parallelism to each single market, railing performance to the extreme.

Build, ship, optimize, build, ship, optimize. That is what Econia Labs is here to do, and the economic engine of tomorrow is only getting started.

--

--