What are peer-to-peer (P2P) networks?
A peer-to-peer (P2P) network is based on the concept of decentralisation, which allows the participants to conduct transactions without needing a central server. The peers or nodes (usually a computer) communicate with each other on the network freely without an intermediary. Unlike the traditional client-server model, where the client makes a request, and the server completes the request, the P2P network model allows the nodes to function as both the client and the server, giving them equal power and making them perform the same tasks in a network. Blockchain is a P2P network that acts as a decentralised ledger for digital assets.
How do peer-to-peer (P2P) networks work?
As we know, a P2P network has no central server overlooking them; the users or nodes are responsible for maintaining the network. Every node participating in the network acts as a server that can upload, download, and share files with other nodes. The nodes use their hard drives instead of a central server to store this data. As these capabilities to transmit, receive and store files lie with each node, the P2P network is more secure, fast and efficient.
It is important to note that to make peer nodes easily locatable to new peers that join the network, the P2P architecture must have many active nodes in the blockchain network, as this is when it functions best. If many nodes leave the network, it is necessary to ensure enough are left to pick up the slack.
Types of peer-to-peer (P2P) networks
The network is categorised into three types of P2P networks based on their architectural differences.
- Structured peer-to-peer networks
In this network, an organised structure is used in which the nodes interact, making it possible for the nodes to easily search for files even if the data is unavailable. Due to this organised structure, some amount of centralisation exists in this type of network. Despite providing easy access to data, a structured P2P network is more challenging and costly to set up.
- Unstructured peer-to-peer networks
In this type of network, there is no set structure for the nodes to follow. Participants can join or leave the network as and when they desire. This lack of a definite structure leads participants to communicate randomly with each other. This network is easy to build, but it requires high CPU power as all nodes must remain active to process a high number of transactions. Memory usage is also increased as search queries are sent to the whole network. An unstructured peer-to-peer network is best applicable for high churn activity, such as for a social platform.
- Hybrid peer-to-peer networks
A hybrid P2P network is a combination of a peer-to-peer and client-server model. The network has a central server that stores information on the location of resources and uses this server to conduct searches. In comparison to the structured and unstructured P2P network, a hybrid P2P network has better performance. It provides centralisation, which is required for specific queries while providing the benefits of a decentralised network.
Role of Peer-to-peer (P2P) in Blockchain
P2P networking architecture is a fundamental element in blockchain technology, as it allows cryptocurrencies (e.g. Bitcoin network) to be transferred globally without any intermediary, middleman or central server. The creator of Bitcoin, Satoshi Nakamoto, referred to it as a “peer-to-peer electronic cash system” which was created with the aim of having a P2P digital form of money.
Blockchain leverages the P2P network technology to provide a decentralised ledger for one or more digital assets. In this decentralised P2P network, all the nodes or computers are connected to one another in some way. A complete copy of the ledger is maintained by each node and is compared to other nodes to ensure the accuracy of data. This is the opposite of a bank, where transactions are privately stored and can only be managed by the bank.
Benefits of P2P networks
- Low cost
In a P2P network, every node acts as a server, and there is no central server. This saves the cost of buying an expensive server, making it a cost-effective network.
Bottlenecks faced in a centralised server model, when the number of clients increases, are eliminated in a P2P network as each node can be a server. The P2P network is designed to be scalable, as an increase in the number of clients results in an equal increase in the number of servers.
Compared to centralised networks, a P2P network is more resilient to failure as the loss of a single node does not bring down the entire network.
Drawbacks of P2P networks
- Slow performance
Every node or computer in the P2P network is accessed by other nodes, slowing down the user’s performance.
- Data is vulnerable
The absence of a central server sometimes makes this network hard to manage, as controlling or monitoring illegal or prohibited activity is difficult. No central authority manages operations, so data becomes vulnerable to malware attacks.
- High computational power
A huge amount of computing power is required for P2P networks since each node acts as both the client and the server.
Peer-to-peer architecture is going to be around for a long time. Its reliable decentralised framework has made it a popular technology for several applications and services, such as online marketplaces, file-sharing applications and open-source software. One of its significant uses is in blockchain technologies in the form of cryptocurrencies and other blockchain solutions. It allows blockchains to offer immutability, more security, decentralisation and freedom.
Gaining more knowledge in the blockchain space and understanding its peer-to-peer network application is essential for building a future in this digitally transformed world.
More contents to be discovered…
If you are interested in discovering how blockchain is implemented in the industry, these are some of the best resources that can help you out!