mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 03:35:51 +00:00
Currency Formatting edits
This commit is contained in:
@@ -83,7 +83,7 @@ If you do not specify a ledger, the `current` (in-progress) ledger is chosen by
|
||||
|
||||
## Specifying Currency Amounts
|
||||
|
||||
There are two kinds of currencies in the XRP Ledger: XRP, and issued currencies. These two types of currencies are specified in different formats, and they have different amounts of precision and different rounding behavior.
|
||||
There are two kinds of currencies in the XRP Ledger: XRP, and issued currencies. These two types of currencies are specified in different formats, with different precision and rounding behavior.
|
||||
|
||||
Some fields, such as the destination `Amount` of a [Payment transaction][], can be either type. Some fields only accept XRP specifically, such as the `Fee` field ([transaction cost](transaction-cost.html)).
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ The following table summarizes some of the differences between XRP and [issued c
|
||||
|
||||
| XRP | Issued Currencies |
|
||||
|:---------------------------------------------------------|:------------------|
|
||||
| Has no issuer. | Always issued by an XRP Ledger account |
|
||||
| Specified as a string. | Specified as an object |
|
||||
| Has no issuer. | Always issued by an XRP Ledger account. |
|
||||
| Specified as a string. | Specified as an object. |
|
||||
| Tracked in [accounts](accountroot.html). | Tracked in [trust lines](ripplestate.html). |
|
||||
| Can never be created; can only be destroyed. | Can be issued or redeemed freely. |
|
||||
| Minimum value: `0`. (Cannot be negative.) | Minimum value: `-9999999999999999e80`. Minimum nonzero absolute value: `1000000000000000e-96`.
|
||||
| Maximum value `100000000000` (1<sup>11</sup>) XRP. That's `100000000000000000` (10<sup>17</sup>) "drops". | Maximum value `9999999999999999e80` |
|
||||
| Maximum value `100000000000` (1<sup>11</sup>) XRP. That's `100000000000000000` (10<sup>17</sup>) "drops". | Maximum value `9999999999999999e80`. |
|
||||
| Precise to the nearest "drop" (0.000001 XRP) | 15 decimal digits of precision. |
|
||||
| Can't be [frozen](freezes.html). | The issuer can [freeze](freezes.html) balances. |
|
||||
| No transfer fees; XRP-to-XRP payments are always direct. | Can take indirect [paths](paths.html) with each issuer charging a percentage [transfer fee](transfer-fees.html). |
|
||||
@@ -88,6 +88,8 @@ The issued currency format can store a wide variety of assets, including those t
|
||||
|
||||
When sending issued currency amounts in the XRP Ledger's peer-to-peer network, servers [serialize](serialization.html) the amount to a 64-bit binary value.
|
||||
|
||||
**Note:** The XRP Ledger does not support issued currencies that are not [fungible](https://en.wikipedia.org/wiki/Fungibility). It also does not support limiting an issued currency to whole number amounts only. All issued currencies in the XRP Ledger are always divisible down to the minimum amount.
|
||||
|
||||
## Currency Codes
|
||||
[Currency Code]: #currency-codes
|
||||
|
||||
|
||||
@@ -224,12 +224,12 @@ The following diagram shows the serialization formats for both XRP amounts and i
|
||||
|
||||

|
||||
|
||||
The XRP Ledger uses 64 bits to serialize the numeric amount of an issued currency. (This is the `value` field of a currency amount object in JSON format.) This consists of a "not XRP" bit, a sign bit, significant digits, and an exponent, in order:
|
||||
The XRP Ledger uses 64 bits to serialize the numeric amount of an issued currency. (In JSON format, the numeric amount is the `value` field of a currency amount object.) In binary format, the numeric amount consists of a "not XRP" bit, a sign bit, significant digits, and an exponent, in order:
|
||||
|
||||
1. The first (most significant) bit for an issued currency amount is `1` to indicate that it is not an XRP amount. (XRP amounts always have the most significant bit set to `0` to distinguish them from this format.)
|
||||
2. The sign bit indicates whether the amount is positive or negative. Unlike standard [two's complement](https://en.wikipedia.org/wiki/Two%27s_complement) integers, `1` indicates **positive** in the XRP Ledger format, and `0` indicates negative.
|
||||
3. The next 8 bits represent the exponent as an unsigned integer. The exponent indicates the scale (what power of 10 the significant digits should be multiplied by) in the range -96 to +80 (inclusive). However, when serializing, we add 97 to the exponent to make it possible to serialize as an unsigned integer. Thus, a serialized value of `1` indicates an exponent of `-96`, a serialized value of `177` indicates an exponent of 80, and so on.
|
||||
4. The remaining 54 bits represent the significant digits as an unsigned integer. When serializing, this value is normalized to the range 10<sup>15</sup> (`1000000000000000`) to 10<sup>16</sup>-1 (`9999999999999999`) inclusive, except for the special case of the value 0. There is a special case for the value 0. In this case, the sign bit, exponent, and mantissa are all zeroes, so the 64-bit value is serialized as `0x8000000000000000000000000000000000000000`.
|
||||
4. The remaining 54 bits represent the significant digits as an unsigned integer. When serializing, this value is normalized to the range 10<sup>15</sup> (`1000000000000000`) to 10<sup>16</sup>-1 (`9999999999999999`) inclusive, except for the special case of the value 0. In the special case for 0, the sign bit, exponent, and mantissa are all zeroes, so the 64-bit value is serialized as `0x8000000000000000000000000000000000000000`.
|
||||
|
||||
The numeric amount is serialized alongside the [currency code][] and issuer to form a full [issued currency amount](#amount-fields).
|
||||
|
||||
@@ -240,7 +240,7 @@ At a protocol level, currency codes in the XRP Ledger are arbitrary 160-bit valu
|
||||
- The currency code `0x0000000000000000000000005852500000000000` is **always disallowed**. (This is the "standard format" for an issued currency with code "XRP".)
|
||||
- The currency code `0x0000000000000000000000000000000000000000` (all zeroes) is **generally disallowed**. Usually, XRP amounts are not specified with currency codes. However, this code is used to indicate XRP in rare cases where a field must specify a currency code for XRP.
|
||||
|
||||
The [`rippled` APIs](rippled-apis.html) support a **standard format** for translating three-character ASCII codes to 160-bit hex values as follows:
|
||||
The [`rippled` APIs](rippled-api.html) support a **standard format** for translating three-character ASCII codes to 160-bit hex values as follows:
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ Each member of the `books` array, if provided, is an object with the following f
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------|:--------|:----------------------------------------------------|
|
||||
| `taker_gets` | Object | Specification of which currency the account taking the offer would receive, as a [currency object with no amount](basic-data-types.html#specifying-currencies-without-amounts). |
|
||||
| `taker_pays` | Object | Specification of which currency the account taking the offer would pay, as a [currency object with no amount](basic-data-types.html#specifying-currencies-without-amounts). |
|
||||
| `taker` | String | Unique account address to use as a perspective for viewing offers, in the XRP Ledger's [base58][] format. (This affects the funding status and fees of offers.) |
|
||||
| `snapshot` | Boolean | (Optional, defaults to false) If true, return the current state of the order book once when you subscribe before sending updates |
|
||||
| `both` | Boolean | (Optional, defaults to false) If true, return both sides of the order book. |
|
||||
| `taker_gets` | Object | Specification of which currency the account taking the Offer would receive, as a [currency object with no amount](currency-formats.html#specifying-currencies-without-amounts). |
|
||||
| `taker_pays` | Object | Specification of which currency the account taking the Offer would pay, as a [currency object with no amount](currency-formats.html#specifying-currencies-without-amounts). |
|
||||
| `taker` | String | Unique [account address](accounts.html) to use as a perspective for viewing offers, in the XRP Ledger's [base58][] format. (This affects the funding status and fees of [Offers](offers.html).) |
|
||||
| `snapshot` | Boolean | _(Optional)_ If `true`, return the current state of the order book once when you subscribe before sending updates. The default is `false`. |
|
||||
| `both` | Boolean | _(Optional)_ If `true`, return both sides of the order book. The default is `false`. |
|
||||
|
||||
## Response Format
|
||||
|
||||
|
||||
@@ -278,6 +278,9 @@ targets:
|
||||
"rippled-server-modes.html#public-hubs": "rippled-server-modes.html#公開ハブ"
|
||||
"peer-protocol.html#peer-discovery": "peer-protocol.html#ピア発見"
|
||||
"ledgers.html#tree-format": "ledgers.html#ツリーの形式"
|
||||
# Fix links from untranslated currency_codes snippet
|
||||
"currency-formats.html#standard-currency-codes": "currency-formats.html#標準通貨コード"
|
||||
"currency-formats.html#nonstandard-currency-codes": "currency-formats.html#非標準通貨コード"
|
||||
|
||||
|
||||
- name: xrp-api-only
|
||||
|
||||
Reference in New Issue
Block a user