What is Blockchain Layer 0, 1, 2, 3 Explained | Layers of Blockchain Architecture



welcome to whiteboard programming, where we
simplify programming with easy to understand whiteboard videos and today, i'll share with you
how does different layers in blockchain technology work and what does the so called terms of layer
0, layer 1, layer 2 and layer 3 mean in the crypto world. so, lets get started! now, as we all know
that the blockchain technology is an amalgamation of various technologies coming together under one
roof to help the system run smoothly. to name a few of them, it includes mathematical computation,
cryptography, game theory, peer-to-peer systems, and validation protocols, which essentially
join forces to power blockchain operations. further, since blockchains eliminate the presence
of a central governing authority, all transactions must be robustly protected, and data must
be stored securely on a distributed ledger. and for this, blockchains have a
layered architecture due to which they are able to facilitate a unique
way of authenticating transactions. in the architecture, there are five
layers involved, each with its distinct functionality. now that we know the importance of
these layers of blockchain technology, let us dive right in and understand the architecture
and what each layer does. starting with, 1. hardware infrastructure layer to understand
this layer, we must understand that the blockchain data lies securely stored in a data server and
when we browse the web or use any blockchain apps, our machines request access to
this data from the server.
Here, the framework that facilitates this data exchange
is known as the client-server architecture. as we know that blockchains are peer-to-peer (or
p2p) networks that allow clients to connect with ‘peer-clients’ to make data sharing faster
and easier. it is nothing but a vast network of devices communicating with each other and
requesting data from one another. and this is exactly how a distributed ledger gets created and
here each device communicating with another device on the network is a node and also, each node here,
randomly verifies the transactional data as well. 2.
Data layer so, as we all know that the
blockchains are nothing but a long chain of ‘blocks’ containing transaction data. when the
nodes validate a certain number of transactions, the data is bundled into a ‘block,’ added
to the blockchain, and linked with the previous block of data. here, the ‘genesis
block’ is the first block in the chain and therefore does not need to be linked with any
of the previous blocks. instead, the subsequent block is linked with the genesis block, and the
process is repeated every time a new block is added. and this is how a blockchain is formed
and continuously grows progressively. further, here, every transaction is ‘digitally signed’
with the private key of the sender’s wallet and only the sender has access to this key, thus
ensuring that the data can neither be accessed nor be tampered with by anybody else. this is what
we call as ‘finality’ in blockchain terminology. this digital signature also protects the owner’s
identity, which is itself encrypted, thus ensuring maximum security and anonymity in the network.
next, 3. network layer now, as we all know that the p2p framework of blockchain enables
various nodes to exchange transaction data, to arrive at a consensus about the validity of a
transaction.
This means that every node must be able to discover other nodes on the network for
fast communication. and it is the network layer that facilitates this ‘inter-node communication’.
and as node discovery, block creation, and block addition are also managed by this layer, it is
also referred to as the ‘propagation layer.’ next, 4. consensus layer this is the most critical
layer in blockchain operations. because this layer is responsible for validating transactions,
and without it, the entire system will fail. this layer runs the protocol that requires a
certain number of nodes to verify one transaction. and therefore, every transaction is processed by
multiple nodes that must then arrive at the same result and agree on its validity.
Further, this
framework maintains the blockchain’s decentralized nature so as by ensuring that no node has
sole control over any transactional data, and the role is distributed. this is
what we call as the consensus mechanism. with so many nodes processing
transactions, bundling them up, and adding them to the blockchain, multiple
blocks may get created simultaneously, resulting in a branch in the blockchain. however, there
must always be a single chain block addition, and it is the consensus layer that also
ensures, that this conflict is resolved. next 5. application layer this is the layer
on which smart contracts and decentralized applications (or dapps) run. smart contracts
make decisions based on certain triggers such as contract expiration
dates, achievement of spot prices, etc.
The actions that follow these decisions are
executed by dapps. and all of this happens on the application layer. if you want to learn what
are smart contracts and what are dapps in detail, i'll recommend you to watch the following videos,
link for each is given in description below back to our video, do note that dapps also
facilitate the communication between user devices and the blockchain. therefore, the
application is like the user-facing front end, while the main blockchain is the backend,
where the data remains securely stored. so, in all, as a summary, you can state that these are the 5 layers of a blockchain
that help it function smoothly. and now that you are aware of the blockhain layer
architecturture, you might have heard of the terms like layer 0, layer 1, layer 2 and layer
3…
Lets look into these terms individually, and what do they mean first one being, what is
layer 0 this layer consists of the hardware and equipments that are required to run the network
and the consensus mechanisms without any glitch. it also includes the internet connection which
is used for blockchain network's communication. next, what is layer 1 well, this layer governs
the protocols that ensure security across the blockchain network. layer 1 includes the
consensus mechanism, coding language, and all the rules embedded in the code
for the operations of the blockchain. therefore, sometimes this is also called as the
‘implementation layer.’ and do note that when users mention the bitcoin blockchain, they are
referring to this layer. next, what is layer 2 so, we do realise that to improve the throughput of
blockchains, processing power must be added. but doing so means the addition of more nodes, and
this clogs the network. however, as mentioned earlier, the addition of nodes is critical
for maintaining the decentralized nature of a blockchain. this means that if either scalability,
decentralization, or security are tinkered with, they will affect each other on layer 1. this is
called the ‘classic blockchain trilemma.’ wherein, by blockchain's scalability, we refer to its
ability to handle a higher volume of transactions. by security, we refer to its ability to secure
data on the blockchain from various types of assaults and the blockchain's defense against
double-spending.
And by decentralization, we mean it as a type of network redundancy that ensures
that the network is not controlled by fewer entities. hence, if seen practically, layer 1
cannot be scaled without moving all the processing to a separate layer built atop the first layer,
i.e., layer 2. this is made possible by enabling the integration of third-party solutions with
layer 1. the result of layer 2 is nothing but a new network that handles all the transaction
authentication and decongests layer 1. therefore, layer 1 only handles the creation and addition
of blocks to the blockchain and the new layer-2 network sits over the layer 1 network
and continuously communicates with it. the lightning network is an example of a layer
2 blockchain sitting on the bitcoin blockchain. next, what is layer 3:
here, we have smart contracts and dapps that only handle decision making and
execution of follow-up actions.
Since the maximum functionality of the blockchain is derived from
the innovation of dapps, this is the layer that interfaces between the real-world applications and
the underlying layers that facilitate everything. lastly, as a conclusion, i'd like to say
that in the case of blockchain architecture's distributed network, each network participant
maintains, authorizes, and updates new entries. hence, a collection of blocks with
transactions in a specific order represents the structure of blockchain technology and
while these can be saved as a flat file (, i.e., somewhat of a txt file), it can also
take the shape of a simple database. and do remember that blockchain architecture can
take public, private or consortium forms as well, if needed.
With that, I hope this video was
helpful to you and served value, if you love my content, feel free to smash that like button and
if you haven't already subscribed to my channel, please do as it keeps me motivated and helps
me create more content like this for you..