Update escrow documentation

This commit is contained in:
Maria Shodunke
2025-10-01 14:08:52 +01:00
parent 30f416780d
commit 7cdf35f032
19 changed files with 125 additions and 51 deletions

View File

@@ -326,7 +326,7 @@ export function AmendmentDisclaimer(props: {
) : (
<>
{translate("component.amendment-status.updates.1", "The ")}{link()}
{translate("component.amendment-status.updates.2", "updates this.")}
{translate("component.amendment-status.updates.2", " updates this.")}
{" "}
<AmendmentBadge amendment={amendmentStatus} />
</>

View File

@@ -1,6 +1,4 @@
---
html: escrow.html
parent: payment-types.html
seo:
description: Escrow holds funds until specified conditions are met.
labels:
@@ -10,7 +8,20 @@ labels:
Traditionally, an escrow is a contract between two parties to facilitate financial transactions. An impartial third party receives and holds funds, and only releases them to the intended recipient when conditions specified by the contract are met. This method ensures both parties meet their obligations.
The XRP Ledger takes escrow a step further, replacing the third party with an automated system built into the ledger. An escrow locks up XRP or fungible tokens, which can't be used or destroyed until conditions are met.
The XRP Ledger takes escrow a step further, replacing the third party with an automated system built into the ledger. An escrow locks up XRP or fungible tokens ([see Token Escrow](#token-escrow)), which can't be used or destroyed until conditions are met.
{% amendment-disclaimer name="Escrow" /%}
{% amendment-disclaimer name="TokenEscrow" mode="updated" /%}
## Token Escrow
The [TokenEscrow amendment][] extends escrow functionality to fungible tokens, which means [Trust Line Tokens](../../concepts/tokens/fungible-tokens/trust-line-tokens.md) and [Multi-Purpose Tokens (MPTs)](../../concepts/tokens/fungible-tokens/multi-purpose-tokens.md#transferability-controls) can be held in escrow.
For Trust Line Tokens to be held in escrow, the issuing account must have the **Allow Trust Line Locking** flag enabled, which allows tokens issued by the account to be held in escrow. For MPTs, the issuer needs to enable the **Can Escrow** and **Can Transfer** flags when creating the token issuance, so that the tokens can be held in escrow and transferred.
While issuers can't create escrows with their own issued tokens, they can serve as recipients. When an issuer receives escrowed tokens, this effectively functions as a redemption process, allowing tokens to return to their source.
If a token requires authorization, both the sender and recipient must be pre-authorized by the issuer to hold the token before creating or finishing an escrow, respectively.
## Types of Escrow
@@ -18,21 +29,27 @@ The XRP Ledger supports three types of escrow:
- **Time-based Escrow:** Funds only become available after a certain amount of time passes.
- **Conditional Escrow:** This escrow is created with a corresponding condition and fulfillment. The condition serves as a lock on the funds and won't release until the correct fulfillment key is provided.
- **Combination Escrow:** This escrow combines the features of time-based and conditional escrow. The escrow is completely inaccessible until the specified time passes, after which the funds can be release by providing the correct fulfillment.
- **Combination Escrow:** This escrow combines the features of time-based and conditional escrow. The escrow is completely inaccessible until the specified time passes, after which the funds can be released by providing the correct fulfillment.
## Escrow Lifecycle
The lifecycle of an escrow is as follows:
1. The sender creates an escrow using the `EscrowCreate` transaction. This transaction defines:
- An number of XRP or fungible tokens to lock up.
- The conditions to release the XRP or fungible tokens.
- The recipient of the XRP or fungible tokens.
- An amount of XRP or fungible tokens to lock up.
- The conditions to release the funds.
- For **XRP escrows** this can include a time when the escrow can complete, a cryptographic condition that must be fulfilled, and optionally a time when the escrow expires.
- For **token escrows** similar conditions apply, but an expiration time is _mandatory_.
- The recipient of the funds. Any applicable transfer rates or fees are captured at creation time and will apply when the escrow completes, ensuring predictability for the recipient.
2. When the transaction is processed, the XRP Ledger creates an `Escrow` object that holds the escrowed XRP or fungible token.
2. When the transaction is processed successfully, the XRP Ledger creates an `Escrow` object that holds the escrowed funds.
3. The recipient sends an `EscrowFinish` transaction to deliver the XRP or fungible tokens. If the conditions have been met, this destroys the `Escrow` object and delivers the XRP or fungible tokens to the recipient.
3. The recipient sends an `EscrowFinish` transaction to deliver the funds. If the conditions are met, this destroys the `Escrow` object and delivers the funds to the recipient. Additionally, any missing trust lines or MPT entries may be auto-created for recipients if authorization isn't required.
{% admonition type="info" name="Note" %}If the escrow has an expiration time and isn't successfully finished before then, the escrow becomes expired. An expired escrow remains in the ledger until an `EscrowCancel` transaction cancels it, destroying the `Escrow` object and returning the escrowed XRP or fungible tokens to the sender.{% /admonition %}
{% admonition type="info" name="Note" %}
If the escrow has an expiration time and isn't successfully finished before then, the escrow becomes expired. An expired escrow remains in the ledger until an `EscrowCancel` transaction cancels it, destroying the `Escrow` object and returning the escrowed funds to the sender.
{% /admonition %}
## Escrow States
@@ -42,13 +59,16 @@ The following diagram shows the states an Escrow can progress through:
The diagram shows three different cases for three possible combinations of the escrow's "finish-after" time (`FinishAfter` field), crypto-condition (`Condition` field), and expiration time (`CancelAfter` field):
{% admonition type="info" name="Note" %}
While XRP escrows can sometimes exist without an expiration time, token escrows must **always** have an expiration time (`CancelAfter` field).
{% /admonition %}
- **Time-based Escrow (left):** With only a finish-after time, the escrow is created in the **Held** state. After the specified time has passed, it becomes **Ready** and anyone can finish it. If the escrow has an expiration time and no one finishes it before that time passes, then the escrow becomes **Expired**. In the expired state, an escrow cannot be finished, and anyone can cancel it. If the escrow does not have a `CancelAfter` field, it never expires and cannot be canceled.
- **Combination Escrow (center):** If the escrow specifies both a crypto-condition (`Condition` field) _and_ a "finish-after" time (`FinishAfter` field), the escrow is **Held** until its finish-after time has passed. Then it becomes **Conditionally Ready**, and can finish it if they supply the correct fulfillment to the crypto-condition. If the escrow has an expiration time (`CancelAfter` field), and no one finishes it before that time passes, then the escrow becomes **Expired**. In the expired state, an escrow cannot be finished, and anyone can cancel it. If the escrow does not have a `CancelAfter` field, it never expires and cannot be canceled.
- **Conditional Escrow (right):** If the escrow specifies a crypto-condition (`Condition` field) and not a finish-after time, the escrow becomes **Conditionally Ready** immediately when it is created. During this time, anyone can finish the escrow, but only if they supply the correct fulfillment to the crypto-condition. If no one finishes the escrow before its expiration time (`CancelAfter` field), the escrow becomes **Expired**. (An escrow without a finish-after time _must_ have an expiration time.) In the expired state, the escrow can no longer be finished, and anyone can cancel it.
## Limitations
- The costs can make it infeasible for small amounts.
@@ -57,7 +77,12 @@ The diagram shows three different cases for three possible combinations of the e
- You can't create an escrow with past time values.
- Timed releases and expirations resolve according to [ledger close times](../ledgers/ledger-close-times.md). In practice, actual release and expiration times can vary by about five seconds as ledgers close.
- The only supported crypto-condition type is PREIMAGE-SHA-256.
- If a token holder is deep frozen (Trust Line Tokens) or locked (MPTs), they cannot finish an escrow to receive tokens, but they can still cancel an escrow to return tokens to the sender.
{% admonition type="info" name="Note" %}
Individual or global freezes for Trust Line Tokens don't prevent escrow completion.
{% /admonition %}
- For tokens requiring authorization, both sender and recipient must be pre-authorized by the issuer before creating or finishing the escrow, respectively. Authorization cannot be granted during the escrow completion process.
## EscrowFinish Transaction Cost
@@ -65,7 +90,7 @@ When using crypto-conditions, the EscrowFinish transaction must pay a [higher tr
The additional transaction cost required is proportional to the size of the fulfillment. If the transaction is [multi-signed](../accounts/multi-signing.md), the cost of multi-signing is added to the cost of the fulfillment.
Currently, an EscrowFinish with a fulfillment requires a minimum transaction cost of **330 [drops of XRP](../../references/protocol/data-types/basic-data-types.md#specifying-currency-amounts)** plus 10 drops per 16 bytes in the size of the fulfillment**.
Currently, an EscrowFinish with a fulfillment requires a minimum transaction cost of **330 [drops of XRP](../../references/protocol/data-types/basic-data-types.md#specifying-currency-amounts)** plus 10 drops per 16 bytes in the size of the fulfillment.
{% admonition type="info" name="Note" %}The above formula is based on the assumption that the reference cost of a transaction is 10 drops of XRP.{% /admonition %}

View File

@@ -1,22 +1,22 @@
---
seo:
description: Payment Channels enable fast, asynchronous payments that can be divided into very small increments and settled later.
description: Payment Channels enable fast, asynchronous XRP payments that can be divided into very small increments and settled later.
labels:
- Payment Channels
- Smart Contracts
---
# Payment Channels
Payment Channels are an advanced feature for sending "asynchronous" payments that can be divided into very small increments and settled later.
Payment Channels are an advanced feature for sending "asynchronous" XRP payments that can be divided into very small increments and settled later.
The XRP or fungible tokens for a payment channel are set aside temporarily. The sender creates _Claims_ against the channel, which the recipient verifies without sending an XRP Ledger transaction or waiting for a new ledger version to be approved by [consensus](../consensus-protocol/index.md). (This is an _asynchronous_ process because it happens separate from the usual pattern of getting transactions approved by consensus.) At any time, the recipient can _redeem_ a Claim to receive an amount of XRP or fungible tokens authorized by that Claim. Settling a Claim like this uses a standard XRP Ledger transaction, as part of the usual consensus process. This single transaction can encompass any number of transactions guaranteed by smaller Claims.
The XRP for a payment channel is set aside temporarily. The sender creates _Claims_ against the channel, which the recipient verifies without sending an XRP Ledger transaction or waiting for a new ledger version to be approved by [consensus](../consensus-protocol/index.md). (This is an _asynchronous_ process because it happens separate from the usual pattern of getting transactions approved by consensus.) At any time, the recipient can _redeem_ a Claim to receive an amount of XRP authorized by that Claim. Settling a Claim like this uses a standard XRP Ledger transaction, as part of the usual consensus process. This single transaction can encompass any number of transactions guaranteed by smaller Claims.
Because Claims can be verified individually but settled in bulk later, payment channels make it possible to conduct transactions at a rate only limited by the participants' ability to create and verify the digital signatures of those Claims. This limit is primarily based on the speed of the participants' hardware and the complexity of the signature algorithms. For maximum speed, use Ed25519 signatures, which are faster than the XRP Ledger's default secp256k1 ECDSA signatures. Research has [demonstrated the ability to create over Ed25519 100,000 signatures per second and to verify over 70,000 per second](https://ed25519.cr.yp.to/ed25519-20110926.pdf) on commodity hardware in 2011.
## Why Use Payment Channels
The process of using a payment channel always involves two parties, a payer and a payee. The payer is an individual person or institution using the XRP Ledger who is a customer of the payee. The payee is a person or business who receives XRP or fungible tokens as payment for goods or services.
The process of using a payment channel always involves two parties, a payer and a payee. The payer is an individual person or institution using the XRP Ledger who is a customer of the payee. The payee is a person or business who receives XRP as payment for goods or services.
Payment Channels do not intrinsically specify anything about what you can buy and sell with them. However, the types of goods and services that are a good fit for payment channels are:

View File

@@ -57,14 +57,13 @@ The request includes the following parameters:
| Field | Type | Required? | Description |
|:----------------------|:---------------------|:----------|-------------|
| `account` | String - [Address][] | Yes | Look up channels where this account is the channel's owner/source. |
| `amount` | Object or String | No | The total amount allocated to this channel. |
| `balance` | Object or String | No | The total amount paid out from this channel, as of the ledger version used. (You can calculate the amount left in the channel by subtracting `balance` from `amount`). |
| `amount` | Object or String | No | The total amount of XRP, in drops, allocated to this channel. |
| `balance` | Object or String | No | The total amount of XRP, in drops, paid out from this channel, as of the ledger version used. (You can calculate the amount left in the channel by subtracting `balance` from `amount`). |
| `destination_account` | String - [Address][] | No | A second account; if provided, filter results to payment channels whose destination is this account. |
| `ledger_hash` | String | No | The unique hash of the ledger version to use. (See [Specifying Ledgers][]) |
| `ledger_index` | Number or String | No | The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
| `limit` | Number | No | Limit the number of transactions to retrieve. Cannot be less than 10 or more than 400. Positive values outside this range are replaced with the closest valid option. The default is 200. |
| `marker` | [Marker][] | No | Value from a previous paginated response. Resume retrieving data where that response left off. |
| `transfer_rate` | Number | No | The fee to charge when users make claims on a payment channel, initially set on the creation of a payment channel and updated on subsequent funding or claim transactions. |
## Response Format
@@ -175,8 +174,8 @@ Each Channel Object has the following fields:
| Field | Type | Description |
|:----------------------|:-----------------|:----------------------------------|
| `account` | String | The owner of the channel, as an [Address][]. |
| `amount` | Object or String | The total amount of [XRP, in drops][] or fungible tokens allocated to this channel. |
| `balance` | String | The total amount of [XRP, in drops][] or fungible tokens paid out from this channel, as of the ledger version used. (You can calculate the amount left in the channel by subtracting `balance` from `amount`.) |
| `amount` | Object or String | The total amount of [XRP, in drops][] allocated to this channel. |
| `balance` | String | The total amount of [XRP, in drops][] paid out from this channel, as of the ledger version used. (You can calculate the amount left in the channel by subtracting `balance` from `amount`.) |
| `channel_id` | String | A unique ID for this channel, as a 64-character hexadecimal string. This is also the [ID of the channel object](../../../protocol/ledger-data/ledger-entry-types/paychannel.md#paychannel-id-format) in the ledger's state data. |
| `destination_account` | String | The destination account of the channel, as an [Address][]. Only this account can receive the `amount` in the channel while it is open. |
| `settle_delay` | Unsigned Integer | The number of seconds the payment channel must stay open after the owner of the channel requests to close it. |

View File

@@ -65,8 +65,6 @@ The request accepts the following parameters:
| `limit` | Number | No | Limit the number of trust lines to retrieve. The server may return less than the specified limit, even if there are more pages of results. Must be within the inclusive range 10 to 400. Positive values outside this range are replaced with the closest valid option. The default is 200. |
| `marker` | [Marker][] | No | Value from a previous paginated response. Resume retrieving data where that response left off. |
| `peer` | String - [Address][] | No | A second account; if provided, filter results to trust lines connecting the two accounts. |
| `locked_balance` | Object | No | The total amount locked in payment channels or escrow. |
| `lock_count` | Number | No | the total number of lock balances on a RippleState ledger object. |
The following parameters are deprecated and may be removed without further notice: `ledger` and `peer_index`.

View File

@@ -7,7 +7,7 @@ labels:
# channel_authorize
[[Source]](https://github.com/XRPLF/rippled/blob/d4a56f223a3b80f64ff70b4e90ab6792806929ca/src/ripple/rpc/handlers/PayChanClaim.cpp#L41 "Source")
The `channel_authorize` method creates a signature that can be used to redeem a specific amount of XRP or fungible tokens from a payment channel.
The `channel_authorize` method creates a signature that can be used to redeem a specific amount of XRP from a payment channel.
{% amendment-disclaimer name="PayChan" /%}
@@ -65,7 +65,7 @@ The request includes the following parameters:
| `seed_hex` | String | _(Optional)_ The secret seed to use to sign the claim. This must be the same key pair as the public key specified in the channel. Must be in hexadecimal format. If provided, you must also specify the `key_type`. Cannot be used with `secret`, `seed`, or `passphrase`. |
| `passphrase` | String | _(Optional)_ A string passphrase to use to sign the claim. This must be the same key pair as the public key specified in the channel. The [key derived from this passphrase](../../../../concepts/accounts/cryptographic-keys.md#key-derivation) must match the public key specified in the channel. If provided, you must also specify the `key_type`. Cannot be used with `secret`, `seed`, or `seed_hex`. |
| `key_type` | String | _(Optional)_ The [signing algorithm](../../../../concepts/accounts/cryptographic-keys.md#signing-algorithms) of the cryptographic key pair provided. Valid types are `secp256k1` or `ed25519`. The default is `secp256k1`. |
| `amount` | Object or String | Cumulative amount of XRP, in drops, or fungible tokens to authorize. If the destination has already received a lesser amount from this channel, the signature created by this method can be redeemed for the difference. |
| `amount` | String | Cumulative amount of XRP, in drops, to authorize. If the destination has already received a lesser amount from this channel, the signature created by this method can be redeemed for the difference. |
The request **must** specify exactly one of `secret`, `seed`, `seed_hex`, or `passphrase`.

View File

@@ -9,7 +9,7 @@ labels:
# channel_verify
[[Source]](https://github.com/XRPLF/rippled/blob/d4a56f223a3b80f64ff70b4e90ab6792806929ca/src/ripple/rpc/handlers/PayChanClaim.cpp#L89 "Source")
The `channel_verify` method checks the validity of a signature that can be used to redeem a specific amount of XRP or fungible tokens from a payment channel.
The `channel_verify` method checks the validity of a signature that can be used to redeem a specific amount of XRP from a payment channel.
{% amendment-disclaimer name="PayChan" /%}
@@ -58,7 +58,7 @@ The request includes the following parameters:
| Field | Type | Description |
|-------|------|-------------|
| `amount` | Object or String | The amount of [XRP, in drops][], or fungible tokens the provided `signature` authorizes. |
| `amount` | String | The amount of [XRP, in drops][], that the provided `signature` authorizes. |
| `channel_id` | String | The Channel ID of the channel that provides the amount. This is a 64-character hexadecimal string. |
| `public_key` | String | The public key of the channel and the key pair that was used to create the signature, in hexadecimal or the XRP Ledger's [base58][] format. {% badge href="https://github.com/XRPLF/rippled/releases/tag/0.90.0" %}Updated in: rippled 0.90.0{% /badge %} |
| `signature` | String | The signature to verify, in hexadecimal. |

View File

@@ -88,6 +88,7 @@ AccountRoot objects can have the following flags combined in the `Flags` field:
| Flag Name | Hex Value | Decimal Value | Corresponding [AccountSet Flag](../../transactions/types/accountset.md#accountset-flags) | Description |
|-----------------------------------|--------------|-------------------|-----------------------------------|----|
| `lsfAllowTrustLineClawback` | `0x80000000` | 2147483648 | `asfAllowTrustLineClawback` | Enable [Clawback](../../../../concepts/tokens/fungible-tokens/clawing-back-tokens.md) for this account. {% amendment-disclaimer name="Clawback" /%} |
| `lsfAllowTrustLineLocking` | `0x40000000` | 1073741824 | `asfAllowTrustLineLocking` | Enable [Escrow](../../../../concepts/payment-types/escrow.md) for Trust Line Tokens issued by this account. {% amendment-disclaimer name="TokenEscrow" /%} |
| `lsfDefaultRipple` | `0x00800000` | 8388608 | `asfDefaultRipple` | Enable [rippling](../../../../concepts/tokens/fungible-tokens/rippling.md) on this addresses's trust lines by default. Required for issuing addresses; discouraged for others. |
| `lsfDepositAuth` | `0x01000000` | 16777216 | `asfDepositAuth` | This account has [DepositAuth](../../../../concepts/accounts/depositauth.md) enabled, meaning it can only receive funds from transactions it sends, and from [preauthorized](../../../../concepts/accounts/depositauth.md#preauthorization) accounts. {% amendment-disclaimer name="DepositAuth" /%} |
| `lsfDisableMaster` | `0x00100000` | 1048576 | `asfDisableMaster` | Disallows use of the master key to sign transactions for this account. |

View File

@@ -5,11 +5,12 @@ labels:
- Escrow
---
# Escrow
[[Source]](https://github.com/XRPLF/rippled/blob/f64cf9187affd69650907d0d92e097eb29693945/include/xrpl/protocol/detail/ledger_entries.macro#L329-L342 "Source")
[[Source]](https://github.com/XRPLF/rippled/blob/master/include/xrpl/protocol/detail/ledger_entries.macro#L344-L359 "Source")
An `Escrow` ledger entry represents an [escrow](../../../../concepts/payment-types/escrow.md), which holds XRP until specific conditions are met. You can create an escrow by sending an [EscrowCreate transaction][].
An `Escrow` ledger entry represents an [escrow](../../../../concepts/payment-types/escrow.md), which holds funds until specific conditions are met. You can create an escrow by sending an [EscrowCreate transaction][].
{% amendment-disclaimer name="Escrow" /%}
{% amendment-disclaimer name="TokenEscrow" mode="updated" /%}
## Example {% $frontmatter.seo.title %} JSON
@@ -39,9 +40,9 @@ In addition to the [common fields](../common-fields.md), {% code-page-name /%} e
| Name | JSON Type | [Internal Type][] | Required? | Description |
|:--------------------|:----------|:------------------|:----------|:-----------------------|
| `Account` | String | AccountID | Yes | The address of the owner (sender) of this escrow. This is the account that provided the XRP, and gets it back if the escrow is canceled. |
| `Amount` | Object or String | Amount | Yes | The amount to be delivered by the payment is escrow. |
| `CancelAfter` | Number | UInt32 | No | The escrow can be canceled if and only if this field is present _and_ the time it specifies has passed. Specifically, this is specified as [seconds since the Ripple Epoch][] and it "has passed" if it's earlier than the close time of the previous validated ledger. |
| `Account` | String | AccountID | Yes | The address of the owner (sender) of this escrow. This is the account that provided the funds, and gets it back if the escrow is canceled. |
| `Amount` | Object or String | Amount | Yes | The amount to be delivered by the payment in escrow. The amount can be XRP, or with the TokenEscrow amendment, a fungible token. {% amendment-disclaimer name="TokenEscrow" mode="updated" /%} |
| `CancelAfter` | Number | UInt32 | No | _(Optional for XRP escrows, but mandatory for token escrows)_ The escrow can be canceled if and only if this field is present _and_ the time it specifies has passed. Specifically, this is specified as [seconds since the Ripple Epoch][] and it "has passed" if it's earlier than the close time of the previous validated ledger. |
| `Condition` | String | Blob | No | A [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1), as hexadecimal. If present, the [EscrowFinish transaction][] must contain a fulfillment that satisfies this condition. |
| `Destination` | String | AccountID | Yes | The destination address where the XRP is paid if the escrow is successful. |
| `DestinationNode` | String | UInt64 | No | A hint indicating which page of the destination's owner directory links to this object, in case the directory consists of multiple pages. Omitted on escrows created before enabling the [fix1523 amendment][]. |
@@ -52,7 +53,8 @@ In addition to the [common fields](../common-fields.md), {% code-page-name /%} e
| `PreviousTxnID` | String | UInt256 | Yes | The identifying hash of the transaction that most recently modified this entry. |
| `PreviousTxnLgrSeq` | Number | UInt32 | Yes | The [index of the ledger][Ledger Index] that contains the transaction that most recently modified this entry. |
| `SourceTag` | Number | UInt32 | No | An arbitrary tag to further specify the source for this escrow, such as a hosted recipient at the owner's address. |
| `TransferRate` | Number | UInt32 | No | The fee to charge when users finish an escrow, initially set on the creation of an escrow contract and updated on subsequent finish transactions. |
| `TransferRate` | Number | UInt32 | No | The transfer rate or fee to charge when users finish an escrow, locked at the creation of an escrow contract and used during settlement. Applicable to Trust Line Tokens and MPTs only. {% amendment-disclaimer name="TokenEscrow" /%} |
| `IssuerNode` | Number | UInt64 | No | The ledger index of the issuer's directory node associated with the `Escrow`. Used when the issuer is neither the source nor destination account. {% amendment-disclaimer name="TokenEscrow" /%} |
## {% $frontmatter.seo.title %} Flags

View File

@@ -41,6 +41,7 @@ In addition to the [common fields](../common-fields.md), {% code-page-name /%} e
| `AssetScale` | Number | UInt8 | Yes | Where to put the decimal place when displaying amounts of this MPT. More formally, the asset scale is a non-negative integer (0, 1, 2, …) such that one standard unit equals 10^(-scale) of a corresponding fractional unit. For example, if a US Dollar Stablecoin has an asset scale of _2_, then 1 unit of that MPT would equal 0.01 US Dollars. This indicates to how many decimal places the MPT can be subdivided. The default is `0`, meaning that the MPT cannot be divided into smaller than 1 unit. |
| `MaximumAmount` | String - Number | UInt64 | No | The maximum number of MPTs that can exist at one time. If omitted, the maximum is currently limited to 2<sup>63</sup>-1. |
| `OutstandingAmount` | String - Number | UInt64 | Yes | The total amount of MPTs of this issuance currently in circulation. This value increases when the issuer sends MPTs to a non-issuer, and decreases whenever the issuer receives MPTs. |
| `LockedAmount` | String - Number | UInt64 | No | The amount of tokens currently locked up (for example, in escrow). {% amendment-disclaimer name="TokenEscrow" /%} |
| `TransferFee` | Number | UInt16 | Yes | This value specifies the fee, in tenths of a basis point, charged by the issuer for secondary sales of the token, if such sales are allowed at all. Valid values for this field are between 0 and 50,000 inclusive. A value of 1 is equivalent to 1/10 of a basis point or 0.001%, allowing transfer rates between 0% and 50%. A `TransferFee` of 50,000 corresponds to 50%. The default value for this field is 0. Any decimals in the transfer fee are rounded down. The fee can be rounded down to zero if the payment is small. Issuers should make sure that their MPT's `AssetScale` is large enough. |
| `MPTokenMetadata` | String - Hexadecimal | Blob | Yes | Arbitrary metadata about this issuance, in hex format. The limit for this field is 1024 bytes. |
| `OwnerNode` | String - Hexadecimal | UInt64 | Yes | A hint indicating which page of the owner directory links to this entry, in case the directory consists of multiple pages. |

View File

@@ -42,8 +42,8 @@ In addition to the [common fields](../common-fields.md), {% code-page-name /%} e
| Name | JSON Type | [Internal Type][] | Required? | Description |
|:--------------------|:----------|:------------------|:----------|:-----------------------|
| `Account` | String | AccountID | Yes | The source address that owns this payment channel. This comes from the sending address of the transaction that created the channel. |
| `Amount` | String | Amount | Yes | Total [XRP, in drops][] or tokens, that have been allocated to this channel. This includes amounts that have been paid to the destination address. This is initially set by the transaction that created the channel and can be increased if the source address sends a `PaymentChannelFund` transaction. |
| `Balance` | Object or String | Amount | Yes | Total already paid out by the channel. The difference between this value and the `Amount` field is how much can still be paid to the destination address with `PaymentChannelClaim` transactions. If the channel closes, the remaining difference is returned to the source address. |
| `Amount` | String | Amount | Yes | Total [XRP, in drops][], that have been allocated to this channel. This includes amounts that have been paid to the destination address. This is initially set by the transaction that created the channel and can be increased if the source address sends a `PaymentChannelFund` transaction. |
| `Balance` | String | Amount | Yes | Total [XRP, in drops][] already paid out by the channel. The difference between this value and the `Amount` field is how much can still be paid to the destination address with `PaymentChannelClaim` transactions. If the channel closes, the remaining difference is returned to the source address. |
| `CancelAfter` | Number | UInt32 | No | The immutable expiration time for this payment channel, in [seconds since the Ripple Epoch][]. This channel is expired if this value is present and smaller than the previous ledger's [`close_time` field](../ledger-header.md). This is optionally set by the transaction that created the channel, and cannot be changed. |
| `Destination` | String | AccountID | Yes | The destination address for this payment channel. While the payment channel is open, this address is the only one that can receive XRP from the channel. This comes from the `Destination` field of the transaction that created the channel. |
| `DestinationTag` | Number | UInt32 | No | An arbitrary tag to further specify the destination for this payment channel, such as a hosted recipient at the destination address. |
@@ -56,7 +56,6 @@ In addition to the [common fields](../common-fields.md), {% code-page-name /%} e
| `PublicKey` | String | Blob | Yes | Public key, in hexadecimal, of the key pair that can be used to sign claims against this channel. This can be any valid secp256k1 or Ed25519 public key. This is set by the transaction that created the channel and must match the public key used in claims against the channel. The channel source address can also send XRP from this channel to the destination without signed claims. |
| `SettleDelay` | Number | UInt32 | Yes | Number of seconds the source address must wait to close the channel if it still has any XRP in it. Smaller values mean that the destination address has less time to redeem any outstanding claims after the source address requests to close the channel. Can be any value that fits in a 32-bit unsigned integer (0 to 2^32-1). This is set by the transaction that creates the channel. |
| `SourceTag` | Number | UInt32 | No | An arbitrary tag to further specify the source for this payment channel, such as a hosted recipient at the owner's address. |
| `TransferRate` | Number | UInt32 | No | The fee to charge when users make claims on a payment channel, initially set on the creation of a payment channel and updated on subsequent funding or claim transactions. |
## Channel Expiration

View File

@@ -58,8 +58,6 @@ In addition to the [common fields](../common-fields.md), {% code-page-name /%} e
| `HighQualityIn` | Number | UInt32 | No | The inbound quality set by the high account, as an integer in the implied ratio `HighQualityIn`:1,000,000,000. As a special case, the value 0 is equivalent to 1 billion, or face value. |
| `HighQualityOut` | Number | UInt32 | No | The outbound quality set by the high account, as an integer in the implied ratio `HighQualityOut`:1,000,000,000. As a special case, the value 0 is equivalent to 1 billion, or face value. |
| `LedgerEntryType` | String | UInt16 | Yes | The value `0x0072`, mapped to the string `RippleState`, indicates that this is a RippleState entry. |
| `LockCount` | Object or String | Amount | No | The total number of lock balances on a `RippleState` ledger object. |
| `LockedBalance` | Object or String | Amount | No | The total number of locked tokens on a `RippleState` ledger object. |
| `LowLimit` | Object | Amount | Yes | The limit that the low account has set on the trust line. The `issuer` is the address of the low account that set this limit. |
| `LowNode` | String | UInt64 | Yes | (Omitted in some historical ledgers) A hint indicating which page of the low account's owner directory links to this entry, in case the directory consists of multiple pages. |
| `LowQualityIn` | Number | UInt32 | No | The inbound quality set by the low account, as an integer in the implied ratio `LowQualityIn`:1,000,000,000. As a special case, the value 0 is equivalent to 1 billion, or face value. |

View File

@@ -73,6 +73,7 @@ The available AccountSet flags are:
|:----------------------------------|:--------------|:--------------|
| `asfAccountTxnID` | 5 | Track the ID of this account's most recent transaction. Required for [`AccountTxnID`](../common-fields.md#accounttxnid) |
| `asfAllowTrustLineClawback` | 16 | Allow account to claw back tokens it has issued. _(Requires the Clawback amendment.)_ Can only be set if the account has an empty owner directory (no trust lines, offers, escrows, payment channels, checks, or signer lists). After you set this flag, it cannot be reverted. The account permanently gains the ability to claw back issued assets on trust lines. |
| `asfAllowTrustLineLocking` | 17 | Allow Trust Line tokens issued by this account to be held in escrow. If not set, attempts to create escrows with this account's tokens will fail. After you set this flag, it cannot be disabled. {% amendment-disclaimer name="TokenEscrow" /%} |
| `asfAuthorizedNFTokenMinter` | 10 | Enable to allow another account to mint non-fungible tokens (NFTokens) on this account's behalf. Specify the authorized account in the `NFTokenMinter` field of the [AccountRoot](../../ledger-data/ledger-entry-types/accountroot.md) object. To remove an authorized minter, enable this flag and omit the `NFTokenMinter` field. {% amendment-disclaimer name="NonFungibleTokensV1_1" /%} |
| `asfDefaultRipple` | 8 | Enable [rippling](../../../../concepts/tokens/fungible-tokens/rippling.md) on this account's trust lines by default. |
| `asfDepositAuth` | 9 | Enable [Deposit Authorization](../../../../concepts/accounts/depositauth.md) on this account. {% amendment-disclaimer name="DepositAuth" /%} |

View File

@@ -37,6 +37,19 @@ Any account may submit an EscrowCancel transaction.
* If the corresponding [EscrowCreate transaction][] did not specify a `CancelAfter` time, the EscrowCancel transaction fails.
* Otherwise the EscrowCancel transaction fails if the `CancelAfter` time is after the close time of the most recently-closed ledger.
## Error Cases
Besides errors that can occur for all transactions, {% $frontmatter.seo.title %} transactions can result in the following [transaction result codes](../transaction-results/index.md):
## EscrowFinish Errors
| Error Code | Description |
|:------------------------- |:------------|
| `tecNO_AUTH` | The transaction failed because authorization requirements were not met. For example, the issuer requires authorization and the sender is not authorized. |
| `tecNO_LINE` | The sender does not have a trust line with the issuer. For Trust Line Tokens only. |
| `tecNO_ENTRY` | The sender does not hold the MPT. |
| `tecINSUFFICIENT_RESERVE` | Unable to create a trust line or MPToken due to lack of reserves. |
## See Also
- [Escrow entry][]

View File

@@ -9,7 +9,18 @@ labels:
Set aside funds in an [escrow](../../../../concepts/payment-types/escrow.md) that delivers them to a predetermined recipient when certain conditions are met. If the escrow has an expiration, the funds can also be returned to the sender after it expires.
{% admonition type="info" name="Fungible Tokens" %}
To escrow fungible tokens you must take note of the following:
- Trust Line Tokens must have the **Allow Trust Line Locking** flag enabled on their account.
- Multi-Purpose-Tokens (MPTs) must have both the **Can Escrow** and **Can Transfer** flags enabled.
- All token escrows must specify a **Cancel After** time.
- If the token requires **authorization**, both sender and recipient must be pre-authorized by the issuer.
{% /admonition %}
{% amendment-disclaimer name="Escrow" /%}
{% amendment-disclaimer name="TokenEscrow" mode="updated" /%}
## Example {% $frontmatter.seo.title %} JSON
@@ -34,29 +45,41 @@ Set aside funds in an [escrow](../../../../concepts/payment-types/escrow.md) tha
| Field | JSON Type | [Internal Type][] | Description |
|:-----------------|:----------|:------------------|:--------------------------|
| `Amount` | Object or String | Amount | Amount of XRP or fungible tokens to deduct from the sender's balance and escrow. Once escrowed, the payment can either go to the `Destination` address (after the `FinishAfter` time) or be returned to the sender (after the `CancelAfter` time). |
| `Destination` | String | AccountID | Address to receive escrowed XRP. |
| `CancelAfter` | Number | UInt32 | _(Optional)_ The time, in [seconds since the Ripple Epoch][], when this escrow expires. This value is immutable; the funds can only be returned to the sender after this time. |
| `FinishAfter` | Number | UInt32 | _(Optional)_ The time, in [seconds since the Ripple Epoch][], when the escrowed XRP can be released to the recipient. This value is immutable, and the funds can't be accessed until this time. |
| `Condition` | String | Blob | _(Optional)_ Hex value representing a [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1). The funds can only be delivered to the recipient if this condition is fulfilled. If the condition is not fulfilled before the expiration time specified in the `CancelAfter` field, the XRP can only revert to the sender. |
| `Amount` | Object or String | Amount | Amount of XRP, in drops, or fungible tokens to deduct from the sender's balance and escrow. Once escrowed, the payment can either go to the `Destination` address (after the `FinishAfter` time) or be returned to the sender (after the `CancelAfter` time). {% amendment-disclaimer name="TokenEscrow" mode="updated" /%} |
| `Destination` | String | AccountID | Address to receive escrowed funds. |
| `CancelAfter` | Number | UInt32 | _(Optional for XRP escrows, but mandatory for token escrows)_ The time, in [seconds since the Ripple Epoch][], when this escrow expires. This value is immutable; the funds can only be returned to the sender after this time. Required if the token is a fungible token. |
| `FinishAfter` | Number | UInt32 | _(Optional)_ The time, in [seconds since the Ripple Epoch][], when the escrowed funds can be released to the recipient. This value is immutable, and the funds can't be accessed until this time. |
| `Condition` | String | Blob | _(Optional)_ Hex value representing a [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1). The funds can only be delivered to the recipient if this condition is fulfilled. If the condition is not fulfilled before the expiration time specified in the `CancelAfter` field, the funds can only revert to the sender. |
| `DestinationTag` | Number | UInt32 | _(Optional)_ Arbitrary tag to further specify the destination for this escrowed payment, such as a hosted recipient at the destination address. |
You must specify one of the following combinations of fields:
| Summary | `FinishAfter` | `Condition` | `CancelAfter` |
|-----------------------------------|---------------|-------------|---------------|
| Time-based | ✅ | | |
| Time-based (XRP only) | ✅ | | |
| Time-based with expiration | ✅ | | ✅ |
| Timed conditional | ✅ | ✅ | |
| Timed conditional (XRP only) | ✅ | ✅ | |
| Timed conditional with expiration | ✅ | ✅ | ✅ |
| Conditional with expiration | | ✅ | ✅ |
It is not possible to create a conditional escrow with no expiration, but you can specify an expiration that is very far in the future.
{% admonition type="info" name="Note" %}
Before the [fix1571 amendment][] became enabled on 2018-06-19, it was possible to create an escrow with `CancelAfter` only. These escrows could be finished by anyone at any time before the specified expiration.
Before the [fix1571 amendment][] became enabled on 2018-06-19, it was possible to create an XRP escrow with `CancelAfter` only. These escrows could be finished by anyone at any time before the specified expiration.
{% /admonition %}
## Error Cases
Besides errors that can occur for all transactions, {% $frontmatter.seo.title %} transactions can result in the following [transaction result codes](../transaction-results/index.md):
| Error Code | Description |
|:--------------------- |:---------------------------------------------|
| `tecNO_PERMISSION` | The transaction failed because the necessary permissions for token escrow are not in place. For example, the issuer hasn't enabled the Allow Trust Line Locking flag for a Trust Line Token.|
| `tecNO_AUTH` | The transaction failed because authorization requirements for the token were not met. For example, the sender lacks authorization when creating the escrow. |
| `tecUNFUNDED` | The sender lacks sufficient spendable balance. For Trust Line Tokens, this means the sender's trust line with the issuer has insufficient available balance. For XRP escrows, this means the sender doesn't have enough XRP. |
| `tecOBJECT_NOT_FOUND` | The sender does not hold the MPT. |
| `tecFROZEN` | The token is frozen (for Trust Line Tokens) or locked (for MPTs) for the sender. |
## See Also
- [Escrow entry][]

View File

@@ -48,6 +48,20 @@ Any account may submit an EscrowFinish transaction.
In [non-production networks](../../../../concepts/networks-and-servers/parallel-networks.md), it may be possible [to delete](../../../../concepts/accounts/deleting-accounts.md) the destination account of a pending escrow. In this case, an attempt to finish the escrow fails with the result `tecNO_TARGET`, but the escrow object remains unless it has expired normally. If another payment re-creates the destination account, the escrow can be finished successfully. The destination account of an escrow can only be deleted if the escrow was created before the [fix1523 amendment](/resources/known-amendments.md#fix1523) became enabled. No such escrows exist in the production XRP Ledger, so this edge case is not possible on the production XRP Ledger. This edge case is also not possible in test networks that enable both fix1523 and Escrow amendments at the same time, which is the default when you [start a new genesis ledger](../../../../infrastructure/testing-and-auditing/start-a-new-genesis-ledger-in-stand-alone-mode.md).
## Error Cases
Besides errors that can occur for all transactions, {% $frontmatter.seo.title %} transactions can result in the following [transaction result codes](../transaction-results/index.md):
## EscrowFinish Errors
| Error Code | Description |
|:------------------------- |:------------|
| `tecNO_AUTH` | The transaction failed because authorization requirements were not met. For example, the issuer requires authorization and the destination is not authorized. |
| `tecNO_LINE` | The destination account does not have a trust line with the issuer. For Trust Line Tokens only. |
| `tecNO_ENTRY` | The destination account does not hold the MPT. |
| `tecINSUFFICIENT_RESERVE` | Unable to create a trust line or MPToken due to lack of reserves. |
| `tecFROZEN` | The token is deep frozen (Trust Line Tokens) or locked (for MPTs). |
## See Also
- [Escrow entry][]

View File

@@ -51,8 +51,8 @@ The **destination address** of a channel can:
| Field | JSON Type | [Internal Type][] | Required? | Description |
|:----------------|:---------------------|:------------------|:----------|:------------|
| `Amount` | [Currency Amount][] | Amount | No | The amount of [XRP, in drops][Currency Amount], or fungible tokens authorized by the `Signature`. This must match the amount in the signed message. This is the cumulative amount that can be dispensed by the channel, including funds previously redeemed. Non-XRP tokens can only be used if the [TokenEscrow amendment][] {% not-enabled /%} is enabled. |
| `Balance` | [Currency Amount][] | Amount | No | Total amount of [XRP, in drops][Currency Amount], or fungible tokens delivered by this channel after processing this claim. Required to deliver XRP or fungible tokens. Must be more than the total amount delivered by the channel so far, but not greater than the `Amount` of the signed claim. Must be provided except when closing the channel. Non-XRP tokens can only be used if the [TokenEscrow amendment][] {% not-enabled /%} is enabled. |
| `Amount` | [Currency Amount][] | Amount | No | The amount of XRP, in drops, authorized by the `Signature`. This must match the amount in the signed message. This is the cumulative amount of XRP that can be dispensed by the channel, including XRP previously redeemed. Must be provided except when closing the channel.|
| `Balance` | [Currency Amount][] | Amount | No | Total amount of XRP, in drops, delivered by this channel after processing this claim. Required to deliver XRP. Must be more than the total amount delivered by the channel so far, but not greater than the `Amount` of the signed claim. Must be provided except when closing the channel. |
| `Channel` | String - Hexadecimal | UInt256 | Yes | The unique ID of the channel. |
| `CredentialIDs` | Array of Strings | Vector256 | No | Set of credentials to authorize a deposit made by this transaction. Each member of the array must be the ledger entry ID of a Credential entry in the ledger. For details, see [Credential IDs](./payment.md#credential-ids). |
| `PublicKey` | String - Hexadecimal | Blob | No | The public key used for the signature. This must match the `PublicKey` stored in the ledger for the channel. Required unless the sender of the transaction is the source address of the channel and the `Signature` field is omitted. (The transaction includes the public key so that `rippled` can check the validity of the signature before trying to apply the transaction to the ledger.) |

View File

@@ -34,7 +34,7 @@ Create a [payment channel](../../../../concepts/payment-types/payment-channels.m
| Field | JSON Type | [Internal Type][] | Required? | Description |
|:-----------------|:---------------------|:------------------|:----------|:------------|
| `Amount` | [Currency Amount][] | Amount | Yes | Amount to deduct from the sender's balance and set aside in this channel. While the channel is open, the amount can only go to the `Destination` address. When the channel closes, any unclaimed amount is returned to the source account's balance. Non-XRP tokens can only be used if the [TokenEscrow amendment][] {% not-enabled /%} is enabled. |
| `Amount` | [Currency Amount][] | Amount | Yes | Amount of XRP, in drops, to deduct from the sender's balance and set aside in this channel. While the channel is open, the XRP can only go to the `Destination` address. When the channel closes, any unclaimed XRP is returned to the source account's balance. |
| `Destination` | String - [Address][] | AccountID | Yes | The account that can receive money from this channel. This is also known as the "destination address" for the channel. Cannot be the same as the sender (`Account`). |
| `SettleDelay` | Number | UInt32 | Yes | Amount of time, in seconds, the source address must wait before closing the channel if it has unclaimed funds. |
| `PublicKey` | String - Hexadecimal | Blob | Yes | The 33-byte public key of the key pair the source will use to sign claims against this channel. This can be any secp256k1 or Ed25519 public key. For more information on key pairs, see [Key Derivation](../../../../concepts/accounts/cryptographic-keys.md#key-derivation) <!-- STYLE_OVERRIDE: will --> |

View File

@@ -30,7 +30,7 @@ Add an additional amount to an open [payment channel](../../../../concepts/payme
| Field | JSON Type | [Internal Type][] | Required? | Description |
|:-------------|:---------------------|:------------------|:----------|:------------|
| `Channel` | String - Hexadecimal | UInt256 | Yes | The unique ID of the channel to fund. |
| `Amount` | [Currency Amount][] | Amount | Yes | Amount to add to the channel. Must be a positive amount. Non-XRP tokens can only be used if the [TokenEscrow amendment][] {% not-enabled /%} is enabled. |
| `Amount` | [Currency Amount][] | Amount | Yes | Amount of XRP, in drops, to add to the channel. Must be a positive amount of XRP. |
| `Expiration` | Number | UInt32 | No | New expiration time to set for the channel, in [seconds since the Ripple Epoch][]. This must be later than either the current time plus the `SettleDelay` of the channel, or the existing `Expiration` of the channel. After the `Expiration` time, any transaction that would access the channel closes the channel without taking its normal action. (`Expiration` is separate from the channel's immutable `CancelAfter` time.) For more information, see the [PayChannel ledger entry type](../../ledger-data/ledger-entry-types/paychannel.md). |
## Error Cases