You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/index.md
+35-17
Original file line number
Diff line number
Diff line change
@@ -108,12 +108,12 @@ If you omit the "catch" section, errors may not be visible.
108
108
109
109
1. Install [NodeJS](https://nodejs.org) and the Node Package Manager (npm). Most Linux distros have a package for NodeJS, but make sure you have version `0.12.0` or higher.
110
110
2. Use npm to install [Babel](https://babeljs.io/) globally:
111
-
npm install -g babel
111
+
`npm install -g babel`
112
112
3. Use npm to install RippleAPI:
113
-
npm install ripple-lib
113
+
`npm install ripple-lib`
114
114
115
115
After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using babel-node:
116
-
babel-node script.js
116
+
`babel-node script.js`
117
117
118
118
<asideclass="notice">
119
119
Instead of using babel-node in production, we recommend using Babel to transpile to ECMAScript 5 first.
@@ -128,23 +128,28 @@ Instead of using babel-node in production, we recommend using Babel to transpile
128
128
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
129
129
```
130
130
131
-
Every Ripple account has an *address*, which is a base58-encoding of a hash of the account's public key.
131
+
Every Ripple account has an *address*, which is a base58-encoding of a hash of the account's public key. Ripple addresses always start with the lowercase letter `r`.
132
132
133
133
## Account Sequence Number
134
134
135
-
Every Ripple account has a *sequence number* that is used to order transactions. Every transaction must have a sequence number and transaction can only be executed in order by sequence number. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
135
+
Every Ripple account has a *sequence number* that is used to keep transactions in order. Every transaction must have a sequence number. A transaction can only be executed if it has the next sequence number in order, of the account sending it. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
136
136
137
137
## Currency
138
138
139
139
Currencies are represented as either 3-character currency codes or 40-character uppercase hexadecimal strings. We recommend using uppercase [ISO 4217 Currency Codes](http://www.xe.com/iso4217.php) only. The string "XRP" is disallowed on trustlines because it is reserved for the Ripple native currency. The following characters are permitted: all uppercase and lowercase letters, digits, as well as the symbols `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `<`, `>`, `(`, `)`, `{`, `}`, `[`, `]`, and `|`.
140
140
141
141
## Value
142
-
A *value* is a quantity of a currency represented as a decimal string (string encoding is used because javascript numbers do not have sufficient precision).
142
+
A *value* is a quantity of a currency represented as a decimal string. Be careful: JavaScript's native number format does not have sufficient precision to represent all values. XRP has different precision from other currencies.
143
+
144
+
**XRP** has 6 significant digits past the decimal point. In other words, XRP cannot be divided into positive values smaller than `0.000001` (1e-6). XRP has a maximum value of `100000000000` (1e11).
145
+
146
+
**Non-XRP values** have 15 decimal digits of precision, with a maximum value of `9999999999999999e80`. The smallest positive non-XRP value is `1e-81`.
143
147
144
-
An XRP value has 6 significant digits past the decimal point. A non-XRP value has 16 total digits of precision.
145
148
146
149
## Amount
147
150
151
+
Example amount:
152
+
148
153
```json
149
154
{
150
155
"currency": "USD",
@@ -153,14 +158,15 @@ An XRP value has 6 significant digits past the decimal point. A non-XRP value ha
153
158
}
154
159
```
155
160
161
+
Example XRP amount:
156
162
```json
157
163
{
158
164
"currency": "XRP",
159
165
"value": "2000"
160
166
}
161
167
```
162
168
163
-
An *amount* is data structure representing a currency, a quantity of that currency, and the counterparty on the trustline that holds the value (for all currencies besides "XRP").
169
+
An *amount* is data structure representing a currency, a quantity of that currency, and the counterparty on the trustline that holds the value. For XRP, there is no counterparty.
164
170
165
171
A *lax amount* allows the counterparty to be omitted for all currencies. If the counterparty is not specified in an amount within a transaction specification, then any counterparty may be used for that amount.
166
172
@@ -182,7 +188,7 @@ A transaction type is specified by the strings in the first column in the table
182
188
183
189
Type | Description
184
190
---- | -----------
185
-
[payment](#payment) | A `payment` transaction represents a transfer of value from one account to another. Depending on the path taken, additional exchanges of value may occur atomically to facilitate the payment.
191
+
[payment](#payment) | A `payment` transaction represents a transfer of value from one account to another. Depending on the [path](https://ripple.com/build/paths/) taken, additional exchanges of value may occur atomically to facilitate the payment.
186
192
[order](#order) | An `order` transaction creates a limit order. It defines an intent to exchange currencies, and creates an order in the Ripple Consensus Ledger's order book if not completely fulfilled when placed. Orders can be partially fulfilled.
187
193
[orderCancellation](#order-cancellation) | An `orderCancellation` transaction cancels an order in the Ripple Consensus Ledger's order book.
188
194
[trustline](#trustline) | A `trustline` transactions creates or modifies a trust line between two accounts.
@@ -195,20 +201,28 @@ Type | Description
195
201
196
202
Executing a transaction with `RippleAPI` requires the following four steps:
197
203
198
-
1. prepare - Create an unsigned transaction based on a [specification](#transaction-specifications) and [instructions](#transaction-instructions).
199
-
2. sign - Cryptographically sign the transaction locally and save the [transaction ID](#transaction-id). Signing is how the owner of an account authorizes a transaction to take place.
200
-
3. submit - Submit the transaction to the connected server.
201
-
4. verify - Verify that the transaction got validated by querying with [getTransaction](#gettransaction). This is necessary because transactions may fail even if they were successfully submitted. It is recommended that you specify a `maxLedgerVersion` in the instructions when preparing a transaction because without it there is no way to know that a failed transaction will never succeeed in the future. It is impossible for a transaction to succeed after the network ledger version exceeds the `maxLedgerVersion` provided in the transaction instructions.
204
+
1. Prepare - Create an unsigned transaction based on a [specification](#transaction-specifications) and [instructions](#transaction-instructions). There is a method to prepare each type of transaction:
2.[Sign](#sign) - Cryptographically sign the transaction locally and save the [transaction ID](#transaction-id). Signing is how the owner of an account authorizes a transaction to take place.
214
+
3.[Submit](#submit) - Submit the transaction to the connected server.
215
+
4. Verify - Verify that the transaction got validated by querying with [getTransaction](#gettransaction). This is necessary because transactions may fail even if they were successfully submitted.
202
216
203
217
## Transaction Fees
204
218
205
-
Every transaction requires a *fee* to be paid in XRP. The fee is destroyed; it is not sent to any other party. The purpose of the fee is to prevent denial of service attacks on the Ripple network.
219
+
Every transaction must destroy a small amount of XRP as a cost to send the transaction. This is also called a *transaction fee*. The transaction cost is designed to increase along with the load on the Ripple network, making it very expensive to deliberately or inadvertently overload the network.
206
220
207
-
You can choose the size of the fee you want to pay or let a default be used. The fee is like a bid in an auction for slots in the next ledger closing. If the fee you choose is too low, your transaction will not be included in the next ledger closing. You can get an estimate of the fee required to be included in the next ledger closing with the [getFee](#getfee) method.
221
+
You can choose the size of the fee you want to pay or let a default be used. You can get an estimate of the fee required to be included in the next ledger closing with the [getFee](#getfee) method.
208
222
209
223
## Transaction Instructions
210
224
211
-
Transactions instructions indicates how to execute a transaction, complementary with the [transaction specification](#transaction-specifications).
225
+
Transaction instructions indicate how to execute a transaction, complementary with the [transaction specification](#transaction-specifications).
212
226
213
227
Name | Type | Description
214
228
---- | ---- | -----------
@@ -218,13 +232,17 @@ maxLedgerVersion | integer | *Optional* The highest ledger version that the tran
218
232
maxLedgerVersionOffset | integer | *Optional* Offset from current legder version to highest ledger version that the transaction can be included in.
219
233
sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction.
220
234
235
+
We recommended that you specify a `maxLedgerVersion` because without it there is no way to know that a failed transaction will never succeeed in the future. It is impossible for a transaction to succeed after the network ledger version exceeds the transaction's `maxLedgerVersion`.
A hash of the transaction that can be used to identify it. A transaction can be looked up by its ID using the [getTransaction](#gettransaction) method.
243
+
A transaction ID is a 64-bit hexadecimal string that uniquely identifies the transaction. The transaction ID is derived from the transaction instruction and specifications, using a strong hash function.
244
+
245
+
You can look up a transaction by ID using the [getTransaction](#gettransaction) method.
Copy file name to clipboardexpand all lines: docs/src/basictypes.md.ejs
+11-5
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,28 @@
6
6
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
7
7
```
8
8
9
-
Every Ripple account has an *address*, which is a base58-encoding of a hash of the account's public key.
9
+
Every Ripple account has an *address*, which is a base58-encoding of a hash of the account's public key. Ripple addresses always start with the lowercase letter `r`.
10
10
11
11
## Account Sequence Number
12
12
13
-
Every Ripple account has a *sequence number* that is used to order transactions. Every transaction must have a sequence number and transaction can only be executed in order by sequence number. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
13
+
Every Ripple account has a *sequence number* that is used to keep transactions in order. Every transaction must have a sequence number. A transaction can only be executed if it has the next sequence number in order, of the account sending it. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
14
14
15
15
## Currency
16
16
17
17
Currencies are represented as either 3-character currency codes or 40-character uppercase hexadecimal strings. We recommend using uppercase [ISO 4217 Currency Codes](http://www.xe.com/iso4217.php) only. The string "XRP" is disallowed on trustlines because it is reserved for the Ripple native currency. The following characters are permitted: all uppercase and lowercase letters, digits, as well as the symbols `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `<`, `>`, `(`, `)`, `{`, `}`, `[`, `]`, and `|`.
18
18
19
19
## Value
20
-
A *value* is a quantity of a currency represented as a decimal string (string encoding is used because javascript numbers do not have sufficient precision).
20
+
A *value* is a quantity of a currency represented as a decimal string. Be careful: JavaScript's native number format does not have sufficient precision to represent all values. XRP has different precision from other currencies.
21
+
22
+
**XRP** has 6 significant digits past the decimal point. In other words, XRP cannot be divided into positive values smaller than `0.000001` (1e-6). XRP has a maximum value of `100000000000` (1e11).
23
+
24
+
**Non-XRP values** have 15 decimal digits of precision, with a maximum value of `9999999999999999e80`. The smallest positive non-XRP value is `1e-81`.
21
25
22
-
An XRP value has 6 significant digits past the decimal point. A non-XRP value has 16 total digits of precision.
23
26
24
27
## Amount
25
28
29
+
Example amount:
30
+
26
31
```json
27
32
{
28
33
"currency": "USD",
@@ -31,14 +36,15 @@ An XRP value has 6 significant digits past the decimal point. A non-XRP value ha
31
36
}
32
37
```
33
38
39
+
Example XRP amount:
34
40
```json
35
41
{
36
42
"currency": "XRP",
37
43
"value": "2000"
38
44
}
39
45
```
40
46
41
-
An *amount* is data structure representing a currency, a quantity of that currency, and the counterparty on the trustline that holds the value (for all currencies besides "XRP").
47
+
An *amount* is data structure representing a currency, a quantity of that currency, and the counterparty on the trustline that holds the value. For XRP, there is no counterparty.
42
48
43
49
A *lax amount* allows the counterparty to be omitted for all currencies. If the counterparty is not specified in an amount within a transaction specification, then any counterparty may be used for that amount.
Copy file name to clipboardexpand all lines: docs/src/boilerplate.md.ejs
+3-3
Original file line number
Diff line number
Diff line change
@@ -32,12 +32,12 @@ If you omit the "catch" section, errors may not be visible.
32
32
33
33
1. Install [NodeJS](https://nodejs.org) and the Node Package Manager (npm). Most Linux distros have a package for NodeJS, but make sure you have version `0.12.0` or higher.
34
34
2. Use npm to install [Babel](https://babeljs.io/) globally:
35
-
npm install -g babel
35
+
`npm install -g babel`
36
36
3. Use npm to install RippleAPI:
37
-
npm install ripple-lib
37
+
`npm install ripple-lib`
38
38
39
39
After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using babel-node:
40
-
babel-node script.js
40
+
`babel-node script.js`
41
41
42
42
<asideclass="notice">
43
43
Instead of using babel-node in production, we recommend using Babel to transpile to ECMAScript 5 first.
Copy file name to clipboardexpand all lines: docs/src/transactions.md.ejs
+21-9
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ A transaction type is specified by the strings in the first column in the table
6
6
7
7
Type | Description
8
8
---- | -----------
9
-
[payment](#payment) | A `payment` transaction represents a transfer of value from one account to another. Depending on the path taken, additional exchanges of value may occur atomically to facilitate the payment.
9
+
[payment](#payment) | A `payment` transaction represents a transfer of value from one account to another. Depending on the [path](https://ripple.com/build/paths/) taken, additional exchanges of value may occur atomically to facilitate the payment.
10
10
[order](#order) | An `order` transaction creates a limit order. It defines an intent to exchange currencies, and creates an order in the Ripple Consensus Ledger's order book if not completely fulfilled when placed. Orders can be partially fulfilled.
11
11
[orderCancellation](#order-cancellation) | An `orderCancellation` transaction cancels an order in the Ripple Consensus Ledger's order book.
12
12
[trustline](#trustline) | A `trustline` transactions creates or modifies a trust line between two accounts.
@@ -19,27 +19,39 @@ Type | Description
19
19
20
20
Executing a transaction with `RippleAPI` requires the following four steps:
21
21
22
-
1. prepare - Create an unsigned transaction based on a [specification](#transaction-specifications) and [instructions](#transaction-instructions).
23
-
2. sign - Cryptographically sign the transaction locally and save the [transaction ID](#transaction-id). Signing is how the owner of an account authorizes a transaction to take place.
24
-
3. submit - Submit the transaction to the connected server.
25
-
4. verify - Verify that the transaction got validated by querying with [getTransaction](#gettransaction). This is necessary because transactions may fail even if they were successfully submitted. It is recommended that you specify a `maxLedgerVersion` in the instructions when preparing a transaction because without it there is no way to know that a failed transaction will never succeeed in the future. It is impossible for a transaction to succeed after the network ledger version exceeds the `maxLedgerVersion` provided in the transaction instructions.
22
+
1. Prepare - Create an unsigned transaction based on a [specification](#transaction-specifications) and [instructions](#transaction-instructions). There is a method to prepare each type of transaction:
2. [Sign](#sign) - Cryptographically sign the transaction locally and save the [transaction ID](#transaction-id). Signing is how the owner of an account authorizes a transaction to take place.
32
+
3. [Submit](#submit) - Submit the transaction to the connected server.
33
+
4. Verify - Verify that the transaction got validated by querying with [getTransaction](#gettransaction). This is necessary because transactions may fail even if they were successfully submitted.
26
34
27
35
## Transaction Fees
28
36
29
-
Every transaction requires a *fee* to be paid in XRP. The fee is destroyed; it is not sent to any other party. The purpose of the fee is to prevent denial of service attacks on the Ripple network.
37
+
Every transaction must destroy a small amount of XRP as a cost to send the transaction. This is also called a *transaction fee*. The transaction cost is designed to increase along with the load on the Ripple network, making it very expensive to deliberately or inadvertently overload the network.
30
38
31
-
You can choose the size of the fee you want to pay or let a default be used. The fee is like a bid in an auction for slots in the next ledger closing. If the fee you choose is too low, your transaction will not be included in the next ledger closing. You can get an estimate of the fee required to be included in the next ledger closing with the [getFee](#getfee) method.
39
+
You can choose the size of the fee you want to pay or let a default be used. You can get an estimate of the fee required to be included in the next ledger closing with the [getFee](#getfee) method.
32
40
33
41
## Transaction Instructions
34
42
35
-
Transactions instructions indicates how to execute a transaction, complementary with the [transaction specification](#transaction-specifications).
43
+
Transaction instructions indicate how to execute a transaction, complementary with the [transaction specification](#transaction-specifications).
36
44
37
45
<%-renderSchema("objects/instructions.json") %>
38
46
47
+
We recommended that you specify a `maxLedgerVersion` because without it there is no way to know that a failed transaction will never succeeed in the future. It is impossible for a transaction to succeed after the network ledger version exceeds the transaction's `maxLedgerVersion`.
A hash of the transaction that can be used to identify it. A transaction can be looked up by its ID using the [getTransaction](#gettransaction) method.
55
+
A transaction ID is a 64-bit hexadecimal string that uniquely identifies the transaction. The transaction ID is derived from the transaction instruction and specifications, using a strong hash function.
56
+
57
+
You can look up a transaction by ID using the [getTransaction](#gettransaction) method.
0 commit comments