Ethereum Second Layer Solutions
Layer 2 or second layer scaling is a general term for solutions that help with increasing the capabilities of the main chain by handling transactions off-chain (off Layer 1). The two primary improvements layer 2 can provide are transaction speed and transaction throughput. On top of that, Layer 2 solutions can greatly reduce gas fees.
Technically, Polygon is its own blockchain (with its own token: MATIC) but was built to become Ethereum’s internet of blockchains. Polygon provides the architecture that enables developers to create custom, application-specific chains that leverage Ethereum’s security similar to the Cosmos hub-and-spoke model. It provides an interoperable layer that can bridge many different projects and scaling solutions such as zk-rollups, optimistic-rollups, and sidechains (discussed below).
Since Polygon is a separate chain, it must be secured by a separate proof-of-stake consensus mechanism where validators stake MATIC. However, the MATIC is staked in smart contracts on the Ethereum main chain. Polygon connects to Ethereum through a "bridge" with the use of a lock and mint mechanism. Users deposit funds into the bridge, which locks them in a smart contract on Ethereum and mints the equivalent amount on Polygon. To withdraw funds, you will have to go back through the bridge. The bridge (and funds) are secured by a 5/8 multi-sig scheme making it incredibly more centralized than the Ethereum mainchain. Additionally, ~33% of MATIC staked is run by a node controlled by Binance. These centralization factors should be considered when weighing the cost of transacting on a layer 2.
Despite any centralization issues, Polygon has seen enormous growth in 2021, from ~$1B to $10B in total value locked on the chain. In fact, projects like Aave and SushiSwap now have more users on Polygon than on the Ethereum mainchain.
Polygon growth in 2021. Image credit: DeFiLama
Polygon dApp users. Image credit: DappRadar
Rollups improve scalability by combining or “rolling up” sidechain transactions into a single transaction, generating a cryptographic proof (called a SNARK), and then submitting only the proof to the base layer. This removes the burden of data on layer 1 while also allowing layer 2 transaction data to be available on Layer 1 for validation. Moving transactions on a rollup layer 2 solution guarantees that one could verify the integrity of the data if it’s actually present. Scalability is improved on the base layer due to the lack of reliance on Layer 1 storage.
Rollups offer similar capabilities as Plasma, but without suffering from the “data availability problem”. Rollups offer many-to-many transactions, smart-contract capabilities, and significantly reduced total L1 block space requirements all while extending Ethereum’s security assurance to the L2.
There are 2 types of rollups: Zk rollups and optimistic rollups.
Zk rollups are faster and more efficient than optimistic rollups but they suffer from friction and compatibility issues when migrating smart contracts to layer 2. Loopring, Deversifi, and zkSync are good examples of projects utilizing Zk rollups.
Optimistic rollups run an EVM compatible Virtual Machine called OVM (Optimistic Virtual Machine) which removes the compatibility issues that exist in Zk rollups. This is extremely critical as composability is paramount in the Ethereum ecosystem, especially in DeFi. One project working on optimistic rollups is Optimism.
Rollups can 100x Ethereum’s scaling without ETH 2. With ETH 2 + Rollups (years away), scaling should theoretically reach 25k-100k transactions per second (TPS). There is increasing competition among various flavors in the rollup space with the trend being towards EVM compatibility and catering towards various needs of dApps.
Image credit: Matter Labs
A general list of Ethereum layer 2 scaling solution projects includes:
- Hermez Network
- Arbitrum: live to developers
- Aztec: Live on mainnet with privacy smart contracts platform will be released later in 2021.
- StarkWare: Released in 2021 followed by an AMM, Caspian, in June 2021.
- Optimism: Set to launch in 2021 (no set date yet announced).
xDai is an EVM (Ethereum Virtual Machine) sidechain and functions independently from Ethereum. However, its native token XDAI (converted DAI from Ethereum), as well as its multi-use governance token (STAKE), sit atop the Ethereum blockchain. This means the xDAI network adheres to the same protocol updates, block size limits, and EVM specifications as the Ethereum mainnet. This compatibility makes it easy for developers, projects, and users to move seamlessly between chains.
xDai is a sidechain with a stable reserve currency to help reduce congestion on the Ethereum chain and provide a stable unit of account. Through improved interoperability, xDai increases the available Ethereum operating space, reducing network congestion. Transactions conducted with XDAI, which is created when DAI on Ethereum is locked in the xDai bridge, can be made for fractions of the normal gas costs. The cost of a transaction on Ethereum can vary wildly ($1-$30+) based on congestion and the price of ETH whereas XDAI transactions cost less than $0.01.
However, xDai also uses a different consensus mechanism than Ethereum called POSDAO and has 5 second block times. Validators are incentivized with STAKE rather than the native XDAI token. This decoupling of the actual currency with STAKE helps transactions be processed at a lower cost.
Currently, nominated validators are signing blocks making the sidechain far less decentralized than its mainnet counterpart. In the future, operations will transition to a more permissionless delegated model where community members can participate as validators and delegators.
Ethereum has several second-layer solutions for scalability and privacy that are live, in development, or in the research phase. Developments on second-layer scaling solutions on the main PoW Ethereum chain (not the ETH 2.0 version) are typically referred to as ETH 1.x. Mirroring Bitcoin’s Lightning Network is Ethereum’s Raiden Network for bidirectional, off-chain channel payments. Channels allow participants to exchange transactions off-chain thousands of times while only submitting two transactions to the base layer. However, the drawback is that channels are application-specific and cannot be used to scale general-purpose smart contracts. Raiden comes in several releases, with MicroRaiden and Raiden Network Red Eyes already live.
Eventually, Raiden’s aim is to achieve generalized state channels rather than just payment channels. However, such technology is exceptionally sophisticated and currently under intensive research and development.
Other layer two scaling solutions for Ethereum include Plasma and dappchains, which are childchains tethered to the Ethereum root chain. Plasma has received significant attention following the release of the corresponding paper by Justin Poon and Vitalik Buterin in August 2017. Nonetheless, the increasing complexities around practical challenges when it comes to implementing Plasma have become a significant concern.
Dappchains function similarly to Plasma as childchains of Ethereum and were proposed by the gaming platform, Loom Network. Loom offers a software development kit (SDK) – among other tools – to build scalable dApps on Ethereum – a major problem for developers at the moment. Dappchains have their own DPoS consensus for non-vital components of contracts, and retain the settlement, finality, and state transition of the larger Ethereum network.
Plasma enables the creation of an unlimited number of transaction-processing child chains (Ethereum mainchain clones) using smart contract and Merkle Tree technology. It is an attempt to create a more flexible state channel that enables many-to-many asset transfers with complex logic, as opposed to just simple one-to-one transfers. Like State Channels, Plasma is completely separated from the Ethereum L1.
One downside of Plasma is the long withdrawal period for users who want to remove their funds from Layer 2. Another is the ‘data-availability problem’. Since Plasma and the child chains are entirely disconnected from the main chain, it creates game-theoretic issues when the Plasma chain and the base layer chain try to sync up about the state of truth. The main chain can never with 100% certainty know the state of any Plasma chain, and thus cannot export its security to any child-plasma chain.