Blockchains are increasingly expanding out from a single technology layer (individual sovereign blockchains) to offer more throughput, faster transactions, and new functionality through layers (blockchains and other tech solutions built on top of other blockchains). “Layer 2” solutions for Bitcoin, Ethereum, and other blockchains are just the start of a tech stack that can take blockchains from niche to widespread adoption.
The Trilemma of Blockchain Architecture
Why do you need layers to solve scalability in the first place? Blockchains suffer from what is often described as a trilemma—you can only have two of the following three properties in a given blockchain:
- Security: The blockchain is robust against attacks and can defend against potential threats, maintaining the integrity and safety of its data and users.
- Decentralization: Authority and decision-making are spread out across a network, and there is no central controlling entity.
- Scalability: The blockchain can handle a large number of transactions per second (TPS) and scale as the network grows.
For example, you can have a secure, decentralized blockchain (like Bitcoin), but it can’t scale. You can have a scalable, decentralized blockchain, but it lacks security (Polygon). You can have a secure and scalable blockchain, but it won’t be decentralized (Solana).
The problem for blockchains is that scaling is a necessity for mainstream adoption, but security and decentralization are the intrinsic properties of blockchains. If there is a choice between sacrificing security and decentralization in order to reach millions of users, most people are going to choose to do away with decentralization.
After all, if the system is insecure and can be hacked, no one is going to put money in it. But if you get rid of decentralization, why have a blockchain at all? Scalable, secure, centralized services already exist: that’s the internet as we know it today.
Finding an answer to this trilemma is imperative for blockchains’ future. And it turns out, we can look to Web2 for that answer.
What Blockchain Layers Are and Why They Matter
The answer to the blockchain trilemma lies in spreading functionality across different tech layers, enhancing the capabilities of the overall stack. With a layered solution, the foundational blockchain can stay decentralized and secure, and then scalable functionality can be built on top.
This concept is similar to how Web2 works today, where most apps people use operate at layer 7 of the stack:
This is the OSI (open systems interconnection) model of the network stack. Over time this stack has been built to abstract away the complexity of networking. With the OSI model, it’s possible to watch Netflix without having to worry about bits or data formats or TCP or ports.
The layers here aren’t exactly analogous to the layers of the blockchain, but that’s not the point. Rather, layering is a necessity to allow the majority of people to take advantage of important technologies, like the internet or blockchain. It allows for scale and better usability.
Just as we don't need to understand the intricacies of TCP/IP protocols to browse the internet or stream a movie, most blockchain users won't need to engage with the base layer directly. They will interact with user-friendly applications built on higher layers that hide the underlying complexity. It's through these layers, much like the evolution of the internet, that blockchain technology will be able to reach widespread adoption.
Structural Advantages of Layers
If you step back and think about what a blockchain needs to do, it has to serve a few functions:
- Decentralization: the network needs to have a set of nodes that can validate transactions.
- Security: transactions and user funds need to be safe and secure.
- Compute: the blockchain needs to be able to process more complex logic (smart contracts) and support applications.
- Data availability: blockchain data needs to be readily available.
Today, many blockchains try to serve all of these functions, a situation which leads to the trilemma. By leveraging layers, not only do you solve the blockchain trilemma, but you can optimize and specialize the various layers of the stack.
For example, you can separate compute and data availability into distinct layers, which in turn lets you maximize decentralization and security at the base layer (traits that you want in a foundation). Then your compute and data availability can be optimized for better performance and better network security (since they no longer have to also be designed for decentralization and security as they inherit those traits from that base layer).
This is how Bitcoin and Stacks are related. Bitcoin is a secure and decentralized base layer, and Stacks is a Bitcoin layer that provides compute: it is a smart contract layer for Bitcoin. By specializing function and making the attack surface of each layer small, you can increase the security of the overall stack while achieving the desired scalability and functionality needed for mass adoption.
The State of Blockchain Layers Today
Web2 has seven layers. In Web3, layers are still emerging: 2 layers are becoming common, but the space is still evolving and more layers more evolve in the future.
Settlement Layer: The Blockchain Base
Layer 1 (often referred to as a "settlement layer" a “base layer”, or an “L1”) forms the bedrock of any blockchain system. This is the underlying blockchain where all transactions of higher layers are eventually recorded and finalized.
Layer 1s have consensus mechanisms that enable decentralized decision making that anybody can participate in actively or verify more passively. The consensus mechanism adopted by a particular L1 (e.g. Proof of Work in Bitcoin or Proof of Stake in Ethereum) influences where that chain then falls on the spectrum of the blockchain trilemma.
As the foundation of Web3, Layer 1 blockchains carry a crucial responsibility. Ideally, this layer should maximize decentralizaiton and security, embodying the core tenets of blockchain technology. It should offer a trustless, permissionless environment that enables anyone to participate—either by maintaining or verifying the network—rendering all transactions transparent and immutable.
Then you can build more scalable layers on top, and those layers can be more centralized or less secure because the transactions will ultimately settle on the more secure and decentralized L1. Intuitively, you want decentralization at this settlement layer foundation, so anyone can build and experiment on top. You lose the benefits of decentralization if a decentralized layer is built on a centralized foundation.
This approach, exemplified by blockchains like Bitcoin and Ethereum, aims to create the most durable and trustless base layer possible, leaving scalability enhancements and more centralized services to Layer 2 and above as opt-in networks.
Application Layer: Off-chain Interactions
Layer 2 blockchain solutions are protocols that leverage the security and decentralization of Layer 1 by periodically settling batches of Layer 2 transactions back on the Layer 1. This approach helps to alleviate the scalability issues that many blockchains encounter.
By moving the bulk of transactions off the main chain, Layer 2 solutions dramatically increase the number of transactions that can be handled in a given ecosystem, reducing both transaction costs and the time to complete a transaction significantly. They also have the potential to support advanced features like micropayments or smart contracts.
The primary principle behind Layer 2 solutions is to increase speed and scalability while relying on Layer 1 to maintain the decentralized and secure features of a blockchain. This is how they help with the blockchain trilemma–by breaking up decentralization (L1), security (L1), and scalability (L2) across the stack.
There are a number of popular L2s on the market today, including (but not limited to):
- Lightning Network: A second layer payment protocol that operates on top of Bitcoin's blockchain, enabling faster and cheaper transactions by creating off-chain payment channels.
- Stacks: a Bitcoin layer that enables smart contracts for the Bitcoin ecosystem, unlocking Bitcoin apps and Bitcoin DeFi.
- Polygon: A multi-chain layer for Ethereum that creates a decentralized platform of interconnected chains capable of scaling and new functionality.
- Arbitrum: An Ethereum Layer 2 chain using rollup technology to make smart contracts scalable, fast, and secure with lower costs than on Ethereum's main chain.
Some blockchain ecosystems, like Polkadot and Cosmos, have taken this multi-layer design approach from the very beginning:
- Polkadot: Polkadot consists of many parachains (L2s) that offer different functionalities and designs, all connected to a central Relay Chain (L1). The Relay Chain provides the network's shared security, consensus, and cross-chain interoperability.
- Cosmos: Similarly, Cosmos aims to create an “internet of Blockchains” through open-source tools like the Tendermint consensus engine and the Inter-Blockchain Communication (IBC) protocol. These tools enable developers to spin up and launch app-specific blockchains (L2s) with ease that all connect back to the Cosmos Hub (L1).
How Developers Can Effectively Leverage Blockchain Layers
Every layer that is built on top of blockchain can become a huge opportunity for developers. If we go back to that OSI model of networking, think about all the opportunities at each level, from hardware to software. Every layer allows more to be built on top.
The same goes for blockchain layers. The opportunity for building on L1s is large, but the use cases are limited: Bitcoin doesn’t have smart contracts, Ethereum is already clogged by network congestion, etc. But with L2 solutions such as Stacks and Polygon, a whole new world is opened for both ecosystems. Here are a few benefits from building on blockchain layers:
- Enhanced Scalability: The main benefit of layer 2 solutions is they dramatically increase a blockchain application's transaction capacity. This is beneficial for all apps, and particularly so for those that require high speed for high volumes of transactions, such as DeFi protocols and payments systems.
- Lower Costs: By moving transactions off the L1 chain, Layer 2 solutions can reduce the cost per transaction. This is critical when congested L1 networks have high fees (that will only get higher with more adoption), making many smaller transactions illogical. You’re not going to send a $10 payment when you have to pay a $10 transaction fee.
- Interactivity and Responsiveness: Layer 2 solutions can provide faster confirmation times, improving the user experience. This can be crucial for applications that require interactive time-sensitive user engagement, such as games or online marketplaces.
- Rich Functionality: Some Layer 2 solutions offer enhanced functionality, like smart contract capability or more complex transaction types. Developers can use these features to build more robust and powerful applications.
- Privacy: Certain Layer 2 solutions, like zkRollups, provide enhanced privacy features, useful for apps where user confidentiality is key.
The Future of Blockchain Architecture: Layers and Beyond
We’re only at the beginning of layering in blockchain technology. A lot of research is still being done at the settlement layer, so that the base layer can have better scaling and support more complex use cases.
For example, Ethereum has shifted to Ethereum 2.0 with a new Proof of Stake consensus mechanism, and more research into sharding is being done. Bitcoin has gone through a number of upgrades over the years, including SegWit and Taproot. NEAR has a number of network upgrades planned in the coming years. The list goes on. No L1 has ossified yet: incremental improvements are still happening.
Alongside that L1 work, L2 development is underway. Stacks is preparing for the Nakamoto Release. Polygon, one of the leading Ethereum L2’s, has announced a major upgrade, and many of these L2s are experimenting with cutting-edge research, such as zero-knowledge proofs, to improve privacy in Web3.
Work is also being done to explore L3 and beyond. At Hiro, we developed subnets, a scaling solution for Stacks, and prepared them for mainnet. Subnets are blockchain networks that exist on top of Stacks (an L2) and allow users to opt-in to various subnets (L3s) with different consensus mechanisms and use cases.
The one thing we are sure of is that blockchain layers will continue to be built and mature. This is especially true for Bitcoin. Bitcoin has a market cap of about $402 billion, but only ~$170M is locked in Bitcoin-native apps. Most of Bitcoin’s capital is sitting there, waiting to be put to use through new layers and applications.
Embracing Layered Design in Blockchain Development
The complexity of scalability and the demand for greater blockchain performance are unlikely to dissipate anytime soon. As the world realizes the transformative potential of these technologies, layer solutions are surfacing as the logical answer to these challenges.
Layer 2 solutions uphold the ethos of decentralization and security, while simultaneously unlocking new realms of performance and functionality. Their growth trajectory not only holds the promise of broader adoption, but also serves as a testament to the evolutionary power of technology.
Feeling inspired after learning about blockchain layers? Read our free book on Web3 app development to kickstart your Web3 journey: