The blockchain is like onions, they each have layers. Onions have layers. The blockchain additionally has layers.
Let’s peel again the blockchain layers one after the other!
What Is a Layer 1 Blockchain?
Layer 1 is the bottom blockchain; it could validate and finalize transactions utilizing its personal community. Examples of Layer 1 blockchain tasks are Bitcoin, Ethereum, and Cardano.
Layer 1 blockchain networks have their very own native token, also called 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 attempting to steadiness decentralization, safety, and scalability. All scaling options will try to strike a steadiness between these three.
You can additionally fund a variety of supernodes (by buying supercomputers, huge servers, and many others.) to safe and scale your community. However this may make your blockchain centralized.
There are three predominant approaches to bettering a Layer 1’s scalability: block dimension, altering the consensus mechanism, and sharding.
Improve Block Measurement
If a Layer 1 community is struggling to deal with the variety of transactions required, you’ll be able to improve the block dimension. It will permit extra transactions to be processed in every block.
Nonetheless, this solely scales to this point. Bigger block sizes also can find yourself slowing transaction speeds as a result of obtain required for the block knowledge. Because of this you’ll be able to’t merely create an infinitely huge block. Tremendous-sized blocks would additionally cut back decentralization.
Consensus Mechanism Modifications
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. Because of this 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 knowledge is break up into smaller, extra simply managed shards. That is a simple manner 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 individuals.
Sharding will increase the transaction output by dividing the community into totally different shards. Because of the manner the community is split, every shard would not maintain all the data 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 pace.
What Is Layer 2?
Layer 2 protocols are constructed on high of the Layer 1 blockchain to handle Layer 1’s scalability points.
That is accomplished by making a secondary framework, which does not want the Layer 1 chain — also called “off the chain”.
Two issues that Layer 2 can enhance are transaction pace (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 instances and decrease transaction charges.
How Does It Work?
There are just a few ways in which Layer 2 can resolve Layer 1’s scalability problem.
Channels
Channels are a Layer 2 resolution that permit customers to transact a number of instances off-chain earlier than reporting it to the bottom layer.
There are two kinds of channels: state channels and fee channels. Fee channels are straight-forward; they permit funds to be handled off-chain. Then again, state channels are a bit broader; they permit any interactions that might occur on the blockchain to occur off-chain (for instance, good contracts).
A problem with this resolution is that the customers have to be identified to the community, that means, open participation shouldn’t be an choice. These customers will even need to lock up their tokens in a multisig contract.
Plasma
Created by Joseph Poon and Vitalik Buterin, Plasma makes use of good contracts and numerical timber to create “baby chains”, that are copies of the unique blockchain — also called the “father or mother chain”.
This framework pushes transactions away from the unique chain onto the kid chain, so as to enhance transaction pace and decrease transaction charges.
Nonetheless, the plasma resolution can’t be used to assist scale general-purpose good contracts. Additionally, customers have to attend a time frame earlier than with 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’ll connect with Layer 1 through the use of the identical digital machine. Because of this all contracts and transactions that can be utilized on Layer 1 will also be used on sidechains.
Rollups
The rollup resolution 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 straightforward emigrate from Layer 1 to Layer 2.
ZK rollups are quicker and extra environment friendly, however do not use a digital machine as a result of it makes it tougher to maneuver between layers.
What Are Layer 0 Protocols?
Layer 0 protocols permit cross-chain interoperability between Layer 1 tasks. This can be 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’ll use totally different consensus mechanisms, block parameters, and many others.
Usually, 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 akin to Tendermint, Cosmos SDK, and IBC to assist builders simply create their very own blockchains that may talk with one another. Their goal is to create the “Web of Blockchain”.
Initiatives like Binance, Crypto.com, and Polygon have 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 also known as the “software layer”.
The “software layer” offers info to Layer 1 for it to course of (e.g. good contracts). With out functions, Layer 1 protocols could be pretty boring. Layer 3 is what provides the bottom blockchain perform exterior of simply transactions.
Most Layer 1 blockchains help you simply construct Layer 3 tasks instantly onto their community, however this is not doable with Bitcoin. Some forks of Bitcoin are attempting to convey dApps to the community, however we’re but to see a real Layer 3 undertaking on the bottom Bitcoin community.
Bitcoin is perhaps lacking out, as blockchains like Ethereum, Solana, and Cardano have flourishing Layer 3 ecosystems that enrich their blockchain.
Usually, these tasks have cross-chain performance, akin to Uniswap, which permits customers to commerce belongings throughout totally different blockchains.
It could be vital to notice that every blockchain makes use of a unique programming language. Because of this 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 beneath real-world functions exterior of simply transactions. Now, you’ll be able to 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 also known as the 4 layers of blockchain, however it is because we begin counting from 0 within the programming world.
Conclusion
The blockchain has a whole lot of layers and so they’re all pretty vital. Let’s shortly 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 resolution 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 staff 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.