How Ripple Works – The Consensus Process
Ripple is a system for making transactions on the internet. Other financial systems require handshakes, contracts, corporations, laws, audits, governments and faith. Ripple only requires an algorithm.
Ripple runs of a network of servers. At the heart of the network is the ledger. It is a distributed database, a database shared with all the server in the Ripple network. It stores information about all Ripple accounts. A new ledger is created every few seconds. The most recent ledger is referred to as the ‘last closed ledger’. At any time, the last closed ledger is a perfect record of all Ripple accounts.
A transaction is any proposed change to the ledger. Any server can introduce a transaction to the network. These transactions go out to all active Ripple servers. The servers automatically come to consensus about a set of transactions to apply to the ledger creating a new last closed ledger.
How does consensus work? Let’s break it down. The goal of consensus is for each server to apply the same set of transactions to the current ledger. Servers continually receive transactions from other servers on the network. These transactions form a candidate set, a poll of transactions waiting to be added to the ledger. At the same time, the server receives proposals from other servers on the network.
A proposal is a set of transactions to consider applying to the ledger. The server routes incoming proposals based on something called the ‘unique node list’ or UNL. Each server has a UNL, a list of external servers. Proposals from servers not on the UNL are ignored. The server only pays attention to incoming proposals from the server set or on its UNL.
The transactions in the incoming proposals are compared against its candidate set. When a transaction and an incoming proposal matches a transaction in the candidate set, that transaction receives one vote.
The server continues to check the incoming proposals against the candidate set until the timer expires. At this point, the server takes transactions that have received at least a fifty per cent approval rating and packages them into a new proposal. This proposal goes out to other servers across the network.
The process now repeats but with an important change. The approval rating requirement increases to sixty per cent. Once again, the server receives incoming proposals, looks only at once from servers on its UNL and compares these proposals against the candidate set.
Now transactions with a sixty per cent approval rating are packaged into a new proposal and sent out across the network. When the timer expires, the approval rating rises to seventy per cent. With each iteration, the proposals will have a greater similarity to each other and the votes will increasingly agree.
The inevitable outcome of this process is that disputed transactions are discarded from proposals while widely accepted transactions are included. The dissimilarity between the proposals quickly more towards zero.
At this point, the network has reached consensus.
A server knows that network has consensus when eighty per cent of the votes for every transaction in a proposal are either yes or no. This is the threshold for mathematical certainty. When a proposal hits the eighty per cent threshold, the server validates the proposal, alerts the network and closes its consensus process.
This validated proposal is now applied to the last closed ledger. At this point, any invalid transactions are discarded and a new last closed ledger is created. Transactions that were not included in the ledger remain in the candidate set. All transactions that were received during the consensus process are added to the candidate set and now the process starts again.
For more information, visit ripple.com.