Derive: Harder, Better, Faster, Stronger

Derive: Harder, Better, Faster, Stronger
source: https://derive.xyz

We know Derive is coming. We know it’s made for pro traders. And we know it’s the most scalable derivatives protocol yet. But how did we build it all onchain? It’s time to find out how we leveraged the OP Stack to build Derive Chain and make us

  • Harder
  • Better
  • Faster
  • Stronger

Derive chain has increased the scope of our project by 100x, but before we can join the Superchain, let’s go back to basics.

Harder

Define harder:
  1. Adjective: Solid, firm, and rigid: not easily broken, bent or pierced.
  2. Adverb: With a great deal of effort

I wish we could have the former without the latter, but the definition has two parts for a reason. So how did we make Derive both harder (adjective: resilient) and also harder (adverb: more work)?

What’s a rollup?

First, we need to understand what a rollup is. I know there are a lot of great explainers out there and I don’t plan on bastardizing them… much. If you want to actually learn about rollups, there are plenty of people who do a better job than me and who all seem to name their articles the same:

  1. An Incomplete Guide to Rollups by Vitalik
  2. The Complete Guide to Rollups by Jon Charbonneau
  3. (Almost) Everything you need to know about Optimistic Rollup by Georgios Konstantopoulos

Here is my 1-paragraph TLDR - A rollup or “layer 2” is a system that scales the performance of a blockchain (i.e. makes transactions cheaper and faster) without sacrificing its magical trust properties. This is done by moving computation off the blockchain to a centralised operator and using a proof mechanism to hold them accountable. Proofs can be optimistic in that they assume correct operation unless challenged, or they can be cryptographic (zk), in that a proof of correct computation is provided when the state is updated.

The important part is that rollups are the only way we know how to scale Ethereum without compromising its values (i.e. trust, decentralisation & self-custody).

When did Derive find the time to build one?

Unless you’ve been living under a rock, you’ve been hearing about rollups for quite literally years. You know they’re technical marvels and you probably know they’re very hard to build. So how did we find time to build one all on our own?

Well, we didn't. Enter the OP Stack.

The Optimism team has been working on scaling Ethereum for over five years. First with plasma, then with OP mainnet and most recently the introduction of the OP Stack and the vision for the Superchain. So what’s the OP Stack? In Optimism’s words, it’s “an open-source, shared and standardized framework” for building Ethereum rollups. From our perspective, it is three things:

  1. Time Saver: 99% reduction in development time (it may actually be infinity% because I doubt it’s possible for most teams to build a rollup on their own)
  2. Battle Tested: This is the same codebase that has been powering OP Mainnet for years and securing billions in TVL without incident.
  3. Ethereum Aligned: Optimism is the most Ethereum-aligned team I’ve ever seen, perhaps to their own detriment at times. But if you can be sure of one thing, it’s that Optimism will continue to embed the core ethos of Ethereum into the OP Stack.

We’re not the only ones who think this way, with the likes of Base, Zora and Gitcoin all launching OP Stack Chains recently. Going from impossibly hard to definitely doable is pretty great, but let’s not stop there. We want launching our own rollup to be easy, an afterthought. That’s where Conduit comes in. Even when you have the whole stack designed, built and tested, securely operating the infrastructure for a sequencer is a huge task, and not one that protocol teams are set up for. With Conduit, that issue is eliminated, and the Derive DAO can focus almost exclusively on building the protocol.

Better

Ok so the OP Stack is great and all, enabling rapid deployment of fully functional Ethereum rollups, but we were already live on Optimism and Arbitrum, why not just build Derive there? What makes Derive Chain better than the status quo? It’s part quantitative (performance) and part qualitative (new features). Let’s tackle the new stuff first.

Sustainability

Just like any rollup, Derive Chain has an economic structure that fundamentally involves selling blockspace to its users (Derive traders) and purchasing it from Ethereum to ensure that there is sufficient data available on L1. This activity accrues fees to the owner of the rollup, Derive DAO, who incurs costs when posting the data to L1. If Derive is successful and the Derive DAO can govern the rollup effectively, it will be able to capture a sustainable margin of ETH-denominated transaction fees. This structure is visualised below.

Lyra Chain Economic Model
Derive Chain Economic Model

Usability

With different paradigms and standards for accounts on EVM, it’s hard for users to find the right setup for the right app. But a new chain is a blank canvas; when users bridge to Derive Chain, we can give them an account setup tailored for trading.

Users deposit from an EOA on Ethereum mainnet to a smart contract account on the rollup. By leveraging the latest and greatest in account abstraction, we unlock the bleeding edge of transaction UX, blurring the line between protocols and accounts:

  • Trade without gas: You only ever need USDC on Derive Chain. Using bundlers and paymasters from EIP-4337 we unlock native gasless transactions.
  • Trade everywhere: You can easily authorize all of your devices to trade on one account using session keys. Session keys are a smart contract module that give a device authority to make a limited amount of trades over a limited amount of time. One-click, no MetaMask popups, with maximum security and control from your signer.

We can also proactively integrate chain-level features and do things like running the ERC-4337 bundler alongside the sequencer, which helps devs who want to build AA-native dapps.

The Superchain

The further out we look, the more excited we get. The Superchain is coming. A network of OP Stack Chains that share security and a communication layer. It’s designed to bring internet-level scale to Ethereum. Why is this great for Derive? Well for one, all chains in the Superchain will have atomic composability with each other. This means composability with Base, Zora and Gitcoin, just to name a few. If Base can bring a billion people onchain (or even a million), Derive’s universe of potential traders has increased by several orders of magnitude. These users could access Derive without even needing to bridge. The opportunity for Derive is to become the foundational derivatives liquidity for the Superchain.

More than just an App-chain

At launch, Derive Chain will only house one protocol - Derive V2- meaning it will be an “app-chain”. This is a similar situation to what we see with DyDx and most of the OP Stack Chains launched to date (excluding Base). However, there is no constraint here. We know derivatives liquidity is a foundational component of the financial system and if Derive can succeed, it’s only natural to imagine dozens of protocols built on Derive Chain that directly integrate with that liquidity. We’ve already seen this on a small scale with Lyra V1 - Polynomial, Brahma, dHedge, Strands. Who will be the first to integrate and build on top of Derive? I for one am very excited to see what else gets built on Derive Chain.

Faster

If you’re still reading you may actually care about the performance of Derive and why we built our own chain instead of using OP mainnet or (god forbid) Ethereum L1. Being transparent and decentralized come at a cost. In contrast to many other projects, in Derive all the margin calculation logic is onchain, even while supporting advanced features like portfolio and cross margin. This makes Derive very gas intensive, for example, an account with 32 positions will take roughly 1~2 million gas to trade; and this number goes up to 5 million for 64 positions. While it’s obviously impossible to do on L1 (5m gas will take 180 USD to trade given gas price of 20gwei), with the help of rollups like Optimism, this number can be under 1 USD. But using a shared rollup like Optimism would mean sharing the throughput with other protocols too; on average, Optimism process 3m gas of computation every block, which jumps up to 20m when the network is busy. With the 30m gas cap and 2 second-block time, this leaves very limited resources to maximise usability for traders, we will likely need to cap the max positions size at a number under 30. Using a custom rollup makes it easy for us to double the performance by setting the block time to 1 second and lower the tx cost during peak hours by having a higher target block gas. With these parameters, we can settle up to 10 trades between huge accounts per second, around 30 trades per second with average traders, and up to 80 trades for perp traders, while allowing up to 100 positions per account.

Stronger

Derive Chain has made us harder, better and faster and as a result, we will become stronger. But with great strength comes great responsibility. The DAO must take on the role of governing Derive Chain, fostering its growth and ensuring its reliability and security. This task will not be shouldered alone, we expect to work closely with Optimism, Conduit and all teams building OP Stack Chains to bring the Superchain to life. This effort has already begun with the law of chains, which lays out a vision for a unified collective of chains committed to open and decentralised blockspace. As we move forward, the DAO will need to contribute to the Law of Chains to ensure that we build the best possible future.

Derive is the infrastructure layer for DeFi derivatives, visit derive.xyz.