Layer 2 refers to a secondary framework or protocol that is built on top of an existing blockchain system. The main goal of these protocols is to solve the transaction speed and scaling difficulties that are being faced by the major cryptocurrency networks.
For instance, Bitcoin and Ethereum are still not able to process thousands of transactions per second (TPS), and this is certainly detrimental to their long-term growth. There is a need for higher throughput before these networks can be effectively adopted and used on a wider scale.
In this context, the term “layer 2” refers to the multiple solutions being proposed to the blockchain scalability problem. Two major examples of layer 2 solutions are the Bitcoin Lightning Network and the Ethereum Plasma. Despite having their own working mechanisms and particularities, both solutions are striving to provide increased throughput to blockchain systems.
Specifically, the Lightning Network is based on state channels, which are basically attached channels that perform blockchain operations and report them to the main chain. State channels are mainly used as payment channels. On the other hand, the Plasma framework consists of sidechains, which are essentially small blockchains arranged in a tree-like structure.
In a broader sense, layer 2 protocols create a secondary framework, where blockchain transactions and processes can take place independently of the layer 1 (main chain). For this reason, these techniques may also be referred to as “off-chain” scaling solutions.
One of the main advantages of using off-chain solutions is that the main chain doesn’t need to go through any structural change because the second layer is added as an extra layer. As such, layer 2 solutions have the potential to achieve high throughput without sacrificing network security.
In other words, a great portion of the work that would be performed by the main chain can be moved to the second layer. So while the main chain (layer 1) provides security, the second layer offers high throughput, being able to perform hundreds, or even thousands, of transactions per second.
full detail : Layer 2 | Binance Academy