Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Ripple Quick Start Guide

You're reading from   Ripple Quick Start Guide Get started with XRP and develop applications on Ripple's blockchain

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher Packt
ISBN-13 9781789532197
Length 160 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Febin John James Febin John James
Author Profile Icon Febin John James
Febin John James
Arrow right icon
View More author details
Toc

Ripple

Ripple addressed these issues and came up with a solution to incorporate blockchain with existing currencies. Ripple is a blockchain-based payment system that makes the global transfer of money cheaper, faster, and more efficient. Here, money doesn't need to be fiat currencies, but any item of value (for example, gold, digital assets, etc). It also issues its own native currency called XRP.

International money transfer through Ripple

Here's how money moves across borders through the Ripple protocol:

  1. John's bank would use Ripple's system to initiate the USD to EUR exchange. Market makers will compete by posting bids.
  2. Ripple's system is optimized to select the cheapest offer. The market maker will buy USD from John's bank and Ripple will transfer Euros from the market maker to Peter's account. These transactions are atomic, which means that both of these transactions happen simultaneously or they don't happen at all.

The following image depicts the flow of money from John's bank account to Peter's bank account through The Ripple Protocol:

Ripple reduces transfer time from days to a few seconds. This is because the transfer happens without intermediaries and the settlement process requires no human intervention. The average transaction fee in Ripple is around $0.0006; that's a significant reduction of cost.

The important point to note here is that users need not exchange Ripples. Ripple can be seamlessly plugged into a banks' systems. Hence, end users such as John and Peter don't have to interact with Ripple's blockchain. Now, let's go deep into the Ripple protocol and study how it works.

The Ripple Protocol

We will start by studying the details of how accounts are created, funded, and managed. Please note that in this chapter, we will only understand the underlying process of account creation, sending money, and so on. In the next chapter, we will learn to do it practically using tools that do these process by the click of a button.

Account creation

Similar to the Bitcoin system, Ripple has no signup process. Instead, we need to generate key pairs using cryptography. Since the process is mathematical, it can be done offline.

We start by generating a seed. A seed is a set of random characters. For the sake of simplicity, let's consider the seed as A34939449DJMABESEHLODAER. Once the seed is generated, a cryptographic function is used to derive a public key from it. We will use a simple function for the sake of understanding. Our function derives the public key from the seed by taking the first sixteen characters of the seed, A34939449DJMABES.

This is a one-way process: a public key cannot be used to derive the seed. Later, we can derive our Ripple identification by using the cryptographic hash function. This is the address we mention when we want to receive payments. This is done by creating the hash of the hash of the public key.

We will again use a simple function for the sake of understanding. We will strip the first eight characters to generate the first hash, A3493944. Then, we will strip the first four characters of the first hash to create the second hash,A349.

Now, A349 is our identity on the Ripple network. The key point to note here is that if you lose your seed, your account is compromised, since every other key can be derived from it. The following image demonstrates how the seed phrase is used to derive the public key and the Ripple identity:

This is a how a seed, public key, and account ID actually looks:

{ 
"seed": "sstV9YX8k7yTRzdkRFAHmX7EVqMfX",
"public_key": "aBQXEw1vZD3geCX3rHL8qy8ooDomdFuxZcWrbRZKZjdDkUoUjGVS",
"account_id": "rDGnaDqJczDAjwKHKdhGRJh2G7zJfZhj5q"
}

Reserve

Generating key pairs doesn't create an account in the XRP ledger. To prevent Ripple's ledger from growing excessively large, new accounts must be funded with a reserve amount of XRP from an existing amount to make them functional. The present reserve amount required is 20 XRP.

You can buy Ripple from a private exchange and send it to your Ripple's account ID. This transaction will create your account in the Ripple ledger. Now, your account will become functional and you can make transactions on Ripple. However, the reserve amount will remain locked.

The important point to note here is that funding an account doesn't give you access to an account. Only the person holding the secret key has access to its funds. It's possible to fund an address that doesn't have a secret key. However, this would result in a permanent loss of the sent XRP.

A Ripple account also has additional attributes such as a sequence number and history of transactions. The sequence number starts at 1, and every time a transaction is made it increases. It also holds the transaction history on how they affected the account's balances. The following image shows the front end of a simple ripple wallet:

Balances of a Ripple Account. Source: http://xrpcharts.ripple.com.

Transactions

In order to send money, we need to create, sign, and submit the transaction to Ripple servers.

The following image depicts how a transaction makes its way to Ripple's tamper-proof ledger:

We would start by creating a transaction JSON. Here's an example of a transaction in JSON format. It includes sender address, destination address, currency type, amount to be transferred, and so on:

{ 
"TransactionType" : "Payment",
"Account" : "rf1BiGeXwwQoi4Z2ueFYTEXSwuJYfV2Jpn",
"Destination" : "ra5nK24KXfn9AHvsdFTKHSANinZseWnPcX",
"Amount" :
{
"currency" : "USD",
"value" : "2",
"issuer" : "rf1BiseXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
},
"Fee": "10",
"Flags": 2147482648,
"Sequence": 3,
}

We authorize the transaction using our secret key. Later, we submit it to the Ripple server for validation. Once it validates the transaction, it conveys the transaction to fellow members of the network. They apply these transactions to their version of the ledger in canonical order and submit the results. If enough validators reach consensus by sharing the same ledger, the transaction is confirmed and permanently added to the blockchain. If the transaction fails, it's also included in the ledgers. This is because failed transactions burn XRP and modify the account balances. XRP is burnt to prevent spammers from attacking the network with failed transactions.

Multisigning

We can add additional security to our account by authorizing transactions with a combination of multiple secret keys. We can put a requirement that multiple people need to sign the transaction for it to be valid. If we add Bob, Alice, and Ruth in the signer list and if Bob's account is compromised, the account is still safe, since transactions signed only by Bob are now invalid.

Consensus

Bitcoin uses the proof-of-work mechanism to prevent malicious users from spending Bitcoins they don't have. However, its mechanism is costly and slow since it uses an immense amount of energy. Ripple came up with a consensus mechanism that is cheaper and faster.

In order to validate a transaction, Ripple doesn't rely on central authority. Instead, it has made a set of rules that the nodes in the network must follow to agree and reach on a consensus on what must go on the permanent ledger. This set of rules are called the consensus protocol.

Important properties of the consensus protocol

The following are the properties of Ripple's consensus protocol:

  • Every participant who uses the XRP ledger should agree on which transaction occurred in what order and what the resulting state is (an account balance is an example for the resulting state).
  • A central authority is not required to confirm and validate transactions.
  • The system will continue to validate transaction even if its people in the network decided to join, leave, or act maliciously.
  • If a lot of people in the network misbehave, the network will stop making progress. This is to ensure correctness in the ledger.
  • Unlike other blockchain-based currencies, confirming transactions in the ledger does not require people to waste energy.

Ledger versions

Similar to Bitcoin, XRP also processes transactions in blocks. These blocks are called ledger versions. They contain three components:

  1. State data: This contains values such as current account balance and other objects stored in the ledger. For example, Bob's Account Balance: 5 XRP, Alice's Account Balance: 10 XRP.
  2. Newly applied transactions: These are the set of transactions that were applied to the previous ledger and hence resulted in the current state (Bob sent $5 USD to Alice, Alice sent 30 XRP to Bob).
  3. Metadata: This contains information about the ledger and the preceding parent ledger. It includes values such as the ledger index and the cryptographic hash.

Validation

In the Ripple network, the participant can choose its list of validators. This list is called the Unique Node List. When a transaction reaches these validators, they take the previously confirmed or the validated ledger version as the starting point. Then they apply new transactions in the canonical order and share their results.

Here's an example of a confirmed block. Validators would use this as a starting point:

Confirmed Block No

5
Transaction 1

Alice Sent Bob $5

Transaction 2

Bob sent Peter $20

State

Alice has $20, Bob has $30

Here comes a new set of transactions to be validated:

Alice Sent Bob $5

24 Sep 2018 09:12:17

Bob sent Peter $20

24 Sep 2018 10:12:17

If these transactions are applied according to in the order of their timestamp, the resulting state would be as follows:

State

Alice has $15, Bob has $15

The validators should arrive at the preceding conclusion. If they don't agree, then they would modify their proposal to match the validators they trust. This would continue in multiple rounds until they reach consensus. If 80% of the validators reach an agreement, then the transactions are confirmed and permanently added to the ledger. Otherwise, the ledger would stop making progress.

Advantages of Ripple

Now, let's have a look at key advantages of the Ripple cryptocurrency. These are the features that make it stand out among the other competitive currencies in the market.

Currency agnostic

Though the Ripple protocol has a native currency, XRP, it's not mandatory for users to transact only in XRP. It can transfer any item of value (fiat currencies, digital assets, and so on).

Simplified consensus

Unlike Bitcoin, Ripple has a simplified consensus or settlement mechanism. Once a transaction is signed and broadcasted, a selected number of Ripple servers reach a consensus on whether the transaction is valid or not. This process happens in 6 to 10 seconds. It can process around 1500 transactions per second; this is drastically higher than Bitcoin.

Low fee

Due to the simplified consensus mechanism and automated settlement, Ripple drastically reduces the transaction fee.

Reduced foreign exchange cost

The Ripple system is designed to select the cheapest bidder. This forces the market maker to make bids at competitive prices.

Pathfinding algorithm

Due to market limits, certain currencies cannot be exchanged directly. EUR/KRW is an example of such a currency that doesn't have a tight market. Hence, EUR needs to be exchanged for USD and USD needs to be exchanged for JPY and, finally, JPY can be exchanged for KRW. Ripple's system has a built-in pathfinding algorithm that would make the exchange by searching for the cheapest possible path.

Adaptable cryptography

Though the Ripple systems rely on time-tested encryptions such as ECDSA, it is also extendible to modern algorithms such as Ed25519. The system has the capability to add or disable algorithms. This is a great security feature, since if an encryption mechanism becomes obsolete, it can be replaced with a new one.

Anti-spam mechanism

In order to prevent spam requests on Ripple's ledger, while sending transactions a small amount of XRP must be destroyed. This fee is negligible for legitimate users, but can be costly for spammers who are trying to attack the network with bulk transactions.

Potential risks of Ripple

Now, let's look at the potential risks of Ripple. These are the few challenges Ripple would face to kick off as a currency.

  1. Regulatory issues
  2. Trust issues
  3. Security vulnerabilities
  4. Problems of being an open protocol

Regulatory issues

Certain countries such as India have banned cryptocurrencies and in certain countries laws on digital currencies are unclear. On the Ripple network, users are allowed to be anonymous. However, most governments are likely to have a problem with it.

Though governments cannot disable the XRP ledger, they can restrict people from buying XRP using fiat currencies such as USD and INR. In India, RBI has banned people from using credit cards to buy Bitcoins.

There are a lot of cryptocurrencies in the market with Ripple. Some of them are legitimate, some are scams. However, it would take time for the governments to understand the potential of cryptocurrencies. They would have a much harder time to distinguish the legitimate ones. Hence, it is hard to predict how the future of cryptocurrency will shape out.

Trust Issues

Ripple allows its users to transfer anything of value. This is accomplished with the help of issuers who link their assets to the XRP ledger. When users transact on the Ripple network, they have the option to trust these issuers.

However, if issuers misbehave and claim to have assets they don't have on the XRP ledger, it would lead to big problems. The issued currencies owned by users would lose their value overnight. This can affect people's trust in the Ripple network.

Security vulnerabilities

Security bugs are common in most online systems. However, a loophole in a distributed ledger can be fatal, since it can cause irreversible damage as data once confirmed is final and no one can alter it.

In Ethereum, bad coding has led to a loss of millions of dollars. Since Ripple limits the functionality on which a user can build on top of, there would be less room for vulnerabilities.

The question is, can Ripple continue to evolve without having any major security bugs?

Problems of being an open protocol

Ripple's code is totally free and open source. The problem with open protocols is that they can be forked easily. Bitcoin protocol was forked multiple times to create other currencies such as Bitcoin Cash and LiteCoin.

People can easily fork Ripple's code and build an advanced protocol that can compete with Ripple. Hence, partnerships are the key to Ripple's future. They need more financial institutions using the XRP ledger.

You have been reading a chapter from
Ripple Quick Start Guide
Published in: Dec 2018
Publisher: Packt
ISBN-13: 9781789532197
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image