WHAT IS LAYER 2 OF BLOCKCHAIN?
Blockchain technology has undoubtedly evolved a lot since the advent of Bitcoin in 2009, and much of that evolution has been driven by the well-known second-layer protocols.
A second layer protocol is a software designed to work on top of the underlying technology of a specific blockchain protocol. The second lawyer's purpose is to extend the capabilities of the original protocol. This may require little or no modification to the original protocol. In this way, it is possible to add new features to the blockchain ecosystem while maintaining a clear separation between the blockchain protocol and the rest of the ecosystem's functionalities.
This, of course offers enormous advantages and flexibility for development. But beyond this, second layer protocols may be the future of many blockchains today. That's why we'll explain how they work, what potential second-layer protocols have, what problems they help solve, and what problems they help to solve. We'll talk about all that and more below.
How do second layer protocols work in blockchain?
The operation of the second layer protocols is basically focused on using the blockchain protocol's capabilities. The aim is to build a whole new framework to extend the possibilities of the original protocol.
This development model, separate from the blockchain's internal protocol, allows developers enormous flexibility. First, there is no need to introduce drastic changes to the protocol with the consequent problem of waiting for these changes to be accepted. Instead, changes are made in a separate space known as the second layer. These change speeds up the pace of development and create fewer serious development problems. In the end, this makes it possible to introduce features that would otherwise be very difficult or even impossible to do.
To see it more straightforwardly, we can take the following example:
To build a building, the first thing we must do is to have a good foundation. Then, if we make good foundations and a whole structure to support what we place our building, it will be very robust. Finally, when the foundation is finished, we can continue constructing the rest of the building without significant problems.
In this case, the foundations would be the first layer or the blockchain protocol, meaning Bitcoin or Ethereum. At the same time, the rest of the construction refers to the second layer protocols. A point where we can customize to the maximum what we build.
Types of second layer protocols
There are broadly two types of second layer protocols: state channel (state channel) or sidechain (sidechain). Each of these has its pros and cons, and that's what we'll look at next:
A state channel is a second-layer protocol that allows a group of users to perform an unlimited number of private transactions outside the main chain. These transactions have the particularity that they are made public and are only visible to users within the channel. In addition, only the initial and final state of the transactions is recorded on the main blockchain. Thanks to this, state channels allow users to make transactions with each other instantly, in a way, and at a low cost.
The way state channels work is that users rely on a series of contracts created to capture and verify the status of their transactions before, during, and after opening a channel. Then, once the state channel is opened, users can make as many transactions as they wish. All this without relying on the miners' verifications. Nor do they require the formation of new blocks per transaction.
Once transactions are completed, participants mutually sign a closing transaction. Closing transactions are unique in that they are recorded in a new block on the blockchain. Therefore, to continue transacting after a closing transaction, users must re-open a new state channel.
Sidechains are smaller blockchains that run parallel to the main blockchain and act as branches of the main blockchain. They are a unique type of second-layer protocol in which assets are transferred to and from the main blockchain to reduce congestion and facilitate scalability.
Sidechains have a similar structure and operating mechanism to the main blockchain where they run. Unlike state channels, each transaction in a sidechain is recorded and forms a new block. However, sidechain blocks can be verified faster because they require less power to verify and thus achieve consensus.
Once a sidechain is opened, users of the channel can perform the transactions they want and these are recorded in each block of the sidechain. As the operations are not performed on the main blockchain, its parameters can be adjusted to make them fast and economical to perform. At the end, when the sidechain is closed, everything that happens in the sidechain is broadcast to the main blockchain, where the states will be recorded in the blocks of the sidechain.
Potential of these protocols
Now, you are probably wondering what the advantages and benefits of developing second layer protocols are. Well, a simple way to see it would be with the following example:
For example, we know that Bitcoin does not have an outstanding ability to process thousands of transactions per second (TPS). This problem is known as the "Bitcoin scalability problem." This problem is because the Bitcoin protocol as it is designed is incapable of offering better scalability. Solving it leaves us with only two options: change the protocol completely or create a structure on top of it that allows us to circumvent the problem.
The first option is complex; it involves changing a proven protocol, which has been working for a long time and has established its security. In addition, changing the protocol can lead to the software of the nodes becoming more complex, and their computational and network needs to grow, negatively affecting the network's decentralization. And that's not to mention that it could bring the Bitcoin community to collapse because of the differences that may appear. Undoubtedly, severe problems.
The second case is to create a second layer protocol. Software is designed in such a way that we can use the features of Bitcoin while solving the problem of scalability. All this without touching the original protocol, affecting its security, and maintaining the status and growth of the current network.
This second option seems like a dream in reality, but the truth is that it is possible. The best example of this can be seen in Lightning Network (LN). Lightning Network is a second layer protocol that allows us to make instant and cheap transactions using Bitcoin. To do this, Lightning implements what is known as off-chain operations. This allows us to increase Bitcoin's scalability to levels that would normally be impossible. Undoubtedly, an ingenious solution to a complex problem that allows Bitcoin to adapt to the needs of its users.
So seen from that point of view, the potential of second-layer protocols is enormous. They allow us to solve scalability problems; they can also help us improve privacy or improve the intellectual contract programming capacity. The truth is that there are no limits in this case; using second layer protocols, everything is feasible to develop.
Consensus protocol changes.
Many projects like Ethereum are moving from older, clunky consensus protocols like Proof-of-Work (PoW) to faster, less wasteful protocols like Proof-of-Stake (PoS). Both Bitcoin and Ethereum use PoW, in which miners solve cryptographically difficult equations using their computational power.
While PoW is fairly secure, the problem is that it can be very slow. Bitcoin only handles 7 transactions per second, while Ethereum can only handle 15 to 20 on a good day. That's why Ethereum is looking to switch from PoW to PoS (via the Casper protocol).
What problems do they help solve?
The solutions possible thanks to second-layer protocols are varied. They range from scalability problems, transaction privacy, improvements in smart contracts, or the creation of frameworks to enable the creation of other tools that use the power of the blockchain on which they run. Of course, some of these solutions are more or less complex than others. But in short, the solution capacity of these protocols is enormous.
In Bitcoin, Lightning Network is one of the most popular solutions. This is because it aims to solve Bitcoin's scalability problem by making its transactions instantaneous. But the use of second layer protocols is not only limited to Bitcoin. In Ethereum, for example, Plasma is a second-layer protocol that seeks to improve the scalability of the blockchain.
Something necessary considering the enormous pressure exerted by the hundreds of thousands of smart contracts running on Ethereum: this ends up generating network congestion and usability problems in its decentralized applications or DApps.
Another excellent example in Ethereum is the Golem project. This is a distributed computing system that uses the Ethereum blockchain. The system works as a second layer protocol in which users receive a certain economic incentive in Golem tokens (GNT) for making computing power available on their computers. All this while allowing those who rent such computing power to use the network to make powerful distributed computations that otherwise could not. Such as seismic simulations, artificial intelligence research, and much more.
The same situation is repeated in other blockchains such as NEO, where we can also see solutions of this type. Such is the case of Celer Network, a second-layer protocol designed to provide further flexibility to NEO's decentralized applications (DApps).
Having said all this, it is pretty clear that second-layer protocols will be a fundamental part of the blockchain technology development ecosystem. This is because they make the technology more flexible and allow anyone to create an application that uses the power of blockchain to their advantage.