Acquiring a comprehension of the various layers of the blockchain
If you have done any research on blockchain technology or cryptocurrencies, you have most likely become familiar with terms such as layer one and layer two protocols. Are you interested in learning more about these layers, including what they are and why they exist? In this piece, I’d like to talk about the architecture of blockchain layers.
Blockchain technology is a one-of-a-kind combination of several existing technologies, such as cryptography and game theory, that has a wide range of potential applications. Some examples of these applications include digital currencies. The process of encoding and decoding data is referred to as cryptography, it is based on mathematical and computational principles.
Game theory is an academic discipline that focuses on the mathematical modelling of strategic interactions between groups of rational decision-makers. Blockchain technology does away with the need for intermediaries, reducing costs and boosting efficiency while enhancing security.
Distributed ledger technology, also known as DLT, stores information that has been cryptographically verified among a group of users who have previously agreed to do so through a predetermined network protocol. This occurs independent of the supervision of a central authority. The combination of these technologies encourages trust between individuals or organizations that would not otherwise have a reason to cooperate. They ensure that the transfer of value and data between users on blockchain networks can occur risk-free.
Blockchains are expected to have a high level of security because no central authority oversees their operation. In addition, they need to have a high degree of scalability so that they can accommodate an increasing number of users, transactions, and other types of data. The demand for scalability coupled with the requirement to maintain the highest possible level of security gave rise to the concept of layers.
What exactly does “scalability” of a blockchain mean?
When discussing blockchain technology, the term “scaling” refers to the process of increasing the throughput rate of the system, which is measured in transactions per second. Blockchain layers are now essential for improving network security, recordkeeping, and a variety of other functions as a direct result of the widespread adoption of cryptocurrencies in everyday life.
The term “throughput” refers to the number of separate transactions processed by a single system in one second. The main chain of Bitcoin (BTC) is only capable of processing seven transactions at a time, in contrast to the over 20,000 transactions that can be processed per second on Visa’s VisaNet electronic payment network.
A decentralized ecosystem has its foundational layer established by the blockchain. Layer two is an integration provided by a third party that works in conjunction with layer one to increase the number of nodes and, as a consequence, the throughput of the system. There are currently a lot of different layer two blockchain technologies being implemented. Transactions can be automatically processed with the help of these solutions thanks to the utilization of smart contracts.
As Bitcoin becomes a more significant force in the commercial world, blockchain developers are attempting to broaden the scope of blockchain management. They plan to develop blockchain layers and optimize the scalability of layer two in the hopes that this will cut down on processing times and increase TPS.
The trilemma of blockchain technology
The term “blockchain trilemma” refers to the widely held belief that decentralized networks can only provide two of the three benefits of decentralization, security, and scalability at any given time. This is a problem because decentralized networks are essential to the functioning of blockchain technology.
In the 1980s, members of the computer science community came up with the consistency, availability, and partition tolerance (CAP) theorem to express what is likely the most significant of these challenges. According to the CAP theorem, distributed data storage systems like blockchain can only simultaneously satisfy two of the three guarantees described earlier in this paragraph.
In the context of the currently active distributed networks, this theorem has developed into what is known as the blockchain trilemma. The idea that public blockchain infrastructure must make sacrifices in order to maintain its security, decentralization, or scalability is widespread.
As a consequence, the holy grail of blockchain technology is creating a network that has unbreakable security over a widely distributed network while also being able to handle transactional throughput on an internet scale.
Before we delve into the inner workings of the trilemma, let’s first define some broad concepts related to scalability, security, and decentralization:
- The capacity of the blockchain to process an increasing number of transactions at once is meant by the term “scalability.”
- The term “security” refers to the blockchain’s ability to prevent double-spending and protect data stored on it from being tampered with in a variety of ways that could compromise its integrity.
- Decentralization is a form of network redundancy that prevents fewer entities from exercising control over the network. This keeps the network from becoming overly centralized.
The dynamic relationship between scalability, security, and decentralization in a system
Before a transaction can be finalized, the network needs to reach a consensus on whether or not it is valid. If there are many people participating in the system, reaching an agreement could take some time. As a consequence, we can demonstrate that the inverse relationship between scalability and decentralization holds true even when the security parameters remain the same.
Now, let’s assume that two different proof-of-work blockchains have the same level of decentralization and that the hash rate of a blockchain is the best measure of its security. When the hash rate increases, the confirmation time decreases, and when the level of security improves and scalability increases. As a direct consequence of this, scalability and safety are directly proportional to the level of constant decentralization.
As a direct consequence, a blockchain cannot simultaneously optimize for all three desirable features, which forces it to make trade-offs. The most recent illustration of the trilemma in practice can be found with Ethereum. This summer has seen a significant increase in the number of people using the Ethereum platform as a result of the proliferation of decentralized financial (DeFi) applications. Ethereum’s potential for expansion is limited to a certain point.
Because of the surge in demand, transaction fees have skyrocketed to the point where some users are unable to participate in blockchain-based activities. The increase in Ethereum transaction fees illustrates the trilemma because it demonstrates that Ethereum was unable to scale without compromising either its decentralization or security.
Ethereum was designed with decentralization and security as its primary concerns, with a cap placed on the number of transactions that can occur per second (scalability). Users were required to pay higher fees in order to encourage miners to prioritize their transactions. In the same vein, Bitcoin’s decentralization and security have been given more importance than scalability.
It should not come as a surprise that blockchains such as Bitcoin and Ethereum have limited scalability at the moment. As a result of this, a global community of start-ups, corporations, and technologists are working feverishly on solutions for layers one and two of the blockchain trilemma.
The first layer of a blockchain network is designed to prioritize speed, expansion, and security.
The term “layer two” is used to refer to technological advancements and products that can be applied to existing blockchain networks in order to increase their scalability. The widespread use of blockchain technology and the development of decentralized networks may be fundamentally altered if a satisfactory equilibrium between the two layers can be achieved.
The problem is being tackled by the developers from a number of different angles. The attempt to improve the scalability of Bitcoin was the motivation behind the increased block size in Bitcoin Cash (BCH). On the other hand, there is no evidence to suggest that it is gaining in popularity.
Bitcoin is working on a solution to the issue by adding another layer on top of the blockchain layer that is already in place.
According to the concept underlying scaling solutions, layer two solutions will group together a number of separate transactions into a single one and will only occasionally query the base layer blockchain. Ethereum is taking a hybrid approach, with sharding scaling the base layer blockchain and the community anticipating several layer two solutions to boost throughput even further. This will allow Ethereum to scale at a faster rate overall.
The architecture of the blockchain consists of a layered structure.
Regarding the distributed network of the blockchain architecture, each participant is responsible for upkeep, authorization, and updating new entries. The structure of blockchain technology is represented as a collection of blocks, each containing a transaction in a predetermined order. Either a text-based flat file or a basic database can be used to store these lists once they have been created. Forms of public, private, and consortium blockchain architecture are all viable options.
The decentralized ledger technology known as blockchain can be broken down into six distinct layers.
The hardware layer of the infrastructure
The information that makes up the blockchain is kept in a secure location on a computer server that is housed in a data center. The client-server architecture refers to the relationship between clients and application servers, in which clients send requests to application servers for content or data while using apps or browsing the web.
Customers can now connect with other customers and share data with one another. A peer-to-peer network, also known as a P2P network, is a large network of computers that share information with one another. A distributed ledger known as a blockchain is maintained by a network of computers that operate in a peer-to-peer fashion and are responsible for computing, validating, and recording transactions in an orderly fashion. As a direct consequence of this, a distributed database is produced, which stores all of the data, transactions, and other relevant information. A computer in a peer-to-peer network is referred to as a node.
Data layer
The data structure of a blockchain is expressed as a linked list of blocks, in which transactions are listed in chronological order. A linked list and pointers are the two fundamental components that make up the blockchain’s data structure. A linked list is a chain of connected blocks that each contain data and a pointer to the block that came before it in the list.
Pointers are variables that refer to the position of another variable, and a linked list is a list of chained blocks that contain data as well as pointers to the block that came before it in the chain. A binary tree of hashes is what is known as the Merkle tree.
The root hash of the Merkle tree is stored in each block, along with other information such as the hash of the block that came before it, the timestamp, the nonce, the block version number, and the current difficulty goal.
The use of Merkle trees brings security, integrity, and irrefutability to blockchain-based system architecture. Merkle trees, cryptography, and consensus algorithms are the foundational building blocks of the blockchain system. The genesis block, also known as the first block, does not have the pointer stored inside of it because it is the first block in the chain.
Transactions in a blockchain must be digitally signed in order to guarantee both their authenticity and the completeness of the data they contain. Transactions are signed with a private key, and the identity of the signer can be verified by anyone in possession of the corresponding public key. The digital signature is able to detect any manipulation of the information.
Digital signatures guarantee unity because the data that is encrypted is also signed at the same time. As a consequence of this, the signature will become invalid if it is manipulated in any way.
Because of the encryption, the data cannot be accessed by unauthorized parties. Even if it is caught, further manipulation is impossible at this point.
An additional layer of security provided by a digital signature is protection for the sender’s or owner’s identity. Because of this, a person’s signature is inextricably associated with their owner in the eyes of the law and cannot be ignored.
The layer of the network
Inter-node communication falls under the purview of the network layer, also referred to as the P2P layer in common parlance. The network layer is responsible for all aspects of the blockchain, including transaction processing and block propagation. This layer is also referred to by the name “propagation layer.”
This P2P layer ensures that nodes can find one another, interact with one another, disseminate information, and synchronize in order to maintain the legitimate state of the blockchain network. A computer network known as a peer-to-peer network (P2P network) is one in which the nodes are dispersed and share the workload of the network in order to accomplish a specific goal. The transactions that take place on the blockchain are handled by nodes.
The layer of consensus
The consensus layer is absolutely necessary for the operation of blockchain platforms. The consensus layer is the most important and essential layer in any blockchain, regardless of whether the blockchain in question is Ethereum, Hyperledger, or a different one. It is the responsibility of the consensus layer to ensure that the blocks are valid, that they are ordered properly, and that everyone is in agreement.
Layer for applications
The application layer includes things like smart contracts, chaincode, and decentralized applications (also known as DApps). The protocols that are used at the application layer can be further subdivided into the application layer and the execution layer. The applications that end users run on their computers in order to communicate with the blockchain network are contained within the application layer. It incorporates a variety of components, including scripts, application programming interfaces (APIs), user interfaces, and frameworks.
These applications utilize the blockchain network as their back-end technology and communicate with the network using application programming interfaces (APIs). The execution layer is comprised of various components, including chaincode, smart contracts, and underlying rules.
Despite moving from the application layer to the execution layer, a transaction is validated and carried out at the semantic layer. Transactions are carried out by the execution layer, which also ensures that the blockchain remains deterministic. Applications provide instructions to the execution layer.
A breakdown of the blockchain’s layers
Layer 0
Layer zero of the blockchain is made up of different components that work together to make blockchain technology a reality. The technology underpins cryptocurrencies like Bitcoin and Ethereum, as well as other blockchain networks. Components of Layer 0 consist of the internet, hardware, and connections that make it possible for Layer 1 to operate without any problems.
The first layer
This is the foundation layer, and the immutability of this layer is the basis for the security it provides. When someone mentions Ethereum, they are typically referring to the Ethereum network, also known as layer one. This layer is in charge of the processes that lead to consensus, the programming languages used, the block time, the resolution of disputes, and the rules and parameters necessary to keep a blockchain network functioning properly. In some circles, it is also referred to as the implementation layer. A layer one blockchain is represented by Bitcoin as an example.
Concerns with the first layer
When combined, these scaling solutions result in an increase in the throughput of the network. Layer one, on the other hand, seems inadequate in light of the increasing number of people using the blockchain. On the layer one blockchain, the antiquated and cumbersome proof-of-work consensus process is still in use. This process was developed in the 1970s.
This strategy offers a higher level of protection than others, but it is slower than the others. In order to earn their rewards, miners must use computational power to solve cryptographic algorithms. Because of this, in the long run, additional computational power, as well as time, will be required. Additionally, as the number of users on layer one blockchain has grown, the workload on this blockchain has also increased. As a consequence of this, processing speeds and capacities have decreased.
Possible solutions
Proof-of-stake is an alternative form of consensus that will be utilized by Ethereum 2.0. This consensus approach validates new transaction data blocks based on the collateral staked by participants in the network, which results in a more time-effective process.
A scaling solution for the problem of too much strain being placed on the layer one blockchain is sharding. Simply put, sharding is the process of dividing a large task into multiple smaller tasks that are easier to manage. This task is the validation and authentication of transactions.
As a consequence of this, the workload can be dispersed across the network in order to make use of the computing capability of a greater number of nodes. As a result of the network’s ability to process these shards in parallel, it is possible for multiple transactions to be processed both sequentially and simultaneously.
The second layer
L2 solutions are the overlapping networks that are placed on top of the base layer and are known by that name. Layer two is utilized by protocols to remove certain interactions from the base layer, which ultimately results in increased scalability. As a consequence of this, the smart contracts that run on the primary blockchain protocol only deal with deposits and withdrawals and ensure that transactions that take place off-chain comply with the regulations. A layer two blockchain, such as Bitcoin’s Lightning Network, is an example of this type of blockchain.
So, what exactly is the difference between a blockchain with one layer and one with two layers? A decentralized ecosystem has its foundational layer established by the blockchain. Layer two is an integration provided by a third party that works in conjunction with layer one to increase the number of nodes and, as a consequence, the throughput of the system. At the moment, the implementation of a great number of layer two blockchain technologies can be observed.
Solutions for scaling on layer two
In recent years, there has been a meteoric rise in popularity for layer two protocols, and these protocols are proving to be the most effective approach to resolving scaling issues, in particular in PoW networks. In the following sections, various scaling solutions for layer two are discussed in detail.
Nested blockchain technology
A blockchain with a nested layer two runs on top of another blockchain. Layer one is responsible for configuring the settings, while layer two is in charge of carrying out the procedures. There is the potential for multiple blockchain tiers to exist on a single mainchain. Think of it as a standard organizational setup for a company.
Instead of having one person (such as the manager) carry out all of the work, the manager delegated tasks to subordinates, who then reported back to the management when they were finished with their respective assignments. As a direct consequence of this, the workload of the manager is decreased, while scalability is enhanced. For instance, the OMG Plasma Project functions as a level two blockchain for Ethereum’s level one protocol, which enables transactions to be completed at lower costs and in a shorter amount of time.
State channels
Through the facilitation of two-way communication between a blockchain and off-chain transactional channels using a variety of methods, a state channel can improve the total transaction capacity as well as the speed of the transactions. The miner is not immediately required to be involved in order to validate a transaction that is carried out over a state channel.
Instead, it is a resource that is adjacent to the network and is guarded by a mechanism that utilizes multiple signatures or a smart contract.
When a transaction or batch of transactions is completed on a state channel, the final “state” of the “channel” and all of its inherent transitions are posted to the underlying blockchain. This happens whenever a transaction is completed.
Examples of state channels include the Lightning Network for Bitcoin and the Raiden Network for Ethereum. The trilemma tradeoff requires state channels to sacrifice some degree of decentralization in order to achieve higher levels of scalability.
Sidechains
The blockchain is a transactional chain that runs concurrently with a sidechain, which is a chain that processes massive amounts of transactions in bulk. Sidechains have their own consensus method, which can be adjusted for speed and scalability, and a utility token is frequently utilized as a part of the mechanism that transfers data between the sidechain and the main chain. The primary function of the main chain is to provide general security and to act as a dispute resolution mechanism.
Sidechains are not the same as state channels in a number of significant respects. To begin, transactions carried out on sidechains are not held in confidence between participants; rather, they are made public on the ledger where they are recorded. In addition, the mainchain and any other sidechains are unaffected by any security breaches that occur on sidechains. The process of constructing a sidechain from the ground up calls for a significant investment of both time and effort.
Rollups
Rollups are scaling solutions for layer two blockchains that perform transactions outside of the layer one network and then upload the data from those transactions to the layer two blockchains. Rollups are also known as layer two blockchains. Because the data resides on the base layer, Layer One is able to maintain the rollups’ sense of security.
Users stand to gain from rollups due to the fact that they help to increase transaction throughput, open participation, and reduce gas costs.
The third layer
Layer three, also abbreviated as L3, is the common name for the application layer. While serving as a user interface, the L3 projects hide the more technical aspects of the communication channel.
As the layered structure of the blockchain architecture explains, it is applications at the L3 level that are responsible for giving blockchains their potential to be used in the real world.
Is it possible to find a solution to the blockchain’s trilemma?
The challenges that were encountered by distributed data storage, which led to the development of blockchains, were inherited by blockchains. The phrase “blockchain trilemma” was coined to group together these challenges and other issues that are related to it for the purpose of better understanding them.
The blockchain trilemma is currently just a conjecture, despite the fact that the word “trilemma” has been preserved. On the basis of the preliminary data, it is thought that this hypothesis is correct; however, it has not yet been demonstrated or refuted. Even though there has already been some success with layer one and layer two solutions, there is a need for additional research to be done.
Bottom Line
Scalability is one of the reasons why it is now impossible for mainstream adoption of cryptocurrencies to occur within the blockchain industry. The greater the demand for cryptocurrencies, the greater the pressure will be to extend the capabilities of blockchain protocols. Due to the fact that each blockchain level comes with its own set of constraints, the ultimate solution will consist of the creation of a system that is capable of resolving the scalability trilemma.
Layer one is extremely important because it provides the structure that decentralized systems are built upon. Layer two protocols are responsible for resolving any scalability issues that may arise with the underlying blockchain. Unfortunately, the vast majority of layer three protocols (DApps) only run on layer one at the moment, skipping layer two entirely. It should come as no surprise that these systems are not performing up to the standards that we have set for them.
Applications operating at the layer three level are necessary because they contribute to the development of real-world use cases for blockchains. In contrast to legacy networks, however, they will not be able to extract nearly as much value from their foundation blockchain as other networks.