Book Image

Ripple Quick Start Guide

By : Febin John James
Book Image

Ripple Quick Start Guide

By: Febin John James

Overview of this book

This book starts by giving you an understanding of the basics of blockchain and the Ripple protocol. You will then get some hands-on experience of working with XRP. You will learn how to set up a Ripple wallet and see how seamlessly you can transfer money abroad. You will learn about different types of wallets through which you can store and transact XRP, along with the security precautions you need to take to keep your money safe. Since Ripple is currency agnostic, it can enable the transfer of value in USD, EUR, and any other currency. You can even transfer digital assets using Ripple. You will see how you can pay an international merchant with their own native currency and how Ripple can exchange it on the ?y. Once you understand the applications of Ripple, you will learn how to create a conditionally-held escrow using the Ripple API, and how to send and cash checks. Finally, you will also understand the common misconceptions people have about Ripple and discover the potential risks you must consider before making investment decisions. By the end of this book, you will have a solid foundation for working with Ripple's blockchain. Using it, you will be able to solve problems caused by traditional systems in your respective industry.
Table of Contents (7 chapters)

Creating a conditionally-held escrow

Conditionally-held escrows are similar to time-held escrows. However, you need to send the condition and the fulfillment after the release time for the escrow to be released. Ripple makes use of crypto conditions. For the purpose of this tutorial, we'll be generating a random fulfillment and condition. You need to keep the fulfillment secret, otherwise, anyone with the fulfillment code will be able to release the escrow.

Let's generate a random fulfillment and condition. You'll need to install the five-bells-condition npm library. You can do that using the following command:

npm install five-bells-condition 

Use the following code to generate a random fulfillment and condition:

const cc = require('five-bells-condition')
const crypto = require('crypto')

const preimageData = crypto.randomBytes(32);
const myFulfillment...