Consensus is a fundamental part of the functioning of blockchain technology and cryptocurrencies. This is because it is the pillar that guarantees the security of the blockchain, since it controls the fact that all those who participate in the network unanimously accept the information that the chain contains.
Unot of the most important principles in the nature of cryptocurrencies, it is the consensus. The consensus or 'consensus' is nothing more than the acceptance by all the members of the blockchain network of the information that is in it. In this way, everyone on the network accepts that the information has no manipulations or erroneous or duplicate data.
In a type network blockchain the information is grouped into blocks and these are validated through mining. Therefore, the first thing to keep in mind is that consensus is the synchronization system between all the nodes in the network. Through this synchronization all the computers that are part of the network can be sure that the information is correct and that there are no manipulations.
Before this situation the following question arises:
How do we ensure that we agree with the validation of the block?
The answer is: by agreement between the nodes. of the network. This allows a kind of 'audit' that prevents someone from sending manipulated information to the blockchain.
Cryptocurrency Consensus: Bitcoin Case
To prevent erroneous blocks from being added to the blockchain, each of those blocks needs review and confirmation. This process happens in all blockchain and the first to implement it was Bitcoin. By means of the consensus system in Bitcoin, it is established whether the block includes correct information and, therefore, whether it can be added to the blockchain or not.
One of the requirements that ensure that the validation process is optimal is that all nodes accept the data from to confirm the integrity of the data. This even in the case that some nodes are failed or are not reliable.
Miners are essential for transactions to be included in a block. However, it is the nodes of the network that work in the validation of the information included in said block. For this reason it is important that there are the largest number of full nodes in the Bitcoin network. If you want to run a complete node of the Bitcoin network, from the official website they have an excellent tutorial that you can follow.
Additionally, with the bitcoin consensus system we ensure that no entity can manipulate or control the entire network.
When the consensus is not reached according to the norms that nodes and miners establish to include and validate the information within a chain or blockchain, situations occur that lead to making forks in the chain, whether they are hard (hard fork) o soft (fork)
It should be noted that each currency has its own network of nodes and some may have more exhaustive protocols to avoid attacks on the blockchain.
Most importantly, consensus avoids what is known as double-spending.
Consensus to protect ourselves from double spending on cryptocurrencies
Now, let's imagine that a person uses certain cryptocurrencies (for example, makes a purchase transaction) and after doing so, decides to reverse the operation by manipulating the information of the block where the previous transaction / s appear. In this case, assuming you can remove the information from the block where your transactions have been recorded, you could spend the coins again. This is essentially the double-spending.
Additionally, the consensus what it does is to reward and encourage those who keep the blockchain alive in operation 24 hours a day 7 days a week. By making this distribution among those who collaborate in maintaining the network, you obtain a benefit and this encourages you to continue working on the integrity of the network.