## 2 Overview of Blockchain Technology
### How Blockchain Technology Works
#### 2.2.1 Consensus Algorithms  
Consensus algorithms are mechanisms used in blockchain so that all participants can reach a mutual agreement on the validity of the transactions being made, despite the fact that potential failures or inconsistencies might be discovered in the data. There are many types of consensus algorithms that have been developed, each with their own advantages and disadvantages as well as unique features. Reaching a consensus on blocks or transactions has proved to be quite challenging because these algorithms need to maintain a certain stability and resilience against node failures, corrupted or delayed messages, and nodes that seem malicious or are unresponsive [17]. There are many types of consensus algorithms, the most important of which are summarized below:  
Proof-of-Work (PoW)  
Originally, proof-of-work was used by Bitcoin. It is like a game where all participants need to agree on a transaction record. Imagine a teacher in a classroom who hands out a challenging puzzle that requires time and effort in order to be solved. Once it is solved, however, it becomes easy for everyone to check if the answer is correct [18]. In blockchain, miners (also known as validators) are the ones that compete with each other in order to solve a cryptographic puzzle and add a new block on the blockchain. This same process starts over for the next set of transactions (new blocks), making sure that the blockchain remains secure and agreed upon by all participants without any need for intermediaries to act as a central authority. Figure 3 shows how the proof-of-work algorithm operates. Figure 2: How blockchain technology works. Proof-of-Stake (PoS)  
Proof-of-stake was developed as an alternative to proof-of-work. This algorithm, instead of solving a complex puzzle, works with a process of random selection, like a lottery system, plus an investment-like mechanism, in order to reach a consensus and validate transactions. In this algorithm, validators (also known as stakers) place their own cryptocurrency as a stake in order to prove that they are serious and trustworthy. Think of it as placing a certain deposit for a future investment. The higher this deposit is, the more probable it is for the staker to be chosen in order to validate new transactions and create new blocks. When the network is required to add new blocks to the blockchain, it will randomly select one of these stakers based on how high their stake is [19]. Ethereum 2.0, for example, is currently using the proof-of-stake system. Figure 4 depicts how proof-of-stake works. Figure 4: Proof-of-stake (PoS). Figure 3: Proof-of-work (PoW). The delegated proof-of-stake algorithm is an evolution of the traditional proof-of-stake described previously. In this consensus algorithm, a distributed voting system is promoted, in which members vote a limited number of witnesses, or delegates, to secure the network, make sure no acts of fraud are being committed, validate transactions, and create new blocks. This algorithm is based on a reputation system where dishonest delegates can be voted out of the system. In delegated proof-of-stake (DPoS), the number of delegates is kept to a minimum in order to be able to achieve improved efficiency, scalability, and low energy consumption [20]. The delegated proof-of-stake (DPoS) algorithm aims to create a more scalable form of consensus which will be able to significantly increase transaction speeds and reduce costs. This makes delegated proof-of-stake (DPoS) a rather suitable system for distributed applications requiring a high transaction propagation rate. Figure 5 shows in detail how delegated proof-of-stake (DPoS) works. Practical Byzantine Fault Tolerance algorithms are highly relevant to distributed systems as they address the Byzantine generals' problem. To put it briefly, the issue involves a group of Byzantine generals (or nodes in the case of a blockchain) reaching a consensus on a collective course of action.