The forked Solana DEX Birthed from FTX’s Death: The Openbook Deep Dive

Yash Agarwal
17 min readJan 15, 2023

--

FTX’s crash didn’t just vanish SBF’s $32 Billion but also shook the core of Solana DeFi. The Project Serum, which was used by numerous DeFi protocols was also at risk, potentially questioning the future of Solana DeFi. That’s when the community stepped up to save Solana DeFi and created OpenBook.

In this essay, we will first look at the story of how OpenBook came into existence, dive deeper into orderbooks along with OpenBook’s technical architecture, and lastly, dive into the spiciest part — the future potential of openbook along with recommendations. To not make it, just another ‘Forked Project Serum’ essay, we will not discuss Project Serum in much detail, but talk about the future potentials in greater depth to drive home some unique insights.

The Story: Death of Project Serum-Birth of Openbook

The story starts with the SBF’s ambitious vision to take DeFi to reach 1 Billion users and $10 Trillion of on-chain value. SBF described the vision as:

It’s what Web3 is supposed to be: an ecosystem the size of the internet… Serum is aiming really high. The goal is to get 10% of the entire world’s activity on-chain and composing on Serum. That includes 10% of financial activity, 10% of social media, 10% of payments, 10% of people, 10% of assets, etc. So a billion people and ten trillion dollars of assets.

With the launch of the Solana mainnet in early 2020, Solana demonstrated the high speed (64K TPS) and low gas fees (<$0.00001) to be possible for a Layer-1. FTX was a key investor in Solana and to release his vision, SBF decided to launch an on-chain orderbook called “Serum” on Solana.

Project Serum:

Launched on 31st October 2020, by Serum foundation, which was backed by a consortium including FTX, Alameda Research, and the Solana Foundation. It was the first major open-source project to build on Solana and was truly the centerpiece of attraction for Solana DeFi as it was heavily supported by FTX. With Solana DeFi summer kicking in 2021, Project Serum attracted more than $5.5 Billion in cumulative volume in just 9 months of its launch, regularly clocking more than $100 Million in daily volumes and more than 970 markets listed — the growth was simply insane in 2021. With the bear market kicking in, 2022 was a steady year with not many developments happening, until the darkest month of crypto: November 2022.

The FTX Crash: Death of Serum

By mid of November, FTX had collapsed and filed for bankruptcy on November 11 for the reasons, we all know. But a strange thing also happened, reportedly a hacker gained access to FTX and started moving funds. It sounds awful, but all of the private keys of Project Serum were housed within FTX, ugh! The Serum program update key was not controlled by the SRM DAO, but by a private key connected to FTX. This prompted all Solana DeFi projects like Raydium, and Jupiter to cut off ties with Serum as they had a fear that private keys can be used to update the program by the hacker, which have been compromised.

By November 13, everyone announced that they have cut ties with Project Serum and the work on a community-led fork was already on its way!

The Birth of OpenBook: Power of Solana DeFi Community

In times of such a dire situation, the Solana DeFi community came together, and to safeguard this critical DeFi piece, developers and leaders from leading protocols joined hands to deploy OpenBook, a community-driven fork of Serum’s V3 program on November 15. The fork meant that all the Serum codes were exactly used, but all ties with FTX were cut. This demonstrated the true power of Open-source and what a strong community looks like. This allowed the community to have shared custody of Serum’s infrastructure and governance, and in a way, take over FTX’s control.

Within just 5 days, it was integrated back into Jupiter and the other dApps followed — Speed, FTW!

Major Solana projects played crucial roles in the deployment and integration of OpenBook into Solana’s DeFi ecosystem. DEXs like Raydium and Solape shared liquidity with OpenBook. Jupiter Aggregator’s SDK/APIs integrated OpenBook’s liquidity and Switchboard-allowed price data. OpenSerum, created extensive dashboards covering the various markets utilizing OpenBook. Mango Markets announced that their V4 program will integrate OpenBook.

To drive further adoption and develop trust, Serum’s public Twitter handle also openly endorsed the new fork i.e Openbook.

Now that we have learned how OpenBook came into existence, let’s now learn what exactly it does:

Central Limit Order Book (CLOB):

Orderbooks are not a new concept — US equity markets are mainly supported by orderbooks, processing daily volumes of ~$500 Billion. In an orderbook exchange like NYSE, buyers and sellers place bids and ask at specific prices (orders) and trades execute as those bids and ask match, and the price is updated to that particular bid-ask (Last Traded Price)

An on-chain Central Limit Orderbook and the matching engine allows for shared liquidity and price and time priority matching to traders and projects. Traders get to choose the price, size, and direction of their trades, while DeFi projects benefit from existing architecture, bootstrapped liquidity, and matching services.

Source: Serum Docs

AMMs vs Orderbook:

Compared to AMMs, orderbook offer better price discovery, as it’s an iterative process that involves the cancellation of multiple empty orders till the bid and asks match i.e the price is discovered.

While Orderbooks have the benefit over traditional AMMs due to tight quotes provided by traditional market makers, which leads to better pricing, the catch is: There should be enough liquidity with active market makers constantly updating their quotes. This isn’t possible for all assets since the number of assets traded on-chain is numerous (>100K). AMMs win on this as they support:

  1. Long tail assets (Permissionless asset listing)
  2. Anyone can create a market with Passive Liquidity

How OpenBook works:

In a trade cycle, the OpenBook program executes using the following steps:

  1. Placing Orders: The user can place an order by including his order details (Market pair, Price, Size, Order type) in the order form. The OpenOrders account is created, if not present already. For buying, a user can fund it from their SPL wallet like Phantom. For a sell order, the amount is deducted from Openorders Account and moved to the SPL wallet.
  2. Matching Orders: The process of matching involves removing requests from the Request Queue. The matching engine updates orders and records trades in the Events Queue. OpenBook is just like any other orderbook but for order matching it uses a process, known as crank turning. Anyone is allowed to run a cranker and be rewarded with a portion of transaction fees for it. All the orders are posted on the chain and the job of crankers is to ensure that they are being matched and executed properly. This entire process is automatic for the user and doesn’t involve any signing of the transaction as the program accounts for these accounts and signs automatically.
  3. Consuming Events: In the Consume Events, the user account balances are adjusted in response to the events produced by the Matching Orders. For filling the orders, it updates the user’s account balances like decrementing the OpenOrders account’s total balance by the quantity paid. For Out events, it increments the OpenOrders account’s free balance by the quantity unlocked and removes the order from the OpenOrders account’s list.
  4. Settlement and Cancelling Orders: The OpenOrders account balance can either be kept as it is or settled back to the user’s wallet.
    Canceling an order has a similar trade cycle. To cancel an order, a user submits an order, which submits a request to the Request Queue and then processed by match orders. The order would be removed from the Orderbook, and an Out event would be added to the Event Queue to specify that the order has been canceled. The consume events would update all balances and the amount be made free for settlement.

All of the technical details of the step-by-step process are listed by the OpenBook team, would recommend reading it for a detailed understanding.

The Meat for Openbook Market Makers: Solving Liquidity Crunch

There can be essential three categories of asset pairs:

  1. Category 1: Made up of stablecoin pairs like USDC-USDT which are nearly perfectly correlated by design. This is well-suited for AMMs since passive liquidity by retail LPs can also do the job of market-making, without requiring any advanced market makers.
  2. Category 2: Made up of some of the most highly traded pairs like SOL-USDC and there happens active price discovery. This is where the opportunity for Orderbook Market Makers lies as price discovery is constantly needed, and an order-matching engine does a better job than LPs at AMM, which suffers from Impermanent Loss. This is where a majority chunk of the volume lies, allowing for a lucrative opportunity to tap by market makers.
  3. Category 3: Long tail made up of the rest of the lesser-known assets. Active Market Makers in Orderbooks don’t find it profitable as there is a lot of uncertainty in their prices.
Credits: 0x blog

However, with the fall of the most active Market Maker, Alameda Research, Solana DeFi has been facing a liquidity crunch. Solana as an ecosystem actively needs more market makers, other than the current ones like Jump Crypto, Wintermute, and GSR. These market makers will help Openbook quote tighter prices and bring more liquidity to long tails assets and allow more synthetic/real-world assets on-chain. As they say, “Liquidity Begets Liquidity

The Trading User Interfaces:

While Openbook doesn’t have its own user interface, numerous DeFi projects like Solape, and Raydium have integrated Openbook, providing web-based GUI to trade, just like any Centralised Exchange. These trading dApps ask the user to connect to a wallet provider like Phantom, through which it asks the users to sign the transactions.

A few integrated UIs are:

  1. Raydium: Raydium’s AMM integrates directly with Openbook’s CLOB to marry the best of two worlds by having AMM-style liquidity provision and CLOB-like deep liquidity and lower slippage.
  2. Solape: It provides UI for swapping assets using OpenBook.
  3. Prism: It’s another emerging DEX aggregator built on top of OpenBook to provide a CEX-like UX while retaining the self-custody of funds.

Fees: The Business Model

While Openbook doesn’t charge any fees at the moment, however, the fee is 4 bps (0.04%) which is split between UIs and Makers i.e each one takes 2 bps. However, if someone hosts their own UI or trades via SDKs, they can save on UI fees and will only pay 2 bps as the market-making fees. For stable pairs, the fee is 1 bps (0.01%) instead of 4 bps.

To ensure sustainability, OpenBook can also start charging fees in the near future, which can be deposited into the multi-sig governed by the OpenBook governance. These can be used to incentivize Market Makers, drive DeFi integrations, and reward developers that drive open-book.

Max from Mango opened an interesting Pull Request, which proposes 3 Tiers: Base, Flagship, and Stable to incentive market making at all spectrum of asset pairs.

Should OpenBook launch a Token?

One of Project Serum’s features was its utility token $SRM, which granted a 50% discount on trading fees and governance to the holders. It also had another token, $MSRM which can be redeemed for 1,000,000 $SRM and increased fee discount to 60% and it was required to run a node. To increase the value of $SRM, a buyback-burn mechanism was deployed, where tokens are bought and burned equal to a percentage of platform fees. Everyone, including VCs, touted this as a “powerful mechanism” for value accrual to SRM and it did, but until the FTX crash.

Interestingly, FTX counted $5.4 Billion of SRM tokens in its reserves, as it had insanely high FDV (Fully Diluted Value) due to its poor tokenomics with not much real market cap. These SRM tokens still lie in FTX’s reserve, which will be liquidated, and hence, removing SRM tokens from OpenBook was a no-brainer decision.

The current version of OpenBook doesn’t have any tokens and doesn’t earn revenue. However, now the community has a larger question: “How will they sustain this project if there is no token?” Currently, Solana Foundation along with other DeFi projects is supporting the OpenBook development and is committed to supporting it as much as possible via grants and hackathons. However, Grants are limited and can’t sustain OpenBook forever. Sooner or Later, a sustainable source of revenue to incentivize maintenance and further development needs to be figured out.

An alternative can also be to have SOL itself as the token for Openbook, as it’s now a Solana public good. Solana would then be used to pay and accrue fees, however, this wouldn’t be the best approach to governance as SOL is the universal token, and not specific to OpenBook. Another suggestion was to have BONK, the memecoin as the fee token for OpenBook.

Many community members released their own proposals for potential OpenBook Tokenomics. Few interesting ones:

  1. Soju’s proposal: It proposes a tiered-fee model with the excess fees generated to burn SOL, thus allowing value accrual.
  2. Durden’s proposal: Launch the OpenBook token, OPB, and airdrop and keep buying it back and burn from the fees generated.
  3. Dual Finance’s proposal: Launch OPB with SOL as a reserve asset

Overall, I feel that launching the OPB token can help grow OpenBook to be a more competitive CLOB DEX.

Community and Governance: Tight-Knitted

The upgrade authority for the Openbook program is held by a Realms DAO, with membership comprised of reputable figures from multiple Solana DeFi projects. There are 13 members such as Max and Adrian from Mango Markets, Sebastian from Solana Labs, and other pseudonymous members to control the multi-sig and take part in governance. It’s still centralized,

From the community point of view, the discord has ~350 members and the Social Media and community is moderated by Soju, who previously led Business Development at Solend. Interestingly, BONK, Solana’s own doge meme coin, has been the talk of the town for the past 2 weeks, for its astronomical run (rising 100x in a span of just 5 days). BONK has openly supported OpenBook and has allocated 15% of the supply to airdrop early OpenBook Traders. Further with BONK DAO’s grant program, developers in OpenBook can also be incentivized.

The fact that the Solana DeFi community came together in the hour of darkness to make Openbook happen is a testament to the strength and resilience of DeFi builders on Solana.

OpenBook Traction: The Numbers

Since its launch of the forked version in November 2022, Openbook has been processing a daily volume of $3 Million to $6 Million, with TVL on a rising trend as can be seen from the chart. The number of transactions has been ranging from around 1 Million to 2 Million, with the peak being 4.4 Million transactions per day.

Data as of 15th January, 2023 | Source: https://solscan.io/amm/openbook

There are 1621 token pairs listed with the most active pairs by trading volume being SOL-USDC and mSOL-USDC with BONK-USDC being the rising star. While the numbers and traction are not that impressive at the moment, considering a restart, these are decent numbers, with a strong potential to regain daily volumes of $100 Million as more and more UIs get integrated.

Further activity can also be checked at the “Activity Dashboard” by Flipside Crypto.

Competitive Landscape: Getting Crowded

Project Serum paved the way for on-chain orderbooks by successfully attracting huge volumes, and it’s now not the only on-chain orderbook. Openbook now faces stiff competition from numerous types of players:

1. AMMs:

One interesting player to watch in the Solana AMM space would be Lifinity, which utilizes concentrated liquidity and a proactive market maker model using oracle prices, in order to remove reliance on external market makers, reduce Impermanent Loss (IL), and more.

2. Upcoming Orderbooks on Solana:

Ellipsis Labs, founded by an ex-Solana labs guy, is also building an orderbook for Solana called “Phoenix”, a crankless alternative to Openbook. It expands on the CLOB vision with a set of design decisions to improve efficiency like removing operationally-intensive cranking from the DEX design. With gigabrains working behind it and iterating over the orderbook design by incorporating learning from Project Serum — it’s definitely a solid project to look out for. By launching on Solana, it will directly compete with OpenBook’s liquidity.

Source: Talk at Solana Breakpoint

Other players to watch out for would be LayerN, which is building a Layer 2 on Solana and might enable its own native orderbooks, which would be compatible with existing Solana dApps.

3. Non-Solana Orderbooks:

While they aren’t direct competitors, they are certainly long-term competitors as users, institutions, and dApps would love to use the most efficient orderbook in the long run. Just like Solana, other high-performance chains like Near and Move VM family chains like Aptos, and Sui have started working on Orderbooks. Let’s look at some players:

  • dYdX: In the next version, dydx will have its own separate chain built using Cosmos SDKs, which will have an off-chain orderbook in which each validator will host a copy of the orderbook and match the orders, just like any validator proposes a block. dydx, being the leader in the space with a monthly volume of ~$30–50 Billion, is a must-watch.
  • NEAR-based Orderbooks: The Near is steadily becoming the orderbook chain, with the rise of orderbook DEXs like Tonic (1.3K+ users), Spin (9.1K unique users), and Orderly ($130M+ cumulative volume). To promote the development of a robust orderbook ecosystem on NEAR, it has also launched a $10M Orderbook Fund with all orderbooks launching perpetual in 2023.
  • Move VM-based Orderbooks: While many orderbooks are being built on stealth, Econia and Ferum have announced to launch of orderbooks for Aptos. With Sui and Aptos also being high performant chains, orderbooks on them will be an interesting watch.
  • Sei: Pitching itself as a “Decentralised Nasdaq”, Sei is a trading-specific Layer 1 chain, which will have a native orderbook, built using Cosmos SDKs. It aims to have a finality of 600 ms, with market-based parallelization. It has already attracted a vibrant ecosystem of 50+ dApps building for use cases like spot trading, perpetual, prediction markets, and more.
    An interesting thing to note here would be: Sei is also supporting the development of Nitro, which will enable Solana DeFi apps to launch on Sei. This can potentially lead to existing Solana dApps using Sei as the order matching engine, instead of Openbook if Sei manages to build a superior tech serving as a direct competitor!

As we can see, there is intense competition, but being a mammoth market, there can exist multiple players and competition shouldn’t be much of a worry, at least for the short term.

Let’s now move to the juicy part🧃

Road Ahead: Recommendations & Opportunities

While Openbook currently doesn’t have any solid roadmap due to the lack of a central team working on it full-time and the community is still discussing multiple aspects. To contribute to the community discussions, let’s explore the possibilities and why Openbook is still an exciting project:

1. Open Source and Public Goods:

Openbook is undoubtedly the biggest public good for Solana DeFi as its the backbone of many DeFi projects. With now DeFi community taking charge, Openbook can potentially lead the new wave of public goods on Solana by launching a grants program to encourage open-source contributions in Openbook. A potential way, developers can do open-source contributions can be Client-side tooling: Currently, Openbook has a JavaScript client library for interacting with the Openbook DEX. This JS client library can be further improved or just like Javascript, more languages can be added. Similarly, a significant improvement would be to go crankless which can be again an open-source contribution by an established DeFi team.

A Gitcoin-like platform would be perfect for such a case, where the DeFi community can contribute and the amount is matched by bigger DeFi protocols like Jupiter, Raydium along with Solana Foundation, or BONK DAO. Wireless Anon also proposes an open-source grants protocol for this purpose, which is also being discussed by the community.

2. Endless applications possible:

While spot markets i.e trading pairs like SOL/USDC, and SOL/USDT dominate on openbook, it has the potential to be a key primitive for other ecosystems, that might be collectively worth trillions. In fact, it’s an asset Agnostic order book for matching any Solana-based instrument from options, futures, borrow lending positions, or any financial and non-financial instrument that can take advantage of Openbook’s backend matching engine. To give an estimate, some use cases can be:

  1. Tokenized Stocks: By tokenizing stocks like AAPL, AMZN and enabling fast trading via OpenBook, we can potentially bring an NYSE-like structure to Solana. The key benefit of bringing it on-chain would be: increased accessibility as anyone around the world can trade these assets without relying on clunky international payments and long onboarding processes. Other synthetic assets like Bonds and commodities can also be traded via orderbooks.
  2. GameFi: Decentralised Gaming presents a massive opportunity, and avid gamers are already familiar with buying/selling in-game items on third-party marketplaces, which are currently inefficient. Openbook here can be the missing link that can enable games to create in-game money markets where products such as in-game currency or items can be traded permissionless.
  3. FX Markets: The Foreign Exchange Markets are huge — with a daily volume of ~$6 Trillion, even larger than stock markets. To solve international payments using Solana, it is also crucial to bring FX markets on-chain. Orderbooks can play a critical part by having local currency stablecoins pairs and allowing financial institutions to trade and add liquidity. CBDCs on Solana is another use case.
  4. Traditional Lending: A money market can utilize OpenBook as its matching engine for borrowers and lenders.

3. EVM Compatibility:

Since OpenBook is fully built on Solana, it’s not EVM compatible restricting the EVM-based dApps to using Serum and thus, limiting liquidity to flow to and from. Once Neon Labs makes Solana EVM compatible and deploys its solution to allow Ethereum dApps to deploy on Solana, without re-building the whole application for Solana. We expect DeFi apps from Ethereum-based ecosystems to deploy on Solana, leveraging the high-speed Orderbook of OpenBook. This can potentially bring a lot of adoption and liquidity for OpenBook. An alternative route will be to make OpenBook cross-chain and either use cross-chain bridges like a wormhole or deploy on other fast chains like Ethereum-based L2s, Aptos, Sui, etc

4. OpenBook as a Separate Chain:

An idea worth exploring might be to spin off OpenBook as a chain of its own, just like Sei and dYdX. The best part will be, it can leverage the speed and low cost of Solana via SVM (Solana Virtual Machine), while achieving its own customizability. Check out my deep-dive on Eclipse to get a complete understanding of App chains on Solana.

Will OpenBook Thrive?

Despite FTX being a house of Ponzi, their contribution to the launch of Project Serum on Solana can’t be overlooked. The Launch of Project Serum was truly a defining moment, not just for Solana, but for the whole crypto ecosystem.

Orderbooks are here to stay. AMMs are crypto-native novel innovation, but it was partly born out of the TPS constraints of Ethereum and with high TPS chains like Solana, NASDAQ on the blockchain is very much possible!

Credits: @M_Danger_Bick

Feel free to hit me up on Twitter, would love to chat and help in any way. It took me quite an effort to research and write — If you found this insighful, sharing always helps :)
Thanks Sitesh Kumar Sahoo for the wonderful cover image.

Further Reading and References:

  1. Openbook article by Coinmarketcap and SolanaFM
  2. Decrypt’s Solana DeFi article
  3. Market Making in DeFi by 0x
  4. Project Serum thesis by Sino Global
  5. Project Serum Docs
  6. Ramblings on AMMs and orderbooks
  7. OpenBook Technical Deep Dive

--

--