The blockchain is like onions, they each have layers. Onions have layers. The blockchain additionally has layers.
Let’s peel again the blockchain layers separately!
What Is a Layer 1 Blockchain?
Layer 1 is the bottom blockchain; it may validate and finalize transactions utilizing its personal community. Examples of Layer 1 blockchain initiatives are Bitcoin, Ethereum, and Cardano.
Layer 1 blockchain networks have their very own native token, also referred to as a coin, which is used to pay transaction charges.
Scaling With Layer 1
Layer 1 networks have points with scaling. When the blockchain struggles to course of the variety of transactions the community is requiring, the transaction charges improve.
When addressing scaling, you’re confronted with the Blockchain Trilemma, a time period coined by Vitalik Buterin. That is the place you are making an attempt to steadiness decentralization, safety, and scalability. All scaling options will try to strike a steadiness between these three.
You could possibly additionally fund a lot of supernodes (by buying supercomputers, huge servers, and many others.) to safe and scale your community. However this could make your blockchain centralized.
There are three major approaches to bettering a Layer 1’s scalability: block dimension, altering the consensus mechanism, and sharding.
Enhance Block Measurement
If a Layer 1 community is struggling to deal with the variety of transactions required, you possibly can improve the block dimension. It will permit extra transactions to be processed in every block.
Nevertheless, this solely scales thus far. Bigger block sizes also can find yourself slowing transaction speeds as a result of obtain required for the block information. This is the reason you possibly can’t merely create an infinitely huge block. Tremendous-sized blocks would additionally scale back decentralization.
Consensus Mechanism Adjustments
Some consensus mechanisms are much less scalable than others.
For instance, the proof-of-work consensus mechanism is much less sustainable and scalable than proof-of-stake. This is the reason Ethereum is slowly transitioning away from the previous to the latter.
We have beforehand lined consensus mechanisms in additional element here.
Sharding
Put merely, Sharding is the place a set of information is cut up into smaller, extra simply managed shards. That is a simple means to assist unfold the load. Take into consideration consuming a cake, it is a lot simpler to eat it as soon as it is reduce into slices and handed out to different folks.
Sharding will increase the transaction output by dividing the community into totally different shards. Because of the means the community is split, every shard does not maintain all the knowledge from the blockchain. As soon as a node is completed with its shard, it broadcasts it to the blockchain, the place it’s then validated.
This helps unfold the workload and, in flip, will increase the transaction velocity.
What Is Layer 2?
Layer 2 protocols are constructed on prime of the Layer 1 blockchain to deal with Layer 1’s scalability points.
That is achieved by making a secondary framework, which does not want the Layer 1 chain — also referred to as “off the chain”.
Two issues that Layer 2 can enhance are transaction velocity (how lengthy one transaction takes), and transaction throughput (what number of transactions the community can course of in an outlined time interval).
When the Layer 1 community turns into congested, Layer 2 can decide up the slack to enhance transaction occasions and decrease transaction charges.
How Does It Work?
There are a couple of ways in which Layer 2 can remedy Layer 1’s scalability problem.
Channels
Channels are a Layer 2 answer that permit customers to transact a number of occasions off-chain earlier than reporting it to the bottom layer.
There are two kinds of channels: state channels and cost channels. Fee channels are straight-forward; they permit funds to be handled off-chain. However, state channels are a bit broader; they permit any interactions that would occur on the blockchain to occur off-chain (for instance, good contracts).
A difficulty with this answer is that the customers have to be identified to the community, which means, open participation is just not an choice. These customers will even should lock up their tokens in a multisig contract.
Plasma
Created by Joseph Poon and Vitalik Buterin, Plasma makes use of good contracts and numerical bushes to create “youngster chains”, that are copies of the unique blockchain — also referred to as the “father or mother chain”.
This framework pushes transactions away from the unique chain onto the kid chain, so as to enhance transaction velocity and decrease transaction charges.
Nevertheless, the plasma answer can’t be used to assist scale general-purpose good contracts. Additionally, customers have to attend a time period earlier than having the ability to pull their cash from Layer 2.
Sidechains
Sidechains have their very own impartial blockchains that use their very own consensus mechanisms and block necessities. They will connect with Layer 1 through the use of the identical digital machine. Which means all contracts and transactions that can be utilized on Layer 1 can be used on sidechains.
Rollups
The rollup answer teams collectively (or rolls up) sidechain transactions right into a single transaction to generate cryptographic proofs known as a SNARK (succinct non-interactive argument of information). As soon as the SNARK has been generated, it’s broadcasted to the bottom layer.
There are two kinds of rollups: ZK rollups and optimistic rollups.
Optimistic rollups make the most of a digital machine which makes it simple emigrate from Layer 1 to Layer 2.
ZK rollups are sooner and extra environment friendly, however do not use a digital machine as a result of it makes it more durable to maneuver between layers.
What Are Layer 0 Protocols?
Layer 0 protocols permit cross-chain interoperability between Layer 1 initiatives. It is a main problem with Layer 1; when you’re within the ecosystem, it is fairly onerous to maneuver to a different — Layer 0 fixes that.
Not all blockchains constructed on the identical Layer 0 could have the identical design. They will use totally different consensus mechanisms, block parameters, and many others.
Typically, Layer 0 tokens act as an anti-spam filter, requiring you to stake the Layer 0’s token to entry their ecosystem.
Layer 0 Instance
Cosmos is probably the most well-known instance of a Layer 0 protocol.
They supply open-source instruments reminiscent of Tendermint, Cosmos SDK, and IBC to assist builders simply create their very own blockchains that may talk with one another. Their intention is to create the “Web of Blockchain”.
Initiatives like Binance, Crypto.com, and Polygon had been created utilizing Cosmos.
Does Layer 3 Exist?
Sure!
Layer 3 is the protocol(s) that allows blockchain-based functions like dApps, video games, storage, and many others. Layer 3 is sometimes called the “software layer”.
The “software layer” supplies data to Layer 1 for it to course of (e.g. good contracts). With out functions, Layer 1 protocols can be pretty boring. Layer 3 is what provides the bottom blockchain perform exterior of simply transactions.
Most Layer 1 blockchains will let you simply construct Layer 3 initiatives immediately onto their community, however this is not doable with Bitcoin. Some forks of Bitcoin try to carry dApps to the community, however we’re but to see a real Layer 3 mission on the bottom Bitcoin community.
Bitcoin could be lacking out, as blockchains like Ethereum, Solana, and Cardano have flourishing Layer 3 ecosystems that enrich their blockchain.
Typically, these initiatives have cross-chain performance, reminiscent of Uniswap, which permits customers to commerce property throughout totally different blockchains.
It might be necessary to notice that every blockchain makes use of a unique programming language. Which means Layer 3 functions that present cross-chain functionalities have to be multilingual. For instance, translating from Solidity for Ethereum to Haskell for Cardano.
Layer 3 provides the layers under real-world functions exterior of simply transactions. Now, you possibly can create NFTs, swap your tokens, play video games, and a lot extra. The applying layer unlocks the blockchain’s full potential.
Does Layer 4 Exist?
No. The layers we have mentioned are sometimes called the 4 layers of blockchain, however it is because we begin counting from 0 within the programming world.
Conclusion
The blockchain has a variety of layers and so they’re all pretty necessary. Let’s rapidly recap all of them:
-
Layer 1: The bottom blockchain community. They validate and finalize transactions however have points with scaling (e.g. Bitcoin).
-
Layer 2: A scaling answer to Layer 1 protocols. It creates a secondary framework which is used for transactions “off chain” (e.g. Bitcoin Lightning Community).
-
Layer 3: Permits blockchain-based dApps, video games, and extra. Also referred to as the applying layer (e.g. Uniswap).
-
Layer 0: Permits cross-chain interoperability between Layer 1 protocols (e.g. Cosmos).
This text is part of the Hashnode Web3 blog, the place a crew of curated writers are bringing out new sources that will help you uncover the universe of web3. Examine us out for extra on NFTs, DAOs, blockchains, and the decentralized future.