Layer 2 (L2) is a third-party blockchain protocol that integrates with an underlying Layer 1 (L1) blockchain to increase transactional throughput. L2 focuses on improving blockchain networks by offering support for verifying transactions and minimizing the tasks managed on L1. A key aspect of these L2 protocols is that they derive security from the underlying L1 blockchain.
L1 blockchain networks like Bitcoin and Ethereum process only a few transactions per second (TPS). Thereby, this causes a number of issues, like the networks getting congested, which sometimes pushes gas fees to extreme highs. When the need for higher throughput arose for the networks to be effectively adopted and used on a wider scale, L2 was implemented. L2 networks, such as Rollups and Plasma, provide solutions to increase the throughput of these blockchain systems. L2, in this context, are protocols that create a secondary framework, allowing blockchain transactions and processes to take place independently of the main chain. For this reason, L2 networks can be called "off-chain" scaling solutions. 
- Facilitating scalable execution while remaining separated from L1 networks without substituting any of its underlying blockchain protocols.
- Removing the need for miner verification.
- Extending the functionality of L1 networks.
- Reducing transaction fees while increasing blockchain programmability.
How Layer 2 (L2) Works
Generally, L2 functions in two parts: a network, which processes transactions, and a smart contract, which resolves any disputes and achieves consensus on the state of the L2 network by connecting it to an underlying blockchain. L2 networks offer fast execution of transactions, but they can vary significantly in how they achieve throughput. There is a shared characteristic across various L2 environments, and that is how they finalize transactions on the primary blockchain. L2 solutions need to present a cryptographic and verifiable form of "proof" to the blockchain, ensuring the reliability of the suggested alteration in the state, whether done proactively or retrospectively. The smart contract implementation can also vary among various L2 solutions. However, the core functionalities of the smart contract are to hold and release funds transferred to L2, as well as receive some kind of proof generated by L2, validate it, resolve disputes, and finalize transactions. A typical example of L2 implementation is Rollups. 
Rollups bundle multiple transactions into a single batch, which is then submitted to the main blockchain to reduce the number of individual transactions on-chain. There are two main types of rollups: optimistic rollups and zero-knowledge rollups (ZK rollups). These rollups provide increased throughput and reduced costs by executing modifications to smart contract states off-chain and subsequently validating them on-chain through proofs. Rollups attain scalability through the implementation of the following three approaches: 
- Conduct off-chain execution of transactions, which requires that the underlying base blockchain only executes small proofs to verify network activity and store raw transaction data.
- Batch transaction data together when submitted to a blockchain, thereby distributing the on-chain gas cost across multiple transactions.
- Require the presence of at least one honest validator to prove the validity of transactions on the base layer blockchain. This enables the utilization of smaller validator sets and higher hardware demands while maintaining security standards.
Bitcoin L2 Scaling Solutions
The Lightning Network stands out as a prominent L2 solution for Bitcoin. As the name suggests, it introduces lightning-fast payments on the Bitcoin blockchain, which can be as fast as milliseconds. Similar to other solutions of its kind, the Lighting Network processes transaction bundles from the primary blockchain off-chain before transmitting that data back. Additionally, it introduces smart contract capabilities to Bitcoin, marking a significant enhancement to the overall network. The Lightning Network focuses on providing the following benefits: 
- Instant payment
- Low cost
- Cross-blockchain swaps.
Ethereum L2 Scaling Solutions
Polygon is a protocol and framework used for creating L2 blockchains and sidechains, both running parallel to the Ethereum network while interacting with it. Due to its compatibility with Ethereum, over a thousand decentralized apps (dApps) are compatible with Polygon chains. The Polygon Technology includes some of the following: 
- Polygon PoS: An EVM (Ethereum Virtual Machine)-compatible sidechain using a proof-of-stake (PoS) consensus mechanism.
- Polygon zkEVM: A zero-knowledge EVM-compatible L2 blockchain that uses zk-STARK rollups and runs Ethereum smart contracts.
- Polygon Miden: It is a Starkware-based zk-rollup that uses zk-STARK.
- Polygon Nightfall: A privacy-focused L2 blockchain that uses optimistic rollups. It is suggested for DAO voting, private NFT marketplaces, and supply chain orchestration.
- Polygon Avail: A standalone L2 chain for storing transaction data that is separate from smart contracts. It works by decoupling the data and execution layers.
Optimism is an EVM-compatible optimistic rollup chain. It allows users to move assets in and out of the network by employing the Optimistic Ethereum Gateway. Also, Optimism can whitelist projects within two weeks when submitted forms are approved. An example of a project launched on the optimistic Ethereum mainnet is the Uniswap V3 Alpha product. 
Arbitrum is an L2 solution developed to enhance the speed and scalability of Ethereum smart contracts. It includes additional privacy features and presents itself as the optimal scaling solution for DeFi applications, offering the capability to employ an Arbitrum rollup to scale any Ethereum contract. 
Did you find this article interesting?