Scaling Decentralized Exchanges
Paths to higher throughput and why it matters for DEX growth in 2020
While the world waits for Ethereum to drop ETH2.0 on us, a trove of Layer 2 scaling solutions could deliver the same throughput benefits to the existing PoW Ethereum blockchain.
DeFi has succeeded in spite of a dial-up speed UX. Yes, the user experience on Oasis or Compound is much slower than Bank of America, but speed is not what differentiates DeFi from its traditional competitors. Likewise, PoolTogether and Set Protocol do not need 100 tx/s; the design innovation relies on the composability of DeFi.
Decentralized exchanges (DEXs) are different. DEXs’ success so far can be attributed to same DeFi qualities as the ones mentioned above, but speed remains the most important factor to any trader, and on that front, DEXs are far behind centralized exchanges.
Several teams rolled out Ethereum scaling research this past fall, and as one of the most active spaces on Ethereum, DEXs are among the first projects to try the next generation of Ethereum scaling solutions.
There are four main types of Layer 2 scaling plans to cover across these DEXs
Before proceeding further, a quick non-technical primer on Layer 2 scaling and specifically rollups. IDEX helps explain:
There are two critical costs to processing transactions on Ethereum, data and computation. All rollup solutions scale by bringing the computation off-chain and pushing the result of this computation to the network in the form of the Merkle root.
Essentially, roll ups batch hundreds or thousands of transactions, execute them off-chain and then use a single transaction to update the main chain, in this case Ethereum. Rollups reduce the size of the transaction data stored on the main chain by pushing signature verification and computation off-chain.
Once executed, the off-chain network publishes the headers of all the transactions that have been rolled up directly on the main chain, but without the signature verification, which is computationally expensive. While the Ethereum main chain currently processes 10-15 transactions per second, rollups can achieve up to 2000 tx/s.
Plasma was a popular layer 2 scaling design, but rollups differ in one key way: data availability. Plasma, like the Lightning network on Bitcoin, only puts the hash of the Plasma sidechain block onto the main Ethereum chain, whereas rollups also include data for each transaction batched in the block.
Since users lock up assets in a smart contract for layer 2 scaling, the rollup design allows for quicker withdrawals because only a wallet address is needed as opposed to all the transactions in the block.
Before we get back to DeFi and DEXs, it’s important to remember that rollups require an external network of nodes to aggregate transactions, which of course introduces another layer of risk. Most rollup designs rely on a token to incentivize nodes to batch and validate transactions and the ability to slash (take away) a node’s stake if it acts maliciously.
The speed benefits come from the near instant confirmation of this external network of nodes, instead of waiting for a new Ethereum block to be proposed and verified.
DEX Layer 2 solutions:
Uniswap (Optimistic Rollup) – Uniswap teamed up with the Plasma Group (now renamed Optimism) to demo a version of this – named Unipig – at Devcon in Osaka, where it achieved ~200 tx/s. The rollup is optimistic because the external network of nodes (called aggregators) assume that the transactions are valid and default to publishing them on the main Ethereum chain. Anyone can challenge the validity of a block and win the security deposit of the aggregator if it publishes invalid transactions. But this scenario only occurs if someone is pessimistic. Trust, but verify as Ronald Reagan would say.
IDEX (Optimized Optimistic Rollup) – IDEX 2.0 was announced in November (whitepaper here) and builds off of the Optimistic Rollup design, but is perhaps even more optimistic. Whereas Uniswap’s Optimistic Rollup publishes headers for all aggregated transactions to the Ethereum network (in the efficient CALL DATA format), IDEX’s Optimized Optimistic Rollup only does this when there is a challenge to the validity of a block. This greatly enhances the speed because there is no limit on the number of transactions that can be aggregated, but does slow down withdrawals and relies more on the security of IDEX’s external network of nodes. Trust us twice, but you can still verify.
Loopring ( ZK SNARKs Rollup) – Loopring 3.0 launched last month and to the best of their knowledge (and mine), is the first and only live ZK Rollup DEX protocol on Ethereum mainnet, where it already has achieved 100 tx/s. Rather than being optimistic, the external network of nodes produce a Zero Knowledge Proof of all the transactions aggregated and then publish that to the main Ethereum chain. Zero-Knowledge Proofs, otherwise known as alien magic, allow for one party to prove to another party that they know a certain piece of information without revealing anything about that information except that it knows it🤯. In this case, Loopring’s external system of nodes publishes a proof to the Ethereum main chain that it has batched and executed valid transactions off-chain. ZK SNARKS are most famously used by the privacy coin, ZCash. This cryptography famously requires a one-time trusted set up or ceremony. The great podcast Radiolab did a story on ZCash’s ceremony in 2016 and Loopring had an interesting design for theirs. Trust us once, and that’s it!
0x & DeversiFi (ZK STARKs Rollup) – 0x and DeversiFi have both unveiled scaling solutions that build upon the latest and most fashionable cryptography out there: ZK STARKs. It is a form of Zero-Knowledge proofs, but unlike ZK SNARKs, ZK STARKs does not require a trusted set-up. It is a much newer – and therefore untested – technology developed by STARKWARE and Prof. Eli Ben Sasson. Like ZK-SNARKs, ZK-STARKs can scale to Visa-like speed (2000 tx/s), and although it is computationally difficult to perform this alien magic, it is done off-chain, and only a proof of the computation is published to the Ethereum main chain. It is also quantum-resistant, just in case you stumble upon a quantum computer during your morning commute. Trust math! But wait in case there are any bugs.
Another key difference between Optimistic Rollups and ZK Rollups is that almost every Ethereum smart contract could be executed through the Optimistic Virtual Machine, so large portions of existing codebase can be ported onto Optimistic Rollups without much effort.
There are several new techniques that aim to bring this same feature to ZK Rollups, such as SNORKs, PLONK, SuperSonic, Halo and Marlin (no, I’m not making up these names, but clearly the creators played a lot of video games).
What’s the point?
Scalability and privacy are important features to a blockchain but they are rarely a distinguishing feature for a killer app. It’s hard to care about privacy in the abstract and scaling solutions can only match the performance of a centralized exchange.
For DEXs, the important breakthrough is reduction in gas costs, and thus fees that a trader pays. With the advent of aggregators and liquidity pools, spreads in the DeFi world have narrowed and liquidity has been enhanced.
Fees on decentralized exchanges are lower than centralized exchanges (duh) and this is especially true for smaller traders. The Layer 2 scaling solutions above could theoretically drop gas costs to 0.
This should be appealing to two types of traders, retail – think trades under $1000 – and high-frequency traders.
Additional resources:
Optimistic vs. ZK Rollup: Deep Dive [Alex Gluchowski/Matter Labs]
Scaling a Decentralized Exchange [Alex Wearn (IDEX) on Chain Reaction Podcast]
Optimistic Rollups [EthHub]
Ethereum Smart Contracts in L2: Optimistic Rollup [Karl Floersch/Optimism]
Loopring 3.0 Overview: From A to zkSNARKs [Matthew Finestone/Loopring]
Bringing Starks to Ethereum [StarkWare]
Chart of the Week: ETH Locked in DeFi
The original DeFi statistic, Total Value Locked (TVL) from DeFi Pulse continues to show strong growth in 2020. While the TVL has shot up to over $800m in USD terms and only some of that is attributed to ETH’s 30%+ rise since the beginning of the year. As seen above, the bull market has led to more ETH being deposited into DeFi protocols. Uniswap has seen its TVL increase 50% over the past week.
Market Chatter
Talk Bull to Me – The bull market enters its second week and ETH continues to outpace Bitcoin with ETH hitting $177 at the time of writing – a 23% increase WoW. The price appreciation occurs despite an increase in ETH’s inflation rate after a hard fork on January 2.
Alt sezn, yes plz – the price activity over the last two weeks is also the first time since the beginning of 2018 where Bitcoin lagged Ethereum and other ‘alt coins’. Outside of the BSV shenanigans, long-standing projects like Augur and ZCash saw 50%+ growth. DEX darlings ZRX and KNC also saw strong growth over the last week, perhaps on the back of announcements to introduce staking to their token economics.
Maker can’t burn past ETH – The Maker protocol has accrued over $5m in fees and have passed that onto MKR holders by burning the proceeds to reduce the overall supply. So far, over 1% of MKR has been burned, but this has not yet translated in returns for MKR holders. The MKR price lags behind the price of ETH, despite being the most successful project on Ethereum.
Odds and Ends
New Automated Market Maker for stablecoins, Curve launches Link
Margin lending platform, bZx, unveils DAO for protocol governance Link
Synthetix proposal will add ETH as an acceptable form of collateral on trading platform Link
imToken in 2020: 2019 Statistics and Update Link
How RenVM Actually Works [Link]
Gavin Andresen Pivots to Ethereum [Link]
PoolTogether, 0x, Kyber and dYdX data [Link]
Breakdown of DeFi Day at ConsenSys Accelerator Tachyon [Link]
Thoughts and Prognostications
What to Expect when ETH’s Expecting: An Engineer’s Guide to ETH2.0 [James Prestwich]
Liquidators: The Secret Whales Helping DeFi Function [Tom Schmidt/Dragonfly]
Becoming a Programmable Money Manager [The Defiant]
Progressive Decentralization: A Playbook for Building Crypto Applications [Jesse Walden/a16z]
The Borderless State of DeFi [Binance Research]
There ain’t no under-collateralized loans [Jonathan Tompkins/Atomica]
Preventing Front-Running and Limiting Miner Extraction Value through Auctions [Karl Floersch/Tarun Chitra]
That’s it! Feedback appreciated, especially on the more technical aspects in the Layer 2 discussion. Just hit reply. Written over the Pacific Ocean and in Ft. Myers, FL. Apologies for the delay; travel schedule should normalize and will be back to Wed/Thur delivery.
Weekly Dose of DeFi is written by Chris Powers from Concourse Open. Opinions expressed are my own and do not necessarily reflect the opinions of Concourse Open. All content is for informational purposes and is not intended as investment advice.