When discussing blockchain architecture, we refer to the components, layers, and overall technology that comprise a complete blockchain system. Each layer has a unique role, from storing data to maintaining network connectivity and ensuring consensus across the system.
Understanding how these layers work together to make up a system is crucial for blockchain, smart contract developers, and anyone seeking to leverage blockchain technology effectively.
In this article, we’ve broken down the intricacies of blockchain architectures into easy-to-understand pieces. We’ll explain what is the scalability trilemma, what blockchain functional layers are and how they work together to form the architecture of the layer 1,2, and 3 chains we’ve heard about.
Before getting into the different parts making up a complete blockchain architecture, it is important to understand the issues that all of these components try to solve: making the blockchain scalable.
The term "scaling" in blockchain technology means improving the system's (chain) capacity for processing transactions, typically measured in transactions per second or TPS, a key metric that defines the ability of a payment system to serve, or not, a considerable number of users.
This isn’t a new metric for payment systems - Visa, for example, a traditional payment system, can handle more than 65,000 TPS. On the other hand, Bitcoin has a TPS (transactions per second) processing power of only 4 to 7. This makes chains need to scale and improve their ability to serve more users (transactions per second).
The reality is that scaling a chain isn’t as simple as it sounds. There’s in fact one issue - called the Blockchain Scalability Trilemma.
Vitalik Buterin first coined this term to describe the three properties that a high-performing blockchain must have:
• Decentralization
• Security
• Scalability
The thesis of this trilemma is that a blockchain can only achieve two of these three goals simultaneously.
The trilemma suggests that making a blockchain highly scalable and secure might require some degree of centralization. If you want it to be highly decentralized and secure, it might struggle with scalability, as each node in the network might have, for example, to validate every transactions, which can slow down processing times and increase costs.
To solve this problem, clever developers have decided to take blockchains like Ethereum or Bitcoin and instead of trying to create a single chain that is both scalable, secure, and decentralized, they would make two chains:
Before getting too in-depth into what Layer 1 and Layer 2 blockchains are, let’s understand what we mean when we refer to the term “layer” in the context of blockchain architectures.
When we talk about blockchain layers, there are two types of layers we can refer to in the context of a blockchain architecture:
Imagine a blockchain as a cake.
Each layer from the bottom up is essential, forming the structure and functionality of the whole. The functional layers are the ingredients' mixing methods and baking to create a functional and delicious base cake (blockchain).
Let’s see what those layers are:
Blockchain architecture extends to both hardware and infrastructure. This forms the physical foundation of the blockchain, encompassing all the necessary infrastructure for executing computational work, processing transactions, and performing cryptographic calculations. This includes servers, computers, and mining equipment.
The infrastructure layer also comprises virtual machines, which function like operating systems and host smart contracts. Blockchains frequently have their native virtual machines, like the Ethereum Virtual Machine for Ethereum.
This layer stores the chain's transaction history and ledger data in a structured and immutable way. The data is organized into blocks. Each block is cryptographically linked to the one before it, forming a chain. This chain offers a secure and unchangeable record of transactions.
Although the details of transaction addition and hashing aren't the main focus, it's crucial to acknowledge the data layer's role in safeguarding integrity and privacy. This layer defines most cryptographic primitives used in the protocol–signature algorithms, such as the elliptic curve digital signature algorithm, cryptographic libraries, and public-private key pairs.
The network layer enables effective discovery and interaction among peers, called nodes.
The Network layer manages the communication protocols that connect nodes within the chain. This layer is essential to maintaining the decentralization nature of the blockchain, allowing peer-to-peer transactions.
This layer achieves agreement among its nodes on the validity of transactions. It employs several mechanisms like PoW (Proof-of-Work), PoS (Proof-of-Stake), or DPos (Delegated-Proof-of-Stake), each with its method for validating transactions and securing the networks.
Note that, for example, ETH's consensus mechanism is Gasper and not proof-of-stake. Proof-of-stake is a part of it's consensus mechanism.
The application layer is the end product of the entire system offering specific products for the users, i.e., wallet, lending, staking, etc.
This is the layer on which smart contracts and apps are built, as well as any other software that runs on the top of the chain. This layer is the interface between the blockchain and its users, making the technology accessible and usable for various purposes.
The combination of the functional layers led to the creation of a new blockchain (cake), also known as Layer 1 - which is also a layer, but very different.
As we said above, all blockchain functional layers work together to form another type of layer, the architecture layer - what we refer to when we call Layer 1, 2 and 3 blockchains
There are 4 common types of Blockchain layers:
Layer 0 Blockchain aim to exchange the interoperability between different chains and ensure the robustness of the underlying infrastructure. This includes interoperability protocols, network consensus mechanisms, and the foundational internet and hardware supporting the chain.
Layer 1 blockchains are an improvement over layer 0, the layer on which the blockchain functionality is maintained, which is known as the implementation layer and includes chains like Ethereum, Bitcoin, and Solana.
Layer 2 blockchains are meant to extend the functionality of the Layer 1, often processing transactions off the main chain (L1) and then sending the transactions as batches back to the L1 to “settle”. Layer 2 solutions have many optimizations and scalability solutions to increase performance, reduce latency, and lower gas fees. However, there are also examples of L2s that don’t process transactions and instead extend some other blockchain functionality. For example, an oracle solution (where it gets real-world data and computation) is also considered an L2.
Layer 2 solutions use a lot of different mechanisms to achieve scalability. Here are some examples of popular ones:
Layer 3 blockchains include cross-chain applications, user interface designs, and APIs, allowing easy interaction with the chain. L3 aims to abstract most of the chain's inner complexity to offer end-users and developers a simplified and integrated experience across various chains.
Before wrapping, it is important to understand that other than differences in functional layers or additional technologies implemented, blockchain architectures can vary based on the type of the blockchain, its goal, and target use cases.
When we talk about blockchain architectures is also imporant to note that Blockchains can be permissioned (limiting access) or permissionless (open to all), this distiction creates 4 types of blockchain architectures, each solving a different problem and focusing on different components of the scalability trilemma:
Public blockchains are open to everyone and do not have permission restrictions. They utilize various consensus mechanisms. However, due to the growing demands of a large user base, scalability can pose a challenge. Bitcoin and Ethereum are prime examples of public blockchains.
Private blockchains cater to enterprise needs. They are permissioned blockchains, accessible only to certain individuals, typically within business organizations. Hyperledger Fabric is a well-known private blockchain.
Public and private blockchains each have their own strengths and weaknesses. Hybrid blockchains, aim to combine the best features of both types.
Consortium Blockchains
Consortium blockchains are owned and managed collaboratively. They are formed when several private nodes come together to create a consortium blockchain.
In conclusion, it is critical for developers and users to understand how chains work, blockchain architectures, and their underlying technology, including the various functional and blockchain layers.
As we’ve seen, each blockchain layer serves a unique purpose, contributing to a blockchain system's overall functionality and success.
As the technology evolves and matures, we may see new layers and architectures emerge that further enhance its capabilities. We encourage you to keep exploring, learning, and innovating in this exciting field.
If you want to learn more about smart contract development, security, and how blockchain works, sign up on Cyfrin Updraft and get access to 70hrs+ of web3 development courses, completely for free.
Happy Coding!