As millions of people across the globe are utilizing blockchain technology as means to make a fortune, here is a detailed look at how the entire system actually functions.
Blockchain technology is an amalgamation of various technologies coming together under one roof to help the system run smoothly. Mathematical computation, cryptography, game theory, peer-to-peer systems, and validation protocols essentially join forces to power blockchain operations.
However, since blockchains eliminate the presence of a central governing authority, all transactions must be robustly protected, and data must be stored securely on a distributed ledger. The distributed ledger technology (DLT) works on a pre-set protocol with various computers across the network (or nodes) arriving at a ‘consensus’ to validate transactional data. Each node adds, scrutinizes, and updates entries as they come.
Blockchains have a layered architecture to facilitate this unique way of authenticating transactions. There are five layers involved, each with its distinct functionality. Let us dive right in and understand the architecture and what each layer does.
1. The Hardware Infrastructure Layer:
Blockchain data lies securely stored in a data server. When we browse the web or use any blockchain apps, our machines request access to this data from the server. The framework that facilitates this data exchange is known as the client-server architecture. Blockchains are peer-to-peer (P2P) networks that allow clients to connect with ‘peer-clients’ to make data sharing faster and easier. It is nothing but a vast network of devices communicating with each other and requesting data from one another. This is how a distributed ledger gets created. Each device communicating with another device on the network is a node. Each node randomly verifies transactional data.
2. The Data Layer:
Blockchains are nothing but a long chain of ‘blocks’ containing transaction data. When the nodes validate a certain number of transactions, the data is bundled into a ‘block,’ added to the blockchain, and linked with the previous block of data. The ‘Genesis Block’ is the first block in the chain and therefore does not need to be linked with any previous block. Instead, the subsequent block is linked with the Genesis block, and the process is repeated every time a new block is added. This is how a blockchain forms and continuously grows.
Every transaction is ‘digitally signed’ with the private key of the sender’s wallet. Only the sender has access to this key, thus ensuring that the data can neither be accessed nor be tampered with by anybody else. This is called ‘finality’ in blockchain terminology. The digital signature also protects the owner’s identity, which is itself encrypted, thus ensuring maximum security.
3. The Network Layer:
The P2P framework enables various nodes to exchange transaction data to arrive at a consensus about the validity of a transaction. This means that every node must be able to discover other nodes on the network for fast communication. It is the network layer that facilitates this ‘inter-node communication’. As node discovery, block creation, and block addition are also managed by this layer, it is also referred to as the ‘Propagation Layer.’
4. The Consensus Layer:
This is the most critical layer in blockchain operations. This layer is responsible for validating transactions, and without it, the entire system will fail. This layer runs the protocol that requires a certain number of nodes to verify one transaction. Therefore, every transaction is processed by multiple nodes that must then arrive at the same result and agree on its validity. This framework maintains the blockchain’s decentralized nature as no node has sole control over any transactional data, and the role is distributed. This is called the consensus mechanism.
With so many nodes processing transactions, bundling them up, and adding them to the blockchain, multiple blocks may get created simultaneously, resulting in a branch in the blockchain. However, there must always be a single chain block addition, and the consensus layer also ensures that this conflict is resolved.
5. The Application Layer:
This is the layer on which smart contracts and decentralised applications (dApps) run. Smart contracts make decisions based on certain triggers such as contract expiration dates, achievement of spot prices, etc. The actions that follow these decisions are executed by dApps. And all of this happens on the application layer.
dApps also facilitate the communication between user devices and the blockchain. Therefore, the application is like the user-facing front end, while the main blockchain is the backend, where the data remains securely stored.
So, there you have it - the 5 layers of a blockchain that help it function smoothly. However, if you have been reading about blockchains, you must have also come across terms like layer-0, layer-1, layer-2, and so on. What are these layers, then? Let’s find out.
This layer consists of the hardware and paraphernalia required to run the network and the consensus mechanisms without any glitch. It also includes an internet connection.
This layer governs the protocols that ensure security across the blockchain network. Layer 1 encompasses the consensus mechanism, coding language, and all the rules embedded in the code for the operations of the blockchain. Therefore, sometimes this is also called the ‘Implementation Layer.’ When users mention the Bitcoin blockchain, they are referring to this layer.
To improve the throughput of blockchains, processing power must be added. But doing so means the addition of more nodes, and this clogs the network. However, as mentioned earlier, the addition of nodes is critical for maintaining the decentralized nature of a blockchain. This means that if either scalability, decentralization, or throughput are tinkered with, they will affect each other on layer 1. This is called the ‘classic blockchain trilemma.’
Hence, layer 1 cannot be scaled without moving all the processing to a separate layer built atop the first layer, i.e., layer 2. This is made possible by enabling the integration of third-party solutions with layer 1.
Layer 2 is a new network that handles all the transaction authentication and decongests layer 1. Layer 1 only handles the creation and addition of blocks to the blockchain. The new layer-2 network sits over the layer 1 network and continuously communicates with it.
The Lightning Network is an example of a layer 2 blockchain sitting on the Bitcoin blockchain.
Smart contracts and dApps that only handle decision making and execution of follow-up actions form layer 3. Since the maximum functionality of the blockchain is derived from the innovation of dApps, this is the layer that interfaces between the real-world applications and the underlying layers that facilitate everything.