I address this text to those who have no idea what a consensus, protocol, or algorithm is, where they are used and why they are needed in cryptocurrencies. We will also touch on the issues of decentralization and its relationship with network security and resilience.
Consensus means reaching an agreement. Why it`s called Byzantine and what does it have in common with FreeTON? The blockchain is formed by a network of nodes that need to make decisions about the validity of transactions that need to be included in a valid block. For this, the nodes must come to a consensus.
The origin of the name goes back to the task of the Byzantine generals, proposed by a group of researchers in 1982. In the classic version, the task looks something like this: the army of Byzantine generals (in Byzantine strategos) must receive orders from the commander-in-chief on the night before the assault on the fortress on whether to retreat or go to the storm.
The problem with the task is that they must come to the same solution, even though there are traitors among them, and even the commander-in-chief himself may be one of them (and send conflicting orders to different generals). And achieve this through messaging.
If all generals go to the storm, the army wins and captures the fortress, which is a favorable outcome. If all the generals retreat, the army avoids losses, which is an intermediate outcome, and leaves the possibility of re-finding consensus. If the generals act out of order or accidentally, then the army loses, which is an unfavorable outcome. Generals need to exchange information among themselves to come to the same decision, while not trusting each other.
Before proceeding to consider the method of solving this problem, it should be noted that the task is naturally exclusively speculative, and in reality, such a situation could not exist.
The exchange of information could be at the level of conversations and only before the council in the tent of the commander-in-chief on the eve of the assault. The mailing of messengers with messages refers to the moment of the battle when reinforcement or the transfer of troops to important areas is necessary (for example, to capture the love tower to raise the lattice after the gate is broken by a ram). The decisions were naturally made by the commander, but taking into account the opinion of the council members (if he is not a fool).
Here is the simplest case with using the example of 4 generals, among whom there is 1 traitor (an example from the Internet, but as far as possible easier to understand).
After the first exchange of information, when each general sends information to other generals, each general will have the following information:
3) 22.214.171.124. – traitor (this note is for the reader, the generals don’t know)
Here each general told the others his real number. The third general told the others not his number, but arbitrary information, and all different (denoted by the letters a, b, c). Further, each general sends all the others previously formed information obtained after the first exchange of information. As a result, each general will have the following set of information:
1) (1.2.a.4) (1.2.b.4) (5.u.7.w) (1.2.c.4)
2) (1.2.a.4) (1.2.b.4) (L.p.s.8) (1.2.c.4)
3) (1.2.a.4) (1.2.b.4) (126.96.36.199) (1.2.c.4) – traitor (what kind of brute he is)
4) (1.2.a.4) (1.2.b.4) (h.6.9.t) (1.2.c.4)
Traitor number 3 again sent out a wrong message to everyone else. Further, each general looks for matching values in the sets of information received and forms the result that the loyal generals will have (1.2.f (a, b, c) .4). f (a, b, c) – a value that occurs at least twice among a, b, c, or unknown if they are different. Since the values of a, b, c and function f are the same for loyal generals, a consensus is reached despite the efforts of the traitor.
Everything is cleas? Probably not. However, almost all descriptions of the solution to the Byzantine problem are approximately the same. This is another attempt at simplifying the simplest example. Therefore, in a nutshell, we can define consensus as a “vote” of the loyal generals based on coinciding information, taken as correct. Although for consensus, it is not the fidelity or falsity of information that is more important, the coming to the same decision, which is the goal.
The Byzantine consensus has an important feature – consensus can be reached if the number of traitors is strictly less than 1/3. Or in other words, if there are m traitors in the system, then consensus is possible if there are at least 2m + 1 loyal general. That is more than 2/3. If there are exactly 1/3 of traitors, then consensus cannot be reached. There is also evidence for this, but it is better to consider this moment on an example reduced to the everyday level, so to speak, to explain on the fingers, when there are 3 generals, including 1 traitor.
The traitor will send out different information to the other two generals, two loyal generals will send out valid information. Any of the loyal generals receive information on the one hand that does not coincide with the information on the other, while the value of the received data for him is absolutely the same. ova. How can he make a decision? No way. The traitor receives two sets of information based on which consensus could be reached, but he is a traitor. This rule works for any number of nodes in the system. If there are only 300 of them, and among them 100 are faulty, then consensus cannot be reached.
The system built on the Byzantine consensus is generally called Byzantine Fault Tolerance (BFT), which can be interpreted as a fault-tolerant Byzantine protocol (a protocol is a method of reaching consensus). There are various improved implementations of the BFT protocol, such as Practical Byzantine Fault Tolerance (PBFT), Federated Byzantine Agreement (FBA), Delegated Byzantine Fault Tolerance (DBFT). The latter was used in Free TON, but with its characteristics. However, how exactly and on what basis can validators reach consensus? This is based on the Proof-of-Stake (PoS) mechanism – proof of ownership of shares (coins). This mechanism is energy efficient and economical in contrast to Proof-of-Work (POW), which we will return to later.
What are the advantages of blockchains built in this way? The main difference is the speed of transaction processing, which is completed immediately after the network makes a decision and the node receives responses from other nodes. Why it is – BFT absolute consent protocol. Unlike the Nakamoto protocol, where the agreement is probabilistic. This protocol allows for microscopic error, the probability of which decreases exponentially as the number of blocks increases. However, the speed of transactions in this case suffers. A certain number of block confirmations are also required to avoid double-spending. However, the latter protocol is more resilient than classic BFT. Therefore, to level the weaknesses of the BFT, its various modifications mentioned above are used.
There is not only a drawback but a feature – the more validators, the slower the network works. Because more resources are spent on interaction to reach consensus. Simply: 10 people are faster and easier to negotiate than a hundred. Even though there is no “chairman” who will call everyone to the meeting (all validators are equal). However, the FreeTON network allows up to 1000 validators without a significant loss of transaction speed. Although it is unlikely that such some validators will be needed shortly. However, scaling margin is necessary.
To dilute the excess of technical information in the article (albeit minimized as far as it turned out), a small digression from the topic. Since the task of the Byzantine generals refers to the Middle Ages, here is an example of how a consensus was not reached. The brother of the king of France Robert Artois, despite Louis’ warning, did not wait for the main forces to approach and led the vanguard to storm Mansur (a city in Egypt). At the same time, he forced the Grand Master of the Templars to participate in his adventure, accusing him of cowardice, as a result, only the master (but already without an eye) and several knights were saved. Subsequently, the master also died, and the army of the holy king was captured. The 7th crusade ended unsuccessfully. Of course, a strained example, since there was a failure to comply with an order. However, on the other hand, not just anyone, but the king’s brother, who can do a lot. Also, do not forget that there was no absolutism then and the king was only the first among equals. Decentralization in some way.
Further, it makes sense to touch upon such an issue as the moment when the blocks were created regarding reaching consensus. Basically, in blockchains (for example, bitcoin), a block is first created, and then a consensus is sought. In this case, the existence of such a phenomenon as chain branching or, in a different way, a fork – the fork is possible. In FreeTON, the consensus is reached first, and then a block is created, which avoids forks. For example, in Polkadot, this mechanism allows you to update the system without forks at all, that is, the process runs smoothly and without the excesses that sometimes accompany similar events in other blockchains.
Now, as mentioned above, back to POW. And we will talk about ways to achieve maximum decentralization of the network. What is being done about this in proof of work blockchains? These are the fight against ASICs, the fight against farms (video cards), the fight against pools. This is achieved by complicating the algorithm (now it’s the turn to say what it is if, simply, an algorithm is a method of computing used to operate the protocol and find consensus on the network). There are many different algorithms, ranging from SHA256, script, groestl, x11, x13, x15, x17, x22i (these are all whole bundles of separate algorithms combined into one “combo”), ending with random x, or quite exotic biblehash or burgerhash … There are a lot of them, and it makes no sense to list them all directly.
In principle, reaching at a certain stage its goal of combating centralization, then the system again steps on the same rake. If done with a siks and farms, even with pools on processors, then the fact remains that all processors have different capacities, and weak processors simply stop participating in mining, since it is unprofitable. Again, only powerful miners remain on the network, and there are not so many of them. Not everyone has a server on xeons since this is generally not and is not needed if it is not used at work (and if it is used, then there is one at work). And it’s even worse for decentralization than GPU mining. Many more users have powerful gaming cards than powerful processors.
What about decentralization in FreeTON and similar systems? The above problems simply don’t exist here. Although, again, we can say that even a thousand validators are not entirely decentralized. But there is something to object to this. Namely, the practice of many years has shown that in other systems, despite the possibility of large-scale decentralization seemingly incorporated during the creation it turned out to be an almost centralized system with several largest pools of miners. For example, this applies to both Bitcoin and Ether. We can say that the situation is similar in pure POS blockchains. Or sooner or later will lead to this. So far, no such system has been able to completely overcome the problem of “the rich are getting richer”. The problem in itself is not that they are getting richer (this is not a matter of social justice). The fact is that this undermines decentralization, and hence the reliability, and, as a consequence, the security of the system.
The weakness of this argument is that it is in the style of “And you in America lynch blacks!” Since whatever the disadvantages of other blockchains, it does not diminish the disadvantages of anyone. How then to show that FreeTON is decentralized, but not because others are centralized. Let’s start with the number of validators and their selection.
For example, let’s find the other side of some Polkadot dignity. The first thing that would seem to be not a drawback at all, but a song of social justice – any bum (exaggeratedly) can become a validator, practically without a steak. At the same time, be anonymous. It would seem good, but is it possible that a bunch of such malicious validators acting in collusion (because this is one or a small group of people) somehow attracted mountains of steaks (well, for example, with an ultra-low commission) and in one of the rounds somehow so it was selected in the validators for the epoch, making up 1/3 or more of the selected ones. What happens to the Byzantine consensus has already been described earlier. So this is not the ideal path. The selected FreeTON validators somehow look more reliable. By the way, in the same Polkadot in the community, it is recommended to nominate well-known validators, not anonymous no-names. Also, there is a psychological element that affects the security of the network – if the validator must have the minimum required stake size, he invests, which means he is directly interested in the stability and security of the system.
Now “the rich are getting richer.” The mechanism for distributing FreeTON awards is such that income is received not only for the work performed (block validation, confirmation of transactions) but also in exact proportion to the stake (which is not in Polkadot – only pay for work is made there, regardless of the size of the stake). However, this will not affect decentralization in any way. Validators will not decrease from this. (Unlike pure POS, where you can never get anything with a small weight of coins, it is better to turn off the wallet and sell the coins to the whale.) Thus, “wealth of the rich” does not threaten decentralization. Each validator and nominator will receive their share. By the way, this kind of stimulates you to gradually increase your steak as much as possible (but in POS not, there is either all, or it is better not to start).
Thus, both global stumbling blocks on the way to decentralization are to some extent eliminated in FreeTON. The selected validators should have the minimum required stake, but not exceeding a certain size, which is more important for network security than a large number of unknown validators. Although the rich get richer, they do not threaten decentralization, and therefore the stability and security of the network, which is required.
In fairness, one more controversial nuance should be raised to the surface, which has nothing to do with decentralization, but deserves to be touched on – this is a real sending of coins to the validator, even to a smart contract (DePool), instead of freezing at the owner’s address. What is the danger here? The fact that smart contracts can be leaky, a smart contract can be substituted, because this is possible ever. Also related to the same feature (real sending of coins), the election of validators by cutting off the stakes and sending coins back to the addressees, which generates unnecessary transactions for the blockchain.
But there is something to object to this. And the counterargument is that sending coins back is not that big and cumbersome for a fast network. And the likelihood of such an event occurring (compromise smart contract mentation) is about the same as the fact that Polkadot will be captured by homeless validators.
However, we will talk about probability and randomness next time.
Okay, so many words, but where is simple information? Which is in the title of the article. Throughout the text that was exactly the simplification of all consensus. At the same time, a lot is lost, or even distorted to a superficial acquaintance, but I hope, having read the text, an uninformed person was able to form at least some idea of the Byzantine consensus and other issues raised along the way.
Translated from original @Elagai article.