Here’s a statistic that tends to be overlooked, according to dYdX founder Antonio Julio: Derivatives currently make up around 75% of all trading volume in the crypto market.
Deriving value from an underlying asset — rather than spot trading the asset itself — allows for a broader variety of financial mechanisms, such as leverage trading and futures. It also happens to create much greater technical demands on platforms that aspire to provide the service at the high volume and speed that clients demand.
But high volume and high speed are two desirable characteristics that rarely find themselves overlapping in the same Venn diagram as blockchain tech.
On the Lightspeed podcast (Spotify/Apple), Julio explains how dYdX, the perpetual contract market, is trying to address performance demands by building its own custom blockchain, based on Cosmos SDK technology. “It’s tailor-made for derivatives trading, tailor-made for what we’re doing and we’re very excited about it,” he says.
Julio notes the transition to Cosmos is scheduled to take place this month, at which time the platform will be “fully decentralized.”
“Right now, dYdX is hybrid-decentralized,” he says. “It is fully non-custodial. It is fully transparent with what happens on-chain. But the main thing that’s not decentralized right now is the order book and matching engine.”
Most decentralized exchanges, such as Uniswap and Curve, are automated market makers or AMMs, Julio says. It’s much simpler, he continues, to operate an AMM than an order book, which requires “much more performance in terms of transactions per second, low gas fees, et cetera.”
Read more: Behind the times: How LVR is an ‘unfair game’ for DeFi liquidity providers
The reason order books demand such high volume and speed is that thousands of programmatically placed orders can take place every second, whether they’re filled or not. “No blockchain can support that,” Julio insists. “StarkWare and all the rest of the [layer-2s] can’t come close to the amount of performance that’s needed for that.”
“Potentially that will change long term,” Julio adds, “and we’re still excited to see that happen, hopefully, but that’s not the case right now.”
Decentralizing the order book
DYdX aims to solve the speed barrier by allowing buy and sell offers to take place off-chain. All settlements where trades are completed happen on-chain, Julio adds, “or at least through the StarkWare rollup that we’re using.”
“The main thing that we’re decentralizing is the order book and the matching engine,” Julio continues. “And that’s actually quite a difficult problem because these systems require really high throughput.”
“We took a look around and asked ourselves, okay, which blockchain can support on the order of a thousand plus transactions per second, ideally with very low or no gas fees.”
“The answer we came back with was none of them.”
The outcome was to build a “decentralized, but off-chain order book and matching system,” Julio says. Taking the concept of the Ethereum mempool, where transactions wait to be mined, Julio says “what if we had the entire order book not have to be put on-chain?”
“The validators can keep the entire state of the order book in their respective memories,” he says, thus furthering decentralization. “But you don’t actually have to add anything to the consensus state of the chain until a trade happens.”
It’s a unique property of the system, Julio says. “Only about one percent of the orders that get placed on any order book-based exchange get filled,” so the system requires “100x the scalability for placing and canceling orders.” The small percentage of trades that actually take place are settled on-chain, he says.
“It made this Cosmos chain that we’re building a really natural fit,” he says, “just because you can do really custom stuff if you own the entire stack.”