Consensus Algorithm
The consensus algorithm is the mechanism by using which blockchain performs some of its basic functions. Since the network is peer-to-peer, the process of validation of transactions cannot be carried out by the decision of the regulator. An automated validation mechanism is needed - a consensus algorithm. It is used to confirm that individual members of the network comply with its rules and that transactions are carried out correctly. This is extremely important during work with digital currency, which, technically, is quite simple to copy and fake.
For the first time, an effective consensus algorithm was developed by Satoshi Nakamoto on a base of the Bitcoin network. He is the one who was responsible for the high stability of the entire system and the solution of ""Byzantine generals Dilemma.""
Algorithms and protocols
Despite the fact that these terms are often used to refer to similar phenomena, this is not entirely correct. If you put it simply, the protocol is a clear system of prescribed rules, and the algorithm is the execution of these same rules.
The protocol determines which will be the particular blockchain network. It is prescribed during creation and practically doesn't change. Basic rules are common to all participants. The Algorithm is the actions that the system must perform out in order for the protocol to be implemented. For example, Bitcoin and Ethereum are protocols in which normal interaction is implemented through the Proof of Work and Proof of Stake consensus algorithms.
Here is another example. In the Bitcoin network, the protocol identifies how exactly different nodes can interact with each other and what conditions must be met for successful validation to occur. And the consensus algorithm will be responsible for checking the digital signature and balance, as well as for confirming the transaction or the new block which was mined.
Proof of Work (PoW)
It is the first consensus algorithm that was developed. Its main point consists in the fact that after successfully calculating the block hash, the rest of the network members check the correctness of these calculations - confirming the ""Proof of Work."" In the same way, they confirm the correctness, sequence, and singleness of transactions within the block, since all this is stored on each machine in the network.
Proof of Stake (PoS)
An alternative to ""Proof of Work"", because it works on a principle that does not depend on the computing power of the node and the entire system. The authenticity of the transaction is confirmed by one of the nodes which were selected by using a pseudorandom algorithm based on the amount of funds in the account, the “Coin age” and a number of other parameters and not by the whole system. This validator automatically checks the accuracy of the transaction or the appearance of the new block, which gives him a certain share of the profit. If false information is confirmed, subsequent validators will know it by using their calculations.
It is the principle which the Ethereum blockchain will use for work. There is a gradual transition from PoW to PoS already since the second option allows the system to work faster and process more transactions per second.
Conclusion
The main concept of a “consensus algorithm” is the basis of any blockchain network, since this is the only one way to ensure effective interaction between nodes of a global network that have equal rights and do not trust each other. In addition, it is the consensus algorithm is responsible for making the network stable to any targeted changes. It is the reason why a joint effort of more than 51 percent of the total network capacity is necessary in order to get a “majority of votes” and dictate terms based on the consensus algorithm. This is, however, is technically very difficult to implement.