Ripple Transaction protocol (RTXTP) is a blockchain protocol that possesses most of the characteristics of the more popular protocols like Bitcoin and Ethereum. But what makes it unique is its streamlining in accordance with the aim of affordable and efficient transfer of funds, globally. The protocol achieves this efficiency, especially in terms of speed, through the Ripple Protocol Consensus Algorithm. So how does this algorithm work?
What are Consensus Algorithms?
Consensus algorithms are basically solutions for the Byzantine’s Generals’ problem. Bitcoin uses Proof of Work(PoW) algorithm, while Ethereum uses Proof of Stake(PoS) as a way to tackle the Byzantine problem. This problem is actually quite relatable for someone who has watched any movie based on wars in the pre-modern era.
The Byzantine Generals’ Problem
A part of the Byzantine’s army has to take down a city. This army has ‘n’ number of generals, each having their own decisive capabilities. Only if all the generals attack together from ‘n’ sides of the city, will the attack succeed. All the generals have to come to a consensus by communicating through messengers, whether to attack or not. Now a number of problems arise. Consider these cases:
- A few of the generals believe it’s better to attack, while the others believe it’s not
- A few of the generals are corrupt and want the attack to fail
- The messengers are corrupt and deliberately change the message
These are few of the problems that consensus algorithms try to tackle, which altogether translates to ‘How can a group of people(nodes) come to the right decision, when their credibility is questionable ?’.
How does RPCA tackle the Problem ?
- Let us say there are 100 generals (nodes) in the battalion (blockchain network).
- There is a strategist(RPCA), that aims to ensure that each and every loyal general either comes to the same conclusion, or no conclusion at all. They cannot afford to have a different conclusion.
- So the strategist asks each of them to select the generals that they trust (this does not guarantee their loyalty. It’s just the people they think they can trust.) and make a list (UNL: Unique Node List).
- Now the strategist asks them to have a consensus with the people in their list. If more than 80% of the people in their UNL come up with the same decision, then it is finalized by the general. This is because the strategist knows that their army can only handle the traitorship of less than 20% of the generals (Byzantine fault tolerance = 20%). Similarly all the generals consult with their UNLs and come to a consensus.
- Now let’s say there are 20 generals(all traitors), each of whom have the rest of the 19 in their UNL. And there is another UNL of the same type but with honest generals. So both of these UNLs will independently come to a consensus, which will contradict each other. But the main motive of the strategist was to ensure that every loyal general comes to the same consensus in their UNLs.
- So the strategist made another rule: If we select any two UNL’s, they should have at least 20% of the members in common. Hence there will always be enough people in each UNL to stop them from reaching the wrong decision.
- Eg. in the twenty faulty generals, if we replace 4 generals (20% of 20 generals) with honest ones, then the majority would not be more than 80%, thus preventing consensus.
- Hence none of the generals would ever come to the wrong consensus, regardless of who is in their UNL, as long as the number of traitors is less than 20%.
And that’s how the strategist won the chain of honor!
Note that this is quite a quick algorithm as compared to it’s counterparts, that saves both time and energy.