Understanding P2P (peer-to-peer) communication that supports blockchain networks
15.12.2021 • Просмотров:

Understanding P2P (peer-to-peer) communication that supports blockchain networks

By Decimal

There are three main elements that make up the blockchain: P2P communication, cryptography and consensus algorithms. Understanding Bitcoin is also understanding blockchain, so here we will try to understand how each element works and what it means by conceptually creating Bitcoin in your imagination and trying to launch it.

Let’s say our goal is to create a digital currency system that does not require trust and is guaranteed to be secure. “Without trust” means that you don’t need to trust a specific person (or something) to use it. In other words, no matter how bad someone is in the system, other users can use it without problems.

For example, consider the everyday exchange of money. If you give money to a friend in cash, the operation goes without problems. Even if your friend does not trust you, the transaction will still take place, because cash has an undeniable value as cash. This transaction can be described as unreliable.

The above transaction can take place only when both parties are in close proximity to each other. If you and your friend are far away from each other, how will you transfer the money to your friend? It is clear that to transfer money to him, you will use the services of a third-party institution, for example, a bank. This is where trust comes into play. Usually we don’t think about it, but we believe that the bank will give the money to our friend.

Many blockchain supporters don’t like the idea of a system that relies on a third party, such as a bank. They want to be able to make transactions without intermediaries, even with people who are at a great distance.

If we look back at our lives, we will see that we depend on all kinds of institutions, not only from banks, but also from governments and companies. Whether this state of affairs is dangerous or not depends on your personal feelings, but it seems that people promoting blockchain are developing a system without trust with the idea that it would be nice to have a system that works well without any institutions.

It may be difficult to imagine, because it is an abstract explanation, but, to put it very simply, we do not want to create a place or institution in a system where power is concentrated in “one hand”.

Let me get back to the heart of the matter. What should be done first to create a currency system? Since we exchange digital currency, the first thing we need to do is build a network that will allow us to send and receive information electronically. There are two main ways to build a network that allows personal devices to communicate: P2P and client-server. P2P is the one used in the blockchain.

P2P type communication, and client-server type communication

P2P means Peer to Peer, which translates as “connecting like to like”, and in a P2P network, individual devices are directly connected, forming a network as a whole. In P2P, the entire network is built by directly connecting individual terminals, i.e. your computer is connected to several neighboring computers, which, in turn, are connected to several more computers, and so on, until finally a network is built with individual computers as branch points.

In the client-server model, individual terminals (clients) are connected via a central server named after the two roles played by the computers that make up the network: server and client.

When you send someone a message on Twitter or by email, the content of the message is immediately displayed on their device, giving the impression that the two devices are directly connected. However, many of these devices do not communicate with each other directly. This is due to the fact that each terminal receives data only through a server managed by the company providing the service. This is a client-server model.

P2P became famous thanks to Napster and Winny, which were popular file sharing programs in 1999 and the early 2000s, but due to copyright issues, some people may get the impression that P2P is illegal. However, the problem with file-sharing software is the copyright of the content it processes, and the P2P technology itself is not illegal.

If you have a smartphone or a computer, you can use P2P communication. This means that currently most people have the opportunity to use P2P communications thanks to the widespread use of smartphones and computers. A striking example of this is BitTeam.

The advantage of a P2P network is its resilience to failures: in a P2P network, several computers are connected to each other, so if one of the computers is attacked or breaks down, the network itself does not suffer, and data exchange can continue. On the other hand, in the case of the client-server model, if the server fails, even if the client has no problems, it will not be able to exchange data.

The disadvantage of P2P is “lawlessness”: since there is no central authority controlling P2P communications, in principle it is impossible to guarantee the ordering of the network and the accuracy of information. Therefore, if you want to create a network with a certain level of functionality using P2P communications, you need to carefully develop rules governing the behavior of network participants.

As mentioned earlier, the P2P model is preferable for blockchain. This is due to the fact that if there is a central server, it becomes a single point of failure, which can be attacked from the outside and fake data. And then the question arises: “Who will manage the central server? If you have an administrator, you have to trust that administrator, which makes the system less reliable. For this reason, the blockchain uses P2P as the basic method of network interaction, since all devices can be treated the same. On Сoinmarketrate.com you will find a lot of projects using this technology.

Currently, the Internet operates on the client-server principle. The reason for this is that the client-server model is simpler for authentication and security management. As mentioned above, in the client-server model, all nodes (in this case, a computer terminal) pass through the server, so the server can centrally manage the network. In P2P, however, there is no server, which complicates the integration of the management mechanism. In addition, P2P has the problem of slow data distribution, which is why the client-server model is widely used on the Internet today, since it is more centralized and provides more stable services.

Types of P2P

There are two types of P2P: “hybrid P2P” and “pure P2P”.

  1. Hybrid P2P: The server takes care of node search and authentication, while data transfer is carried out directly between nodes. Its advantages are simple security monitoring and fast information retrieval, but it is less resistant to failures because the server is a single point of failure.
  2. Pure P2P: All nodes are equal, data search and transmission is carried out autonomously due to communication between nodes. The advantage is, as mentioned above, “fault tolerance”, and the disadvantage is the complexity of implementation in the form of a service.
Left: Hybrid P2P, Right: Pure P2P

Left: Hybrid P2P, Right: Pure P2P

So which of these methods should be adopted?

Of course, pure P2P, because we are concerned about the issue of trust. Hybrid P2P creates hierarchical relationships between nodes, which means that network equality is lost.

P2P and Blockchain File Sharing Software

From the point of view of data exchange on the P2P network, P2P file sharing software and blockchain, at first glance, do the same thing. What is the difference between them?

There are two differences between P2P file-sharing software and blockchain: the amount of data stored on the node and the incentive to maintain the node.

How much data is stored on the node?

In P2P file sharing programs, each node has a different amount of information, so usually a request is sent for the information you need, and then requests are sent until a node with such information is found. In the blockchain, each node stores all the data.

Incentives to maintain nodes

P2P file sharing software has no incentive to keep nodes online all the time. You need to connect to them only when you have the right files. Blockchain, on the other hand, has the advantage that nodes are constantly online. In blockchain, on the other hand, there is an advantage in keeping the node online, as you get rewarded for participating and successfully mining coins. This reward is an incentive to maintain the node in the network, which in turn helps to maintain the network.

There are two types of nodes: those that store all data, and those that store only some data. The term “node” refers to the node that has all the information in the blockchain (the full node of the blockchain).

Thanks to P2P communication, we managed to create an equal data exchange network that does not depend on a central server.