A blockchain can have tens, hundreds, thousands, or millions of miners participating in the network. With all that, these miners need the network layer to communicate with one another. Cue the network layer.
The network layer handles node detection, block generation, and block addition - basically, this layer handles adding blocks onto the blockchain. But more importantly, it is also responsible for inter-node communication. Inter-node communication is the different methods by which nodes can talk to each other.
Let's explore the different methods of inter-node communication.
One of the main ways nodes communicate through the network layer is through Peer-to-Peer (P2P) communication, which was discussed earlier in our hardware layer section.
Traditionally, most networks require a central server to handle messages between computers, but in a P2P system, all other computers help relay the messages in the network.
Take the illustration above as an example. On the left, you have your traditional client-server system, where you have a central entity governing every message. On the right, you have a P2P system with no central entity governing messages. Here, all the participating computers assist in relaying messages from one computer to another.
Another method of inter-node communication would be through sharding which we will discuss more in depth later.
In most blockchains currently, each node must process/store all transactions in the network. Though this makes the system secure, it considerably slows down transaction speed (scalability) due to the amount of data being processed. This where sharding can help by spreading out the workload so that each node does not need to handle all the transaction volume.
Sharding splits large transaction sets into smaller sets, also known as shards. These shards make the blockchain faster since they are processed in parallel by different nodes thus reducing the amount of data that would clog the blockchain.
Furthermore, inter-node communication can also be done through the Directed Acyclic Graph (DAG). DAGs, however, are not blockchains and act more like a competitor since it does some key functions differently.
Similar to blockchains, DAGs use a distributed ledger technology and a network of nodes to confirm transactions. What separates them both is the method by which their transactions are confirmed.
Recall that blockchains validate transactions through bundling them into blocks and having them approved by miners. This method isn’t very scalable as a huge amount of network activity will take the miners a long time to agree on the validity of each block. DAGs are able to bypass this issue entirely since they do not use miners but use 2 previous transactions to validate succeeding ones. This removes the need for human intervention and makes transactions go through quickly.
Since there are no miners, DAGs also do not have to reward miners which reduces transaction costs. They also remove the need for mining equipment and thus use significantly less energy. We will cover more about DAGs in a later module.
There are also other methods of inter-node communication like hashgraphs. Hashgraphs use a “gossip protocol” wherein data sent to one node is randomly sent to another until all nodes get the data. Similar to DAGs, Hashgraphs also don’t use blockchain technology.
All these ensure that communication occurs properly within the blockchain! Next, let’s take a look at the different ways the transactions in the network layer are validated.