Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kepoly authored Sep 17, 2020
1 parent 27fdc99 commit 2e6dd5c
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CSC Wallet App for Ledger Nano S and Ledger Nano X

## Introduction
This repository contains the source code for the XRP wallet app that makes it possible to securely store CSC and assets issued on the CSC Ledger using Ledger Nano S and Ledger Nano X devices.
This repository contains the source code for the CSC wallet app that makes it possible to securely store CSC and assets(tokens) issued on the CSC Ledger using Ledger Nano S and Ledger Nano X devices.

To add Ledger Nano S and Ledger Nano X support in your application, please see the
NPM package [casinocoin-ledger-demo-app](https://github.com/casinocoin/casinocoin-ledger-demo-app)
Expand Down Expand Up @@ -72,24 +72,24 @@ Page to either 'Sign transaction' or 'Reject' and press both buttons simultaneou

## Usage
In order to initiate transactions from NodeJS or a browser client, the library
[hw-app-xrp](https://www.npmjs.com/package/@ledgerhq/hw-app-xrp) can be used.
[hw-app-csc](https://www.npmjs.com/package/@ledgerhq/hw-app-csc) can be used.

An example of a basic payment transaction using this library is shown below:
```javascript
import Transport from "@ledgerhq/hw-transport-node-hid";
// import Transport from "@ledgerhq/hw-transport-u2f"; // for browser
import Xrp from "@ledgerhq/hw-app-xrp";
import Csc from "@ledgerhq/hw-app-csc";
import { encode } from 'ripple-binary-codec';

function establishConnection() {
return Transport.create()
.then(transport => new Xrp(transport));
.then(transport => new Csc(transport));
}

function fetchAddress(xrp) {
return xrp.getAddress("44'/144'/0'/0/0").then(deviceData => {
function fetchAddress(csc) {
return csc.getAddress("44'/144'/0'/0/0").then(deviceData => {
return {
xrp,
csc,
address: deviceData.address,
publicKey: deviceData.publicKey.toUpperCase()
}
Expand All @@ -106,7 +106,7 @@ function signTransaction(context, transaction) {
const transactionBlob = encode(preparedTransaction);

console.log('Sending transaction to device for approval...');
return context.xrp.signTransaction("44'/144'/0'/0/0", transactionBlob);
return context.csc.signTransaction("44'/144'/0'/0/0", transactionBlob);
}

const transactionJSON = {
Expand All @@ -119,15 +119,15 @@ const transactionJSON = {
};

establishConnection()
.then(xrp => fetchAddress(xrp))
.then(csc => fetchAddress(csc))
.then(context => signTransaction(context, transactionJSON))
.then(signature => console.log(`Signature: ${signature}`))
.catch(e => console.log(`An error occurred (${e.message})`));
```

### Advanced Usage
#### Multi-signing a Transaction
It is also possible to perform parallel multi-signing using the XRP wallet
It is also possible to perform parallel multi-signing using the CSC wallet
app. This is done by sourcing a list of signatures for the transaction
and appending them to the `Signers` field of the transaction before submitting
it for processing. An example of combining a couple of externally sourced signatures
Expand Down Expand Up @@ -165,7 +165,7 @@ const otherSigners = [

function retrieveSignerData(transaction) {
return establishConnection()
.then(xrp => fetchAddress(xrp))
.then(csc => fetchAddress(csc))
.then(context => {
return signTransaction(context, transaction)
.then(signature => {
Expand Down Expand Up @@ -196,14 +196,14 @@ retrieveSignerData(transactionJSON)
```

### Additional Notes
From version 2.0.0 of the XRP wallet app it is possible to sign larger
From version 2.0.0 of the CSC wallet app it is possible to sign larger
transactions than in previous versions. In order to enable support for larger transactions
there have been slight modifications to the transport protocol, which is used to
communicate between the client and the device.

The protocol changes are fully backwards-compatible with previous versions of
[hw-app-xrp](https://www.npmjs.com/package/@ledgerhq/hw-app-xrp), but in order
to sign larger transactions you must use version 5.12.0 or above of [hw-app-xrp](https://www.npmjs.com/package/@ledgerhq/hw-app-xrp).
[hw-app-csc](https://www.npmjs.com/package/@ledgerhq/hw-app-csc), but in order
to sign larger transactions you must use version 5.12.0 or above of [hw-app-csc](https://www.npmjs.com/package/@ledgerhq/hw-app-csc).

### Limitations
Because of resource constraints the following limits apply for the respective
Expand Down Expand Up @@ -236,9 +236,3 @@ To upload the app to your device, run the following command:
```sh
make load
```

## Testing
Manual testing can be conducted with the help of the testing utility
[TowoLabs/ledger-tests-xrp](https://github.com/TowoLabs/ledger-tests-xrp).
Make sure that your device is running the latest firmware and then follow
the instructions in the test repository.

0 comments on commit 2e6dd5c

Please sign in to comment.