Distributed systems

Apr 28, 2024 1:13:57 AM

The blockchain is a distributed system. Thus, understanding how distributed systems work helps us understand how blockchains do it. It is not easy to define a distributed system, and there are several definitions in the literature, but they all have things in common.

A distributed system is composed of several actors who communicate to work as a single entity. All of its inner workings are opaque for those who use it, and the impression is that only one process is running.

Let’s think of this concept in terms of a blockchain. For those who use it, it looks like a single entity with only one state. But the blockchain as a database is distributed by numerous participants, called nodes, interacting with each other. Each node has its own database, which may eventually conflict with another. For the system to have a single truth, such conflicts must be solved by a consensus mechanism.

Distributed systems began to be extensively studied around the 1970s. One of the properties of distributed systems is that they do not have a single point of failure. This means that they should continue to work even if some nodes fail. In the aerospace industry, this is an essential feature, as the failure of a computer on an airplane could incur the loss of countless lives.

A current example of a distributed system is cloud computing. For the end user, the process is quite simple: create a virtual machine; send a file. The user has the impression that he is interacting with only one server, but in reality, he is interacting with a collection of servers, exchanging messages with each other. If one of the servers fails, the user will not notice any difference, as another server will take its place.

Distributed systems can be crash-tolerant or fault-tolerant. When they are crash-tolerant, they can handle nodes that crash temporarily. There is also the possibility that nodes not only crash but act maliciously. In that case, the system must be secure against malicious nodes, known as byzantine nodes.

Blockchains are Byzantine fault-tolerant distributed systems. In addition to being distributed, they are usually decentralized too. This means that all participants have the same duties and responsibilities. Decentralization is optional in distributed systems, and many of them are not decentralized, although decentralization is a desired property in public blockchains.

One of the most fundamental properties in distributed systems is how nodes reach consensus. We’ve already seen several consensus mechanisms, such as proof of work, proof of stake, and delegated Byzantine Fault Tolerance. These are consensus mechanisms developed for blockchain. Before, other consensus mechanisms were developed, such as Paxos, Raft, and PBFT.

One must become a node to participate in the distributed system that is the blockchain. Running a program, usually called a client, is necessary. However, there are other ways to interact with the blockchain without being a node, such as using wallets. Wallets are the gateway to the blockchain for many users, and they take care of interacting with nodes for us. We’ll see more about that in the next lesson.