Ripple Quick Start Guide
Get started with XRP and develop applications on Ripple's blockchain
- 160 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Ripple Quick Start Guide
Get started with XRP and develop applications on Ripple's blockchain
About This Book
Learn to work with XRP and build applications on Ripple's blockchain
Key Features
- Learn to use Ripple's decentralized system for transfering digital assets globally
- A simpilfied and shortened learning curve to understand the Ripple innovation and Blockchain
- Takes a hands-on approach to work with XRP – Ripple's native currency
Book Description
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 fly. 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.
What you will learn
- Understand the fundamentals of blockchain and Ripple
- Learn how to choose a Ripple wallet
- Set up a Ripple wallet to send and receive XRP
- Learn how to protect your XRP
- Understand the applications of Ripple
- Learn how to work with the Ripple API
- Learn how to build applications on check and escrow features of Ripple
Who this book is for
This book is for anyone interested in getting their hands on Ripple technology and learn where it can be used to gain competitive advantages in their respective fields. For most parts of the book, you need not have any pre-requisite knowledge. However, you need to have basic background of JavaScript to write an escrow.
Frequently asked questions
Information
Developing Applications Using the Ripple API
- Sending checks
- Cashing checks
- Creating and releasing a time-held escrow
- Creating and releasing a conditionally-held escrow
Sending checks
- Prepare transaction: Here we define the destination address, amount to be paid, and so on.
- Sign transaction: You need to sign the transaction cryptographically with your secret key. This proves that you own this account.
- Submit transaction: Once you sign the transaction, you need to submit it to the Ripple network for validation. Your check would become valid only when the validators approve your transaction.
api.prepareCheckCreate(sender, {
"destination": receiver,
"sendMax": {
"currency": "XRP",
"value": "100"
}
}, options);
const {signedTransaction} = api.sign(prepared.txJSON, secret);
api.submit(signedTransaction).then(onSuccess,onFailure);
const checkIDhasher = createHash('sha512')
checkIDhasher.update(Buffer.from('0043', 'hex'))
checkIDhasher.update(new Buffer(decodeAddress(sender)))
const seqBuf = Buffer.alloc(4)
seqBuf.writeUInt32BE(message['tx_json']['Sequence'], 0)
checkIDhasher.update(seqBuf)
const checkID = checkIDhasher.digest('hex').slice(0,64).toUpperCase()
'use strict';
const RippleAPI = require('ripple-lib').RippleAPI;
const decodeAddress = require('ripple-address-codec').decodeAddress;
const createHash = require('crypto').createHash;
const sender = 'r41sFTd4rftxY1VCn5ZDDipb4KaV5VLFy2';
const receiver = 'r42Qv8NwggeMWnpKcxMkx7qTtB23GYLHBX';
const secret = 'sptkAoSPzHq8mKLWrjU33EDj7v96u';
const options = {};
const api = new RippleAPI({server: 'wss://s.altnet.rippletest.net:51233'});
api.connect().then(() => {
console.log('Connected to the test network.');
return api.prepareCheckCreate(sender, {
"destination": receiver,
"sendMax": {
"currency": "XRP",
"value": "100"
}
}, options);
}).then(prepared => {
console.log("Transaction JSON:", prepared.txJSON);
const {signedTransaction} = api.sign(prepared.txJSON, secret);
console.log("Transaction Signed.")
api.submit(signedTransaction).then(onSuccess,onFailure);
});
function onSuccess(message){
console.log(message);
console.log("Transaction Successfully Submitted.");
const checkIDhasher = createHash('sha512');
checkIDhasher.update(Buffer.from('0043', 'hex'));
checkIDhasher.update(new Buffer(decodeAddress(sender)));
const seqBuf = Buffer.alloc(4);
seqBuf.writeUInt32BE(message['tx_json']['Sequence'], 0);
checkIDhasher.update(seqBuf);
const checkID = checkIDhasher.digest('hex').slice(0,64).toUpperCase();
console.log("CheckID:", checkID);
disconnect();
}
function onFailure(message){
console.log("Transaction Submission Failed.");
console.log(message);
disconnect();
}
function disconnect(){
api.disconnect().then(()=> {
console.log("Disconnected from test network.")
});
}
./node_modules/.bin/babel-node send_check.js
npm install -g browserify
const RippleAPI = require('ripple-lib').RippleAPI;
const decodeAddress = require('ripple-address-codec').decodeAddress;
const createHash = require('crypto').createHash;
var api = new RippleAPI({server:'wss://s.altnet.rippletest.net:51233'});
var fetchBalance;
$('document').ready(function(){
login();
$('.progress').hide();
$('#sendCheckButton').click(function(){
showsendCheckModal();
});
$('#logoutButton').click(function(){
logout();
});
$("#loginButton").click(function(){
storeCredentials();
});
$("#createCheckButton").click(function(){
createCheck();
});
});
function login(){
if(!localStorage.getItem("loggedIn")){
$('#loginModal').modal('show');
} else{
updateAccount();
}
}
function logout(){
localStorage.clear();
clearInterval(fetchBalance);
location.reload();
}
function updateAccount(){
$('#rippleAddress').text(localStorage.getItem('rippleAddress'));
updateBalance();
}
function storeCredentials(){
localStorage.setItem("rippleAddress", $('#inputRippleAddress').val());
localStorage.setItem("secret", $('#inputSecret').val());
localStorage.setItem("loggedIn", true);
$('#loginModal').modal('hide');
updateAccount();
}
$("form").submit(function(e) {
e.preventDefault();
});
function updateBalance(){
api.connect().then(() => {
const accountAddress = localStorage.getItem("rippleAddress");
return api.getAccountInfo(accountAddress);
}).then(info => {
$('#balance').text("Account Balance : " + info.xrpBalance+ " XRP");
}).then(() => {
return api.disconnect();
}).catch(console.error);
}
function showsendCheckModal(){
$(...
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- About Packt
- Contributors
- Preface
- Getting Started with Ripple
- Working with Ripple Currency XRP
- Applications of Ripple
- Getting Started with the Ripple API
- Developing Applications Using the Ripple API
- Other Books You May Enjoy