In an increasingly digital world, managing large volumes of data has gained centrality. We need to send, receive, manipulate, and store tons of gigabytes and do so with complete security. The concerns over data privacy and data ownership have caused great public displeasure. A small group of organizations owns and controls the private data of billions of users with no say over it.
In the midst of this rising user discontent, Blockchain has emerged as the perfect solution. It stores data decentrally with complete user ownership and immutability.
Queppelin’s co-founder, Mr. Prafulla Mathur, discussed the concept of blockchain in great detail in this podcast. In simple terms, he explains blockchain, its basic component, and its attributes like immutability, decentralization, and privacy protection.
With a special focus, he explains how blockchain employs three levels of security: block level, chain level, and network level. For curious beings out there, the podcast is a great starting point and a goldmine of insights.
Rest assured that this blog will also touch upon the basic concept of blockchain technology for a basic understanding. However, our main focus will be on the layers of the blockchain. So, to understand what the different layers in a blockchain ecosystem are and how they interact and function, read on.
First thing first, what is blockchain? A brief introduction
Put simply, a blockchain is a digital database that stores data in chronological order, i.e., the data is stored in blocks, and each block is linked to a block stored earlier than it, thereby forming a chain of blocks.
The links of this virtual chain are formed using a cryptographic hash function. That is, each block is represented by a hash, the value of which is determined by the data stored. The block stores its own hash and the hash of the previous block, thus forming a chain.
Thus, any tampering with the block will change the hash of that block. This will disrupt the chain, as the subsequent block in the chain will point to the earlier hash.
Further, the following is a list of blockchain features that make it a highly reliable technology:
- Immutable – blockchain technology is immutable and once data is stored it can never be changed.
- Distributed– The data on the blockchain is stored in a distributed fashion with each node on the network having its own database that they regularly update on the basis of consensus.
- Decentralized – There is no central authority controlling the blockchain platform. It is operated and maintained by the participant nodes.
- Secure – The blockchain offers a secured platform for data storage as the data is immutable and is distributed across the network with multiple nodes storing it. Also, it uses encryption to ensure the security of the data.
- Consensus – Blockchain operates on a consensus basis i.e. at least 51% of all participants should agree on the validity of the record before it could be added to the database.
Now we come to our main topic, the blockchain layer. These layers work in tandem to form a safe and secure ecosystem for data management and expand from back-end processing to the front-end user interface. The next section discusses each of these layers and their role in the blockchain ecosystem.
Layers Of Blockchain: The Story Behind
As the layers are connected in a way that represents the user journey while using the blockchain-based applications, it will be apt to understand it from their perspective only. So let’s take an example.
Imagine you want to transfer some money to your business partner. For this, you open your digital wallet, enter the amount, enter the receiver’s public key, your private key, and other information, and send the money.
This payment process is going through multiple layers of the blockchain. You will understand this process further when we break it down.
As you can see, the digital wallet is the application you use to send money; this is the application layer. This is where users interact with the blockchain. Then you enter details like public and private keys; these data are stored on the Data layer.
Moving further, when you send the money, it goes to the nearest blockchain server, which is one of the nodes on the blockchain network. This is the Network layer. Here, all such data is stored and operated in a distributed fashion.
These nodes communicate with each other to verify and validate the information you entered and try to reach a consensus with the majority of the nodes. This is the Consensus layer.
If the consensus so reached favors you, the transaction occurs, and the amount reflects on the wallet of your business partner.
All this is facilitated by the hardware, which consists of the physical devices and equipment participating in the process. This is the Hardware or Infrastructure layer. I hope this example clears up the air around the blockchain layers and their crucial role in the ecosystem.
Their importance is also underscored by the fact that an ideal blockchain setup does not have a single controlling authority. This makes it challenging to maintain security. Also, these different layers ensure the scalability of the setup.
Scalability is the ability of a blockchain platform to handle an ever-increasing volume of data and cater to a wider audience worldwide.
For now, let’s move on to the details of the layer.
As we saw in the above example, there are at least five layers composing a blockchain infrastructure, each acting as a distinct infrastructural component with a specified role.
- Hardware layer
- Data layer
- Network layer
- Consensus layer
- Application layer,
However, some experts also divide it into seven layers, with the addition of two layers between the Consensus layer and the Application layer. These are optional layers and go by the names:
- Inceptive layer
- Contract layer
Starting with a discussion of roles on all of these layers.
Hardware or Infrastructure Layer
This is the top-most layer of the blockchain infrastructure. The blockchain operates on a client-server architecture and a peer-to-peer network setup. Hence, the nodes on the network work together to manage a database securely, and this layer incorporates all the hardware components of these nodes.
These nodes connect with each other to form a highly recognized peer-to-peer network. This network arrangement facilitates the distribution of data and decentralization and provides the resources for powerful computing requirements.
The data layer is the second layer that represents the database on the network. Blockchain is primarily a digital ledger that records digital transactions and stores them in the form of blocks. The data layer is where blocks are created and stored along with other relevant data.
So, in the preceding example, when you entered your private key, the system recognized you by comparing it to the private key in its database. This, however, does not mean that your information is public and no one can see the amount of money you are sending and receiving.
As we know, all the participants in the blockchain network are provided with a public key and a private key. At the time of the transaction, the data is encrypted using the public key of the receiver so that only the receiver could decrypt the message, that too, using their private key.
Coming back, once the transaction is complete, all the related details are stored on the data layer in the form of blocks. In the second section of this blog, we discussed how the blockchain stores data in the form of blocks. If you missed it, please refer to it.
Moving on to the third layer.
The Network layer is responsible for inter-node coordination on a blockchain. It supports communication and synchronization among the nodes on the network, facilitating block propagation and block discovery over the network for distributed storage. That is why it is also known as the Propagation layer.
The network layer is crucial to maintaining the peer-to-peer setup wherein the nodes share the workload. The network layer supports building consensus on the Consensus layer of the blockchain.
Since blockchain operates on a consensus-based system, the consensus layer is very important. The layer runs a protocol to help peers reach an agreement on whether to add a block or not.
Each and every block is first validated and agreed upon by the majority of the nodes before it gets added to the chain.
Understand it like this: when a node nominates a block, it is put forward for voting by all the other nodes on the block. They validate the block by referring to the database with them, and if it passes scrutiny, then the block gets added to the blockchain.
There are multiple ways to reach a consensus, such as Proof of Work(PoW), Proof of Stake(PoS), Proof of Elapsed Time (PoET), and Proof of Deposit (PoD). However, two of the most prominent ones are PoW and PoS.
Yet another podcast by Mr. Prafulla Mathur discusses the concept of PoS very beautifully. Check it out below.
The application layer is where Smart Contracts and dApps run. This is the user-facing front end, as we also saw in our example. The digital wallet application in that example is the application running over this layer to help users interact with and use the blockchain.
The UI/UX of such an application is just like any other application we have used till now. The difference lies in the storage, operation, and management of the data on the back end. Some examples are Social Media Applications, Web Browsers, Defi Applications, NFT platforms, etc.
Optional Additional Layers
As we also mentioned above, some experts also suggest two additional layers apart from the five basic ones. These are the Incentive layer and the Contract layer.
As the nodes work hard to maintain a fully functioning, fail-proof system through validation and consensus processes, they are compensated in exchange, and the Incentive layer, which comes after the Consensus layer, takes care of these compensations.
The layer defines the types of incentives available on the network and the minimum amount of transaction fees needed to perform such actions.
The contract layer comes just before the Application layer and specifies how a service application will operate, the type of information it can access, and how it can access.
Now that we have discussed the infrastructural layer in great detail, it is time we discussed some terms that divide these layers on the basis of their functionality. These are
- Layer 0
- Layer 1
- Layer 2
- Layer 3
Layer 0 is the blockchain itself and consists of all the underlying Infrastructure and Networking architecture. This includes the internet, protocols, consensus mechanism, hardware, and other equipment to establish and maintain the blockchain network.
This may be touted as the “network of blockchains” that allows various Layer 1 networks such as Ethereum and Bitcoin to communicate, function, and execute cross-chain interoperability and lays the groundwork for future scalability.
While layer 0 was more about infrastructure, layer 1 is about functionality, which is why it is also called the Implementation Layer. Layer 1 combines the computational and consensus functions of the blockchain network.
It takes care of the consensus mechanism, coding language, and governing rules of the blockchain network, among others. In fact, the various prominent use cases that we see of the blockchain like Bitcoin, Ethereum, and Solana, belong to this layer only.
However, the scope of scalability narrows in this layer due to the large volume of operations occurring on it.
Layer 2 is to aid Layer 1 with scalability issues. Since increasing scalability means adding more nodes to the network, this leads to complexities beyond a certain threshold and may even clog the network. On the other hand, adding nodes is also important to decentralize the network.
Thus, Layer 2 is the third-party solution developed to assist Layer 1. It handles transactions and authentications and continuously communicates with Layer 1 to decongest it while achieving decentralization.
Layer 3 is more like the Application layer that handles smart contracts and dApps. This layer acts as a user interface as well as the interface between real-world applications and the underlying layer of the blockchain network. Thus, it helps simplify the user experience of working with Layer 1 and Layer 2.
Layer 3 functions include, inter and intra-chain operability including decentralized exchanges, staking applications, liquidity provisioning, etc.
Blockchain is a path-breaking technology offering solutions to some of the most pressing global exigencies. For users, it offers safety to their data and facilitates its ownership. For businesses, it creates a trustless environment with no intermediation by any third party and a predictable business environment through smart contracts.
However, as we saw in the above blog, it is a complex setup as multiple layers interact with each other to produce the desired outcome. These layers take care of different responsibilities while coordinating with each other to resolve the classic blockchain trilemma of scalability, security, and decentralization. Thus, understanding these layers helps businesses better align blockchain with their business goals and make technologically sound business decisions.