Cryptocurrencies, such as Bitcoin (BTC) and Ethereum (ETH), revolutionized the financial ecosystem through their decentralized nature. But a common complaint people have with these blockchains is the difficulty with scaling.
Despite the relative security, these major cryptocurrencies still have slow transfer confirmations and high transaction fees, especially during periods of network congestion. If virtual currencies are to gain mainstream adoption, networks like BTC and ETH need to develop ways to scale their operations and offer a seamless and swift payment experience. To address these scalability concerns, blockchain developers have created a new technology called layer-2 (L2) blockchains. These attempt to offload crypto transaction data from blockchains like BTC to make them faster, cheaper, and simpler.
Some crypto fans believe the accessibility and speed of L2s are essential for cryptocurrency’s mainstream adoption. So what is layer 2 in crypto, and why has it become so influential?
What’s the Difference Between Layer 1s and Layer 2s in Crypto?
Since L2s address many issues plaguing layer-1 (L1) blockchains, let’s first review how L1s work.
Also known as the base layer, an L1 in cryptocurrency refers to the foundational blockchain architecture for a digital asset. L1s provide the fundamental rules and structure everyone on a blockchain network or nodes must follow to process, broadcast, and record crypto transactions.
Examples include Bitcoin and Ethereum. Both use self-contained systems to verify transactions of their respective cryptocurrencies. For instance, Bitcoin uses a proof-of-work (PoW) consensus mechanism where computers solve advanced algorithmic problems every 10 minutes to verify new BTC transactions. As of 2022, Ethereum relies on a proof-of-stake (PoS) protocol where validators lock a minimum of 32 ETH on the blockchain to confirm new transactions. In both cases, these blockchains rely on internal processes and protocols to run their networks––L1s’ essential feature.
L2s, in contrast, are add-on blockchains that exist in relation to L1s. An L2 always integrates with a self-sufficient L1 blockchain like Ethereum, but L1s don’t depend on L2s to maintain their operations. Therefore, although L1s process crypto transactions without L2s, L2s can’t survive without their underlying L1s.
Why Are Layer 2s Important?
L2s aren’t as essential as L1s but play a significant role in addressing the blockchain trilemma. First mentioned by Ethereum’s cofounder Vitalik Buterin, the blockchain trilemma means blockchain networks can’t achieve a perfect ratio of security, decentralization, and scalability. As a blockchain increases two of these variables, the third suffers. Most often, L1 blockchains highly emphasize security and decentralization to the detriment of scalability.
For example, Bitcoin’s intricate PoW design is secure and decentralized but also slow and inefficient. It takes at least six confirmations on the Bitcoin network to post a transaction, and the Bitcoin blockchain only records seven transactions per second (TPS). For context, Visa processes a max of 65,000 TPS. Ethereum struggles with similar scalability issues, such as high transaction fees and slow confirmation speeds, especially during periods of extreme network congestion.
L2s helped resolve the blockchain trilemma by introducing scalability improvements on L1s. By offering alternative routes to use L1s, L2s ease network congestion and enhance transaction throughput. L2s often process transactions faster and cheaper than L1s, making them more attractive and accessible for crypto users. With L2s, L1 cryptocurrencies can easily grow their networks and handle high demand.
How Do Layer 2s Work?
Although most L2s have a similar mission (i.e., to improve L1 scalability), each project uses different processes. There are a wide variety of L2 technologies, each offering a unique set of features.
Sidechains are independent L2 blockchains that run parallel to an L1 chain. Although sidechains connect to L1 blockchains, they don’t rely on L1s for verifying internal crypto transactions. Instead, sidechains have separate validator communities using a consensus mechanism to secure their networks. In many respects, sidechains operate like L1s, except they aren’t standalone blockchains. Every sidechain aims to help securely transfer crypto off and on an L1 chain.
Most sidechains send digital coins between the L1 and L2 chains using a two-way peg system. Here, users lock a set crypto amount on the L1 blockchain to receive the same coins on the sidechain. Traders often use these digital coins in a sidechain’s ecosystem to enjoy cheaper fees and faster transactions. A crypto user can send some crypto back through the two-way peg to unlock an equal amount of coins on the main chain. Many sidechains also use smart contracts to record and transfer transaction history between the sidechain and the main chain.
A common example is Polygon PoS on the Ethereum blockchain. As the name suggests, Polygon PoS uses a PoS algorithm to confirm transactions. Nodes on the chain need to lock the native MATIC tokens to validate transactions and earn staking rewards. Ethereum projects and users integrate with the Polygon PoS to enjoy faster transaction throughput and cheaper fees.
Rollups are bundles of crypto transactions “rolled up” into one transaction block and sent to an L1 blockchain, typically Ethereum. L2s with rollups batch groups of crypto transactions into one data block and submit them to the main chain for final verification. L2 rollup solutions use smart contracts to transfer this payment data between their system and the L1 blockchain, attempting to mitigate third-party risk. Rollups typically squeeze hundreds of transactions in a smaller space, often offering lower fees and greater transaction throughput. They also help blockchains like Ethereum scale by taking the stress of validating crypto transfers off the main network.
Here are two common ways rollups work:
The simplest way to understand zero-knowledge rollups (ZK rollups) is to compare them to Bitcoin’s PoW consensus mechanism. To verify transactions on Bitcoin’s blockchain, validators use computer power to solve advanced algorithms and prove the transactions they post are valid. These algorithms are deliberately challenging, as they have to approve each BTC transaction. In a PoW blockchain, proof validators spend time and energy solving complex problems before verifying new transactions.
With a ZK rollup, off-chain L2 networks review batches of crypto transactions and solve difficult computations to prove their work. Once successful, a ZK rollup submits these transaction batches to the main chain with validity proof, which verifies the ZK checker used intensive processes to ensure their transactions are valid before sending them to Ethereum.
Unlike ZK rollups, optimistic rollups assume all crypto transfer batches are genuine, hence the word optimistic. L2s with optimistic rollups don’t submit validity proofs or run as many intensive tests on transactions as ZK rollups. Instead, optimistic rollup L2s use verifiers to constantly screen transactions before giving them final approval. Optimistic rollup platforms provide verifiers time to report potential transaction errors in a fraud proving process. If someone discovers an optimistic rollup is invalid, the protocol reverts the false transaction and penalizes the node responsible for the inaccurate data.
Since verifiers need time to assess every transaction in optimistic rollups, they take longer to post on the main blockchain versus ZK rollups. Optimistic rollups also lack rigorous validity proofs, making them more susceptible to human error. However, these rollups don’t require as much complex computational power, ensuring higher accessibility and easier integration with a wider variety of L1 applications. Since ZK rollup L2s require more computational power from network participants, they’re better suited for simple crypto-to-crypto transfers.
Think of state channels as a virtual payment settlement layer. These L2 solutions may allow users to deposit virtual representations of an L1’s cryptocurrency onto a debit-like payment portal to often enjoy faster speeds and cheaper fees. When crypto users use a state channel solution, they lock funds on the main blockchain to receive virtual representations of their coins in the state channel. Once the digital currency is on a state channel L2, crypto users open payment connections with other L2 users and exchange cryptocurrency. At any time, people can close their payment channel and submit the transaction data to a main blockchain via smart contracts.
For example, the Bitcoin Lightning Network (LN) is an L2 using state channels to communicate BTC payment data. People looking to use the LN lock BTC on the main chain to deposit the same BTC amount into their Lightning accounts. They make multiple fast and low-fee BTC transactions over the LN before closing their payment channels. Once someone closes a Lightning address, the final BTC balance posts on Bitcoin’s main chain.
Unlike sidechains, state channels aren’t separate blockchains and don’t support a diverse array of decentralized applications (dApps). Instead, state channel systems primarily work with convenient peer-to-peer microtransactions.
Examples of Layer-2 Crypto Projects
Since every L2 has unique goals and processes, choosing the best layer 2 in crypto is impossible. However, there are a few dominant L2 projects worth mentioning.
StarkEx: Created by Israeli company StarkWare, StarkEx uses ZK rollups to process transactions on dApps and post them on the Ethereum blockchain. For instance, dYdX currently uses the StarkEx network to offer users a secure, low-fee crypto trading experience.
Polygon: Formerly called the Matic Network, Polygon is an India-based crypto project offering a suite of scaling solutions for Ethereum, including a PoS sidechain and ZK rollups. Thanks to its partnerships with major companies such as Meta, Disney, and Starbucks, Polygon is one of the most widely publicized L2 scaling solutions.
Optimism: Similar to Polygon and StarkEx, Optimism is an L2 scaling solution on Ethereum. However, the Optimism network solely focuses on using optimistic rollups to offer a faster and cheaper experience. Today, many popular Ethereum dApps (e.g., Synthetix and Aave) link with Optimism.
Bitcoin Lightning Network: The Bitcoin Lightning Network is an L2 payment rail for BTC microtransactions. Anyone with a Lightning-enabled crypto wallet can transfer BTC from Bitcoin’s main chain to the LN and send their deposited BTC to other LN users. Whenever a payment channel on the LN closes, the entire transaction batch appears as one payment on the primary BTC blockchain.
Discover More Crypto Education on dYdX
At dYdX, we’re all about digital currencies, advanced technologies like L2 scaling solutions, and cryptocurrency trading. While dYdX v4 will be developed as a standalone blockchain, dYdX v3 runs on L2 Ethereum!
For news and updates surrounding the cryptocurrency universe, head to dYdX’s blog. And access more high-quality content and resources on our Academy. Crypto traders can also leverage our decentralized exchange to easily access fee-free crypto derivatives, including perpetual contracts.
Start trading on dYdX today!
The content of this article (the “Article”) is provided for general informational purposes only. Reference to any specific strategy, technique, product, service, or entity does not constitute an endorsement or recommendation by dYdX Trading Inc., or any affiliate, agent, or representative thereof (“dYdX”). Use of strategies, techniques, products or services referenced in this Article may involve material risks, including the risk of financial losses arising from the volatility, operational loss, or nonconsensual liquidation of digital assets. The content of this Article does not constitute, and should not be considered, construed, or relied upon as, financial advice, legal advice, tax advice, investment advice, or advice of any other nature; and the content of this Article is not an offer, solicitation or call to action to make any investment, or purchase any crypto asset, of any kind. dYdX makes no representation, assurance or guarantee as to the accuracy, completeness, timeliness, suitability, or validity of any information in this Article or any third-party website that may be linked to it. You are solely responsible for conducting independent research, performing due diligence, and/or seeking advice from a professional advisor prior to taking any financial, tax, legal, or investment action.
Any applicable sponsorship in connection with this Article will be disclosed, and any reference to a sponsor in this Article is for disclosure purposes, or informational in nature, and in any event is not a call to action to make an investment, acquire a service or product, or purchase crypto assets. This Article does not offer the purchase or sale of any financial instruments or related services.
By accessing this Article and taking any action in connection with the information contained in this Article, you agree that dYdX is not responsible, directly or indirectly, for any errors, omissions, or delays related to this Article, or any damage, injury, or loss incurred in connection with use of or reliance on the content of this Article, including any specific strategy, technique, product, service, or entity that may be referenced in the Article.