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 by one!
What Is a Layer 1 Blockchain?
Layer 1 is the bottom blockchain; it may well 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 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 making an attempt to stability decentralization, safety, and scalability. All scaling options will try to strike a stability between these three.
You possibly can additionally fund quite a lot of supernodes (by buying supercomputers, huge servers, and many others.) to safe and scale your community. However this might make your blockchain centralized.
There are three primary approaches to bettering a Layer 1’s scalability: block dimension, altering the consensus mechanism, and sharding.
Improve Block Dimension
If a Layer 1 community is struggling to deal with the variety of transactions required, you may improve the block dimension. This can permit extra transactions to be processed in every block.
Nevertheless, this solely scales thus far. Bigger block sizes can even find yourself slowing transaction speeds because of the obtain required for the block knowledge. Because of this you may’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.
Put merely, Sharding is the place a set of knowledge is cut up into smaller, extra simply managed shards. That is a straightforward approach to assist unfold the load. Take into consideration consuming a cake, it is a lot simpler to eat it as soon as it is lower 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 approach the community is split, every shard does 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 prime of the Layer 1 blockchain to handle Layer 1’s scalability points.
That is finished 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 remedy Layer 1’s scalability situation.
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 varieties of channels: state channels and fee channels. Fee channels are straight-forward; they permit funds to be handled off-chain. Alternatively, 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 difficulty with this resolution is that the customers should be identified to the community, that means, open participation just isn’t an possibility. These customers may even should lock up their tokens in a multisig contract.
Created by Joseph Poon and Vitalik Buterin, Plasma makes use of good contracts and numerical timber to create “youngster 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, in an effort to enhance transaction pace and decrease transaction charges.
Nevertheless, the plasma resolution can’t be used to assist scale general-purpose good contracts. Additionally, customers have to attend a time period earlier than with the ability to pull their cash from Layer 2.
Sidechains have their very own unbiased blockchains that use their very own consensus mechanisms and block necessities. They’ll hook up with Layer 1 through the use of the identical digital machine. Which means that all contracts and transactions that can be utilized on Layer 1 will also be used on sidechains.
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 varieties 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 sooner 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 initiatives. This can be a main situation with Layer 1; when you’re within the ecosystem, it is fairly arduous to maneuver to a different — Layer 0 fixes that.
Not all blockchains constructed on the identical Layer 0 can have the identical design. They’ll 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 corresponding to 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 have been created utilizing Cosmos.
Does Layer 3 Exist?
Layer 3 is the protocol(s) that permits blockchain-based purposes like dApps, video games, storage, and many others. Layer 3 is also known as the “utility layer”.
The “utility layer” gives info to Layer 1 for it to course of (e.g. good contracts). With out purposes, Layer 1 protocols can 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 initiatives straight onto their community, however this is not doable with Bitcoin. Some forks of Bitcoin try to deliver dApps to the community, however we’re but to see a real Layer 3 mission on the bottom Bitcoin community.
Bitcoin is likely to 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, corresponding to Uniswap, which permits customers to commerce property throughout totally different blockchains.
It might be vital to notice that every blockchain makes use of a special programming language. Which means that Layer 3 purposes that present cross-chain functionalities should be multilingual. For instance, translating from Solidity for Ethereum to Haskell for Cardano.
Layer 3 provides the layers beneath real-world purposes exterior of simply transactions. Now, you may create NFTs, swap your tokens, play video games, and a lot extra. The appliance 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.
The blockchain has plenty of layers and so they’re all pretty vital. 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 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 called the appliance 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 group of curated writers are bringing out new assets that can assist you uncover the universe of web3. Test us out for extra on NFTs, DAOs, blockchains, and the decentralized future.