With transactions in the several hundreds of dollars and the chain’s blocks perpetually filled as competitors inch in, it’s not an overstatement to say the future of Ethereum depends on scaling solutions known as Layer 2s.
Layer 2 (L2) is a term for technologies which take Ethereum transactions off its main chain, enabling the network’s capacity to scale from its current ~14 transactions per second into the 1,000s. In doing so, gas fees, which make a simple trade on decentralized exchange Uniswap cost ~$50, are meant to drop to a matter of cents.
Image source: https://duneanalytics.com/kroeger0x/gas-prices
“This is like learning about Bitcoin after the whitepaper,” Ben Mayer typed over Discord. “Honestly I’d say there’s maybe 100 people or so who truly understand everything.”
Mayer, a developer at Rari Capital, haunts layer 2 solution called Optimism’s Discord daily, was talking about the mission to scale Ethereum.
Despite a demand-spurred increase in the blocks’ gas limit to 12.5M last July, the amount used has pushed right up against the new limit. At that point it gets expensive to use the Ethereum network because users must outbid each other to have their transactions included in the blockchain.
Image source: https://duneanalytics.com/kroeger0x/gas-prices
As Ethereum and DeFi, on principle and by design, are meant to be universally accessible, prohibitive transaction fees represent the biggest technical problem facing the industry today.
The problem of high gas fees and slow transaction times even has users moving to other L1 chains like Binance’s in order to make trades.
A Technical Problem, But Also a Social Coordination One
Kain Warwick, founder of derivatives protocol Synthetix, writes in his “Why Optimism” post regarding L2 choices, “it is not enough to pick the right design and trade-offs — we must also optimize for the solution most likely to be chosen by everyone else.”
This hits at the issue of social coordination which colors the L2 landscape. DeFi protocol teams must choose among an array of L2 solutions based not only on their technical trade-offs, but also what other projects are doing.
Synthetix made the first major move on Jan. 15 by launching staking of their SNX token on the L2 solution Optimistic Ethereum.
“It’s a gamble, yeah we’re making a bet,” Clinton Ennis, lead developer at Synthetix told The Defiant.
It’s a gamble because of the limitations of how L2 systems can interact with one another and also with Ethereum’s main, Layer 1 (L1) chain. Complexities abound, but at a high level as the first major protocol to move to Optimistic Ethereum, Synthetix is risking isolation from other chains. As DeFi thrives on its composability (the ability for protocols to build on one another – “money legos”), isolation from the pack could neuter a project’s usefulness.
Yearn Finance’s yveCRV vault for example employs Curve Finance, Sushiswap, and Pickle Finance protocols. If one protocol moves to an L2, the symbiotic relationship could break down.
“Transitioning too early means segregating oneself from the rest of the DeFi ecosystem and the growth that entails,” Nik Kunkel, MakerDAO’s head of Oracles and Backend, told The Defiant. “There is also the risk that the rest of the industry chooses a different L2 solution.”
Surveying the Scene
The Layer 2 solutions for Ethereum scaling fall into three major categories, state channels plasma and rollups. Each has their own set of tradeoffs.
State channels open up a channel for participants to transact with that’s off the main network. The solution is useful in that it allows participants to transact an infinite number of times, off Ethereum’s Layer 1 chain, and only port the information back to the main chain once the transactions are done by closing the channel. State channels add only two transactions to the Ethereum main chain.
One drawback to this solution is that the participants in the channel must be known ahead of time. The channel’s participants are set once the channel opens.
Major state channel solutions include Raiden Network, Perun Network, State Channels and Connext, the latter two of which partnered with The Graph last October.
State Channels has also proposed integrating state channels into torrenting networks which, as they are peer-to-peer and users sometimes lack incentives to make files available, are prime candidates for additional micropayment functionality.
Plasma is a subcategory of scaling solution which involves creating “side,” or “child” chains. Each child chain can have its own consensus mechanism, for example Proof-of-Stake, but its state, or overall balance, is tied back into Ethereum’s main chain through a data structure called Merkle trees.
In order to use Plasma, users must deposit a digital asset, ETH for example, to child chains. In order to make this a secure process, Plasma systems enable fraud proofs which allow users to challenge fraudulent transactions on child chains. The arbiter of said proofs is the Ethereum main chain.
Image source: https://plasma.io/plasma-deprecated.pdf
Withdrawals can take days on child chains to allow for potential disputes to resolve, but Plasma solutions do allow for arbitrary users to transact on Layer 2 provided they are both on the same child chain.
Plasma solutions come in at least four distinct flavors: Plasma Cash, Plasma Debit, Plasma Prime, and Minimum Viable Plasma (MVP). The solutions differentiate between one another based on factors like their Merkle Tree implementation, signature requirements and possible consensus mechanisms.
Current projects implementing Plasma chains include Matic Network, now Polygon, and OMG Network.
A solution called rollups appear to have momentum.
“The Ethereum ecosystem is likely to be all-in on rollups (plus some plasma and channels) as a scaling strategy for the near and mid-term future,” Ethereum co-founder Vitalik Buterin wrote in a post on the forum Ethereum Magicians.
Like Plasma, rollups come in various flavors, but the most important distinction is between Optimistic and Zero-Knowledge (ZK) rollups.
Crucially though, both rollups move computation and state-storage off-chain, while keeping some data per-transaction on-chain, or on Ethereum’s Layer 1.
Image source: https://vitalik.ca/general/2021/01/05/rollup.html
Optimistic rollups are similar to Plasma chains because both use a delayed function, whereby the operators of the L2 can be penalized for publishing fraudulent transactions to L1.
ZK rollups use validity proofs, which mean that every time a batch is published back to the main chain, it’s verifiably correct. There is no pending period before a user can withdraw from layer 2.
ZK rollups are slightly less mature than Optimistic rollups, and as yet can’t support all smart contracts. Further, while a move to Optimism barely necessitates a change to existing Solidity code, moving to ZK rollups currently requires developers to rewrite codebases in different programming languages.
Ethereum co-founder, Vitalik Buterin says in his rollups guide that “optimistic rollups are likely to win out for general-purpose EVM (Ethereum Virtual Machine) computation and ZK rollups are likely to win out for simple payments, exchange and other application-specific use cases.”
Though “in the medium to long term ZK rollups will win out in all use cases as ZK-SNARK technology improves,” the co-founder believes.
ZK-SNARKS are a cryptographic technology which allows a person to quickly prove certain knowledge of something without revealing what that something is.
Optimism, the most well-known implementation of Optimistic rollups, soft launched on Jan. 15 this year. The Optimistic Virtual Machine (OVM), the state machine which mimics the Ethereum Virtual Machines’ functionality, is currently in open-source alpha, meaning developers can now deploy and test smart contracts on the mainnet, though the Optimism team anticipates bugs.
The ZK rollups landscape is more diverse than Optimistic rollups’ with projects like ZKSync, and Starkware vying for adoption. Loopring, the decentralized exchange who’s daily volume is hovering around $10M, also employs ZK rollups.
Synthetix and Uniswap
After Synthetix, Uniswap may be the next major DeFi protocol to move to a rollup solution. The project produced an Optimistic Rollup demo called Unipig in October and Optimism’s current L2 solution is currently the only rollup which doesn’t require major changes to the protocol’s smart contracts.
Curve Finance has also dipped its toes in L2 by deploying its smart contracts to zkSync’s testnet.
dYdX, a decentralized margin trading platform, announced today that the project’s cross-margined Perpetuals are now live on Starkware’s ZK-rollup based L2 mainnet.
Adding to the complexity of the field, projects like Polygon, previously Matic Network, are striving to provide Plasma, Optimistic rollups and ZK rollups with the potential that, if one organization is developing all three, interaction between chains can be optimized.
A mature L2 ecosystem appears inevitable. Major demand exists and scaling, even more than simpler user experience, is Ethereum’s largest roadblock.