## 3 Blockchain
### Technologies
#### 3.2.2 Consensus Protocols  
Blockchain utilizes distributed consensus protocols to validate transaction blocks before they are inserted into the Blockchain, which ensures data immutability. More than one consensus protocol can be implemented together to fulfill application requirements. Some examples of popular consensus protocols, and their definition, are:  
Proof-of-Work  
The pioneer consensus protocol for Blockchain was _proof-of-work_[6]. In PoW, nodes are tasked to solve arduous mathematical puzzles, a task also called \"mining\". Once a nonce is found that gives the block's hash a given format (usually hash has to start with  
Figure 8: Blockchain structure example with three blocks. zero value bits), the node that found it broadcasts the solution to the network. When at least 51% (i.e., the majority) of the nodes verify it, it can be added to the Blockchain. PoW computation costs, especially at the energy level, can difficult the implementation in new systems that rely on lightweight nodes, such as IoV. Proof-of-Stake  
Proof-of-stake (PoS) [44] introduces a new \"coin age\" concept, defined as currency amount times holding time. This new value can then be used by the owner to \"pay himself\" through a special transaction called _coinstake_, which enables the generation of a block for the owner while consuming the specified coin age. The hash of the block generated needs to reach a certain hash target protocol, but in a limited search space (in contrast with PoW's unlimited search space), greatly reducing the energy consumption and, consequently, Blockchain's energy dependency. PoS also grants better block generation and transaction confirmation speeds, since only one block is created each cycle, with fewer nodes proposing blocks by round [47]. In Delegated PoS, a group of _witnesses_ is voted by the nodes to generate blocks and are shuffled after a certain condition is met (be it time restrictions or blocks produced [48]), and are paid for each block generated. It could happen, however, that nodes with less coin age do not get a chance at generating a new block. Leased PoS is an enhance of PoS to solve this scarcity issue by allowing nodes to lease their coin age to other nodes with a higher chance of generating a block. When they do, the nodes that leased their coin age, receive a part of the reward for the generation [49]. Byzantine Fault Tolerance  
Another common consensus protocol is _Byzantine Fault Tolerance_, where nodes vote for a majority decision. Various implementations of BFT have been developed, e.g., _Practical BFT_[50]. In these protocols, a proposer node, which changes in round-robin order, broadcasts a _pre-prepared_ message that can only be accepted by the rest of the nodes if they have not accepted one already. If the majority does accept, the proposer sends a _prepared_ message. Once other nodes are prepared, the proposer sends a _commit message_ to all of them. Once the message is accepted, the state of the Blockchain is altered in each node. PBFT adds a timeout condition to tolerate faulty primary nodes (_proposer_) [51]. There is also a delegated BFT, where nodes are divided into two roles: _ordinary_ and _bookkeepers_. Ordinary nodes do not take part in deciding consensus, only choosing which bookkeeper nodes they back. A random bookkeeper is selected, and it broadcasts its transaction data to the network and, when 66% of bookkeepers accept the data as valid, it is added to the Blockchain [52]. The majority of BFT protocols can handle 1/3 of faulty nodes. Proof-of-activity  
Proof-of-activity, as described by [PERSON] et al. [53], is a consensus protocol that is a hybrid between PoW and PoS. The protocol starts by using complex mathematical tasks (the pseudorandom number and the finding of the _satoshi_, the creation of an empty block header, and the derivation of pseudorandom stakeholders from a hash). When nodes have enough stake, PoS algorithms start to occur (nodes with more stake have higher chances of being chosen).