The XRP ledger is the underlying peer-to-peer network that provides a globally distributed ledger that gives applications authoritative information about the state of its contents. Some of this information includes the balances between accounts, the settings for each account, time stamps and transaction costs.
The XRP ledger consists of many distributed servers that process transactions known as nodes. Transactions on the network are sent to the nodes from applications such as mobile wallets, electronic trading platforms, financial institution gateways and web wallets.
There are two types of nodes; tracking nodes and validating nodes. Tracking nodes distribute transactions while validating nodes perform the same function but also advance the ledger sequence. Once a user submits a transaction to the network, the tracking nodes relay the transaction to its peers. This allows the transactions, henceforth referred to as a candidate to propagate through the entire network. Each candidate transaction should interact with all the nodes in the network, but this doesn’t always happen. Sometimes, the time taken by a candidate to propagate the network impedes this ideal situation. This necessitates a process which ensures uniformity of processed transactions and validated ledgers across the network; the consensus process.
Consensus is a process by which validating nodes in the network agree on a specific set of the candidate transactions that should be considered and subsequently added to the next ledger. It starts with the sharing of information between the nodes where they propose the candidates. The proposals keep coming until a supermajority of peers agree on the same set of candidate transactions. In the first round, at least 50% of the peers must agree on any proposed set of candidates and this keeps rising as the sets are streamlined. In the end, the set of candidates that finally makes the cut garners at least 80% of the peers, although the number is not definite and can change.
Each node in the network has its chosen validators; a specific set of peers which when taken collectively as a group are trusted not to collude and defraud the node in question. While the validators don’t necessarily have to be trustworthy individually, together they must be trustable not to collude and ‘cheat’ the system.
The consensus process only takes the agreed upon subset of candidate transactions to be added to the next ledger. Any transaction that is not agreed upon and picked in the first round of consensus moves on to the next round. In most cases, a transaction succeeds in the second round having failed the first. However, there are rare cases when a transaction fails indefinitely. This is usually as a result of an increase in the fees charged which goes above the fees outlined in the transaction. In this case, this transaction expires after a reasonable amount of time passes so that the executor can be aware that his transaction was unsuccessful. The amount of time a transaction takes to expire is known as the last ledger sequence and it is set by the executing application such as a mobile wallet.