RabbitX senior developer Alex Sumner recently sat down with Starkware to discuss the nuances behind creating a DeFi orderbook, the benefits, drawbacks, and why RabbitX chose to build on Starknet. The original interview can be viewed here. I've summarized the talk into succinct takeaways for you in this post:
Decentralizing an orderbook-based exchange is not straightforward, but the motivations to do so are clear. Permissionless and censorship-free access to financial markets are something that a free society needs and that we aim to provide.
An orderbook (OB) is the superior option for price discovery. Automated Market Makers (AMMs) were invented as an alternative because putting an OB onchain was initially not feasible. AMMs have never been the optimum liquidity choice. The AMM's only advantage is decreased gas costs, but it is a much less efficient form of liquidity than an actual OB.
An OB is two lists of buy and sell orders sorted by price. When a new order comes in, it's compared with existing orders on the opposite side of the book for execution.
There are three broad categorizations of participants on an OB-based exchange. The first two are the actual traders, consisting of regular traders and arbitrageurs.
Market makers are the third, and they're the liquidity providers who are responsible for order flow. They take a view on what they think the current price should be and place a series of buy and sell orders to reflect that. Market makers try to facilitate a steady stream of buy and sell executions so that their positioning is delta neutral at all times.
The problem is if you try to put an OB onchain, there's a lot of data to be stored and processed for the transactions, and the gas costs are prohibitively expensive. The AMM was a bandaid-type, short-term solution for this; but DeFi cannot support major, sustained, institutional-level volume with this liquidity model.
That is why RabbitX is building on Starknet. It has the fastest execution, lowest fees, and most importantly the best security for us to build our OB-based trading infrastructure. It is cryptographically impossible to post a fraudulent transaction on a ZK rollup, this is not the case with Optimistic rollups. ZK STARKS (what Starknet uses) also have structural benefits over ZK SNARKS; not all ZK rollups are created equally. (Note: you can read more about the differences between ZK rollups in our blog post here).
RabbitX will be the first perpetuals exchange live on Starknet. We are very proud and excited of this accomplisment. Our mainnet launch is planned for March 2023.
The plan for our V1 is to start with a hybrid OB exchange, with offchain order processing and onchain settlement using Starknet. The OB will initially be offchain, which helps substantially with processing and reduces latency and cost, and is how we will offer zero-gas trading. We will then make it more decentralized over time and eventually bring the OB onchain.
Traders don't need to bridge to Starknet L2 to use RabbitX. RabbitX's L1 to L2 bridging uses a Starknet contract where traders deposit funds via Ethereum L1.
We're very impressed with the Starknet and Starkware communities, we think they're an excellent place to build and that Cairo dictionaries are a powerful tool.
Cairo and STARKs open up a huge range of new possibilities for DEXs. RabbitX will continue to iterate and improve on the hybrid approach and aims to be the premier derivatives DEX not only on Starknet, but all of DeFi.
Follow at @BackTheBunny
Check out another one of our popular posts --> DeFi Hack, Trading Strategy, or Short Squeeze? A Logical Framework