Did you know that the blockchain is composed of several layers, just like a cheeseburger? A cheeseburger has a patty, sauce, buns, cheese, and lettuce. Similarly, the blockchain has the hardware, data, network, consensus, and application layers. These five different layers make up the blockchain - let's explore each one!
The first layer of the blockchain is called the hardware layer. This layer refers to the network of computers, or nodes, that help validate data and transactions on the blockchain.
Traditionally, whenever we browse the internet or use any online applications, our computers request data from a central server, such as text, images, and videos. This is what we call a client-server architecture.
The case is different for the blockchain, which uses a peer-to-peer network of nodes acting as both clients and servers, forming a distributed database. These nodes are what make up the hardware layer.
A node is a “central or connecting point at which pathways intersect.” A real-life analogy would be a central area where many people meet and exchange information, such as a mall or office.
In the blockchain, a node can be any device that participates in a blockchain network, from your computer to your mobile phone. These nodes will take in data, send them out to other nodes and work with each other verifying transactions in the network. These nodes act as the hardware/infrastructure which supports the underlying blockchain.
Next, let's look at the data Layer - where data is managed.
The data layer can be pictured as a long list of encrypted and interconnected blocks - kind of like a train. These blocks contain the data that the nodes verify in the hardware layer.
Every time new data is added to the blockchain, they are in the form of blocks, attached on top of the previous block. This repeatedly happens, constantly making the blockchain longer. This also means that every block in existence will indirectly be connected to any other block out there - cool, right?
Fun fact: The only block not linked back to another block is the genesis block, the first block in the network.
Another important function of the data Layer is the cryptography involved in the blocks. Transactions are digitally signed using asymmetric cryptography to ensure the data's security and integrity.
Asymmetric cryptography is achieved using two keys: the public key and the private key. These two keys are responsible for protecting the data stored on the blocks. Simply put, the private key is used to sign transactions, while the public key is used to verify transactions.
Check out our module on digital signatures to understand asymmetric cryptography more in-depth: https://www.bitskwela.com/en/digital-signature
The network layer is the layer that makes sure the nodes in the hardware layer can communicate with each other. This layer, also called the P2P layer, manages node detection, block generation, block addition, and is responsible for transmitting peer-to-peer transactions.
With this layer, the blockchain's integrity stays intact.
The consensus layer contains the rules in the protocol that nodes follow to validate transactions and create blocks.
In a basketball game, a referee makes sure that the players follow the rules of the game throughout. The consensus layer can be likened to a referee, but for the blockchain. All day, nodes must follow the rules of the consensus layer to participate in the blockchain network.
Because of all this, the consensus layer is often considered the most important layer out of the five.
The application layer enables people to develop blockchain-based programs and applications such as wallets, exchanges, marketplaces, and websites. The application layer can be split into two: application layer and execution layer.
Application layer
The application layer consists of software such as APIs, frameworks, and user interfaces. These enable developers to connect their applications to the blockchain.
Execution layer
On the other hand, the execution layer consists of smart contracts, chain code, and underlying protocols. These ensure the execution of instructions and commands given by the application layer.
The blockchain's application layer enables the creation of countless applications, such as exchanges without trading hours, wallets that can send crypto all over the world, or marketplaces that offer different kinds of NFTs - all powered by the blockchain underneath.
To summarize:
Hardware layer - It is made up of nodes that participate in facilitating transactions.
Data layer - This is where data is arranged and formed into blocks.
Network layer - It enables nodes to communicate with each other through inter-node communication.
Consensus layer - This is where nodes have to reach a consensus decision for each transaction’s validity.
Application layer - This layer hosts applications and programs on top of the blockchain and enables it to have different kinds of utility.
As you can see, each layer plays a big part in the overall functionality of the blockchain. Without one of them, the blockchain would not be as secure, scalable, and decentralized.
Check out the next modules to take a deeper dive into each of the five layers!