In case you have engaged yourself in research relating to cryptocurrencies or blockchain, you would have definitely come across terms like layer one and layer two protocols. However, it is possible that you do not know what these levels are and why they exist. In this article, we’ll look into blockchain layer architecture and how it enables trust and consensus on the chain. We will also explore how it may evolve in the future.
Blockchain is a unique combination of various existing technologies — distributed ledger technology, cryptography, game theory, networking, and so on — with several potential applications, including cryptocurrency. Cryptography refers to the mathematical and computer discipline that encapsulates encoding and decoding data.
Furthermore, without the control of a central authority, distributed ledger technology (DLT) ensures that information is adequately verified by cryptography among a cluster of users through a specific network protocol. The combination of these technologies creates trust amongst individuals or parties who would not otherwise have a reason to do so. They let users safely trade cash and data over blockchain networks.
The different layers of the blockchain are clustered to ensure security and scalability. In fact, blockchains must be very secure due to the fact that there is no central authority. Also, they must be scalable to ensure that they can house the growing numbers of users across the global system. Layers arose as a result of the need for scalability while maintaining top-notch security.
The layered structure of the blockchain architecture
In the blockchain architecture’s distributed network, each participant watches, approves and updates new entries. Blockchain technology is made up of a series of blocks that contain transactions in a predetermined order. These lists can be kept in a database or as a flat file (in text format). A blockchain’s architecture might be public, private, or consortium-based.
Blockchain’s design is divided into five layers.
Hardware infrastructure layer
This hardware layer securely stores blockchain data on a server. We access this date via the client-server architecture. When we use blockchain apps, the client machine sends a request to the data server for access. Since blockchains are peer-to-peer (P2P) networks, they connect clients with “peer clients” for data sharing. So, this layer is nothing more than a vast network of devices communicating and exchanging data with each other. In fact, this is how a distributed ledger is born.
Blockchain’s data structure is composed of a linked list of blocks in which transactions are arranged. When a certain number of transactions are authenticated by nodes, the data is bundled into a ‘block,’ uploaded to the blockchain, and linked to the previous block of data. This is how a chain of blocks emerges and eventually expands. The Merkle tree’s root hash is included in each block, along with the preceding block’s hash, date, etc. This ensures the security, integrity, and irrefutability of blockchain systems.
Every transaction on the block is signed digitally with the private key from the sender’s wallet. Since this key is only available to the sender, data can’t be tampered with by anyone. This step is termed ‘finality’. The digital signature also protects the owner’s identity, which is encrypted for security reasons.
The network layer, also known as the Propagation Layer or P2P layer, drives communication between nodes. The network layer also drives node discovery, node identification, transactions, block production, and block propagation. The peer-to-peer architecture of blockchain enables nodes to reach an agreement on a transaction’s legality. The transaction itself on the blockchain is carried out by nodes.
This layer ensures that nodes are able to discover one another, disseminate information, and synchronize with each other to bring authenticity to the blockchain.
The heart of all layers is the consensus layer. This is the layer that enables the key functionality of blockchain: consensus mechanism between nodes. In addition, it provides consensus in a decentralized manner and hence eliminates the need for a central authority. This is the approach that is core to decentralization provided by the blockchain. That is why, each transaction is processed by a large number of nodes, all of which must be in agreement with each other and validate the transaction’s authenticity. No single node has control over any transactional data. If this layer fails, the entire blockchain system fails.
This layer manages the protocol, which necessitates a minimum number of nodes to validate every transaction or how much cryptocurrency any one participant has in the network.
Key challenges in the consensus layer have to do with making sure that there is really one true version of the state of the computer at any point in time and that no one is subverting the truth.
The layers outlined till now make a complete blockchain computer. On top of this stack, the developers can deploy programs and have the computer run those programs.
The application layer ensures the blockchain’s deterministic nature. The application layer has the programs that users use to communicate with the blockchain network. This facilitates consumer device communication with the blockchain. The application acts as the user-facing front end, while the blockchain stack performs as the back end. Specifically, the key ingredients of the application layer are scripts, application programming interfaces (APIs), user interfaces, frameworks, smart contracts, and decentralized apps (dApps).
The application layer protocols are divided into the application and the execution layers. Smart contracts, underlying rules, and chaincode are part of the execution layer. Each layer plays its own part in the transaction’s journey. A transaction starts from the application layer and then moves to the execution layer where its validation occurs. After that, it is executed at the semantic layer.
Next, let’s map the layers above to the common terminology used in the blockchain world: layers 0, 1, 2, and 3.
Layer zero of the blockchain is comprised of the internet, hardware, and connections that will enable the next layer to function. These components form the technology that enables any blockchain to function. In the terminology outlined above, layer zero is made up of the hardware infrastructure layer and the data layer.
Layer zero includes the hardware layer but also miners and validators. It also includes peer-to-peer networking protocols also that allow communication between one another to eventually come to an agreed-upon state of what the network looks like.
Once all of these participants are able to come to an agreement on the current state of the blockchain computer, they have to be able to compute in a way that is verifiable and guaranteed that is game theoretical mechanics. This is where the compute layer comes in. Both the compute layer and the consensus layer are typically bundled together in almost every blockchain system. Both of these layers together are called layer one.
When we talk about Polygon or Ethereum, we are referring to the Polygon or Ethereum network layer. As explained above, this network layer manages consensus mechanisms, programming languages, block time, dispute resolution, and the rules and parameters that keep a blockchain network operational. Bitcoin is an example of a layer one blockchain. This layer provides security to the entire blockchain by way of its sheer immutability.
Layer one has gone through scalability challenges and has hence been evolving. As the number of blockchain users grows, layer one gets strained. This is when the consensus process may slow down the entire blockchain. While the blockchain is secure, speed can become an inhibiting factor. Miners have to solve cryptographic algorithms using computational power. As a result, the need for increased computational power and time grows. Proof-of-stake and sharding are two new mechanisms that address these speed challenges for layer one.
Layer two is a third-party integration used together with layer one to address the scalability issues of underlying layers by enhancing the number of nodes. Layer two is comprised of overlapping networks that sit on top of the base layers. Protocols commonly utilize layer two to solve blockchain’s scalability challenges by removing some interactions from the base layers and, as a result, increasing the system throughput. As a result, smart contracts ensure that off-chain transactions follow the regulations.
Layer two approaches are by far the most popular approaches for solving scaling issues. Nested layers, rollups, and sidechains are examples of layer two architectures that have addressed the blockchain challenges. Bitcoin’s Lightning Network is an example of a layer two blockchain.
The application layer forms layer three. This layer hosts the applications and the enabling protocols. Layer three acts as a user interface while masking the technical aspects of the communication channel. This layer brings blockchain utility and real interoperability to the developers.
In summary, blockchain enables capturing business value in a sustainable manner at equilibrium. But scalability is an inhibition factor in the widespread adoption of blockchain. As decentralization as a concept gains steam across sectors, the demand for blockchain will grow. So, it is critical to solving the scalability and throughput limitations of blockchain.