Chen we talk about a layer 2, layer2 or L2, we refer to a system or protocol that is built with the purpose of operating in parallel and separately from the blockchain (known as L1) for which it has been configured. The idea is that this system allows its users to carry out operations cheaply and quickly through said system, and then these operations are stored in the chain of blocks that supports the operation of the L2.
With this, L2 developers accomplish three important things:
Improve the scalability of the target blockchain of the system.
Offer a space to carry out transactions economically.
The best thing is that this system can be applied to all types of blockchain, so Layer2 is one of the most studied and used means to improve the scalability of blockchains without disrupting the functionality and security of its base protocols.
A good example of this can be seen on the net Lightning Network de Bitcoin, which allows its users to send payments instantly and with very low commissions (a few cents). The same happens in Ethereum, where there are several Layer2 (such as Plasma or Polygon) each with its own capabilities and technical operation.
What are the main types of Layer2?
Now, the operation of the Layer2 depends a lot on the blockchain or Layer1 on which it is developed. And this is due to two points:
Access to the base protocol and its monolithic or modular operating capacity.
Capacity for operations and advanced programming within the blockchain.
This leaves us with the Layer2 can be classified into the following types:
Centralized: in case the L2 is a centralized construction.
Bridge: in which we have a protocol that serves as an intermediary between L1 and L2, and that is responsible for balancing the operation between the two.
State Channel: in which L2 and L1 can communicate using an intermediary node for it.
Payment Channel: a simplified type of state channels that allows direct transfers between both networks.
roll up: which is nothing more than an L2 in which a large number of transactions are grouped and a record of them is left in the L1 blocks so that there is an unalterable record of them and their validity.
commit chains: which works in a very similar way to rollups, only in this case the L2 (or Commit Chain) periodically sends verifiable cryptographic proofs of the transactions carried out in the L1 to L2.
And in each of these cases, L2 developers can use cryptographic technology that suits the needs and characteristics that they want to apply to said L2. For example, ZK-Rollups can be used to provide scalability using Rollups in conjunction with crypto. ZK-snarks to provide a high level of privacy.
Layer2 on Ethereum
Now, Ethereum is one of the networks with the highest number of Layer2 active at the moment. This is positive, because not only does it give you the option to choose the one that best suits your needs, but it also helps you avoid the biggest problem with Ethereum: its high cost per commission. With that in mind, here we will talk about some of the most important Layer2 of Ethereum to avoid precisely this problem.
Among those Layer2 we can mention:
Polygon (MATIC) is one of the most used Layer2 within the Ethereum ecosystem. This is one sidechain, a sidechain that works based on the protocol Proof of Stake and that it has full compatibility with the EVM and smart contracts written in Solidity. In fact, Polygon uses the same address scheme as Ethereum, so the asymmetric keys generated in Ethereum work perfectly in Polygon, once you connect your wallet to the nodes of this network.
Polygon is capable of working in two modes: the most used is the Commit Chain and the second is through Optimistic Rollups, which makes it one of the fastest Layer2 of Ethereum that exists. The success of Polygon has been such that practically the majority of large dApps of Ethereum have moved to its network, attracted by its speed and low fees.
Another great Ethereum Layer2 is Arbitrum. This Layer2 allows dApps developers to enjoy a high-speed and scalable network that uses Rollups for its operation. To achieve this, Arbitrum offers full EVM support, so a developer can take a dApp from Ethereum and port it to Arbitrum, where it will work exactly the same.
Optimistic Ethereum u Optimism, is another Layer2 network capable of providing its users with a high-speed and scalable network built around Optimistic Rollups. For this, Optimistic Ethereum has created the OVM (Optimistic Virtual Machine), a virtual machine compatible with Ethereum, which allows the interaction of users with dApps within this network and that in the end leave a cryptographic record of those operations in the Ethereum network. .
The name of Optimistic Rollups has its origin in the operation of the solution. Optimistic is used because aggregators only publish the minimum necessary information without proof, assuming the aggregators work without committing fraud, and only providing proof in case of fraud. “Rollups” are used because transactions are committed to the main chain in packets (ie they are grouped together).
How to connect to these networks?
Of course, the three networks that we have mentioned are only a small part of the Layer2 ecosystem that exists in Ethereum. But surely you wonder how I can connect to these networks and take advantage of them? Well, the easiest way to do this is through the wallet Dappradar and the website chain list.
MetaMask is necessary because all these Layer2 of Ethereum work with the Web3 standard, so the MetaMask wallet allows you to connect to them and use it to make transactions. For its part, Chainlist is a website that lists all known networks (mainnet, testnet and Layer2) compatible with Web3.
Once you connect to ChainList and have your MetaMask properly configured, all you need to do is go to the network you want to connect to. For example, if we want our MetaMask to be able to use Optimistic Ethereum, you only have to search for this Layer2 in Chainlist, and click on the “Add Wallet” button.
By doing this, you only have to accept the interaction with your MetaMask wallet, and at the end, the Optimistic Ethereum network will be integrated into your MetaMask and then you can use it. In fact, if you see the image above you can see all the data of the Optimistic network, including the interaction address of its nodes and the chain identifier of said network.
Now can we really use Optimistic with our MetaMask? Well, if we review the networks added in MetaMask we can clearly see said network connected to our MetaMask.
And if we go to some dApp that uses the Optimistic Ethereum network (for example, Uniswap) we can choose Optimistic to connect and interact with said dApp, all through the new network that we have added to the wallet.
To connect our MetaMask through Optimistic, you just have to click on the Uniswap networks menu, select the Optimism option and click on “Connect Wallet”. With this, you must accept the interaction with the MetaMask wallet and in the end you will be using Uniswap within this powerful Layer2.