Token-Enabled Escrows
Enhancement to existing Escrow functionality to support both Trustline-based tokens (IOUs) and Multi-Purpose Tokens (MPTs)
- Author
- Denis Angell
- Created
- 2024-11-07
- Updated
- 2026-12-02
- Requires
- XLS-33
- Discussion
- XRPLF/XRPL-Standards/discussions/248
This proposal, XLS-85, replaces XLS-34 and draws inspiration from https://github.com/XRPLF/XRPL-Standards/discussions/133.
1. Abstract¶
The proposed TokenEscrow amendment to the XRP Ledger (XRPL) protocol enhances the existing Escrow functionality by enabling support for both Trustline-based tokens (IOUs) and Multi-Purpose Tokens (MPTs). This amendment introduces changes to ledger objects, transactions, and transaction processing logic to allow escrows to use IOU tokens and MPTs, while respecting issuer controls and maintaining ledger integrity.
2. Specification¶
This amendment extends the functionality of escrows to support both IOUs and MPTs, accounting for the specific behaviors and constraints associated with each token type. Appendix A gives an overview of the two token types.
2.1. Ledger Entry: Escrow¶
2.1.1. Object Identifier¶
The object identifier of this ledger entry does not change.
2.1.2. Fields¶
The Escrow ledger object is updated as follows:
| Field Name | Constant | Required | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
Amount |
TODO | TODO | AMOUNT | N/A | The amount to be delivered by the held payment. Can represent XRP, an IOU token, or an MPT. Must always be a positive value. JSON type: object or string. |
TransferRate |
TODO | TODO | UINT32 | N/A | The transfer rate or fee at which the funds are escrowed, stored at creation and used during settlement. Applicable to both IOUs and MPTs. JSON type: number. |
IssuerNode |
TODO | No | UINT64 | N/A | The ledger index of the issuer's directory node associated with the Escrow. Used when the issuer is neither the source nor destination account. JSON type: number. |
2.1.3. Ownership¶
TODO: content pass.
2.1.4. Reserves¶
The reserves of this ledger entry do not change.
2.1.5. Deletion¶
TODO: content pass.
2.1.6. Invariants¶
TODO: content pass.
2.1.7. RPC Name¶
The RPC name of this ledger entry does not change.
2.1.8. Example JSON¶
TODO: content pass.
2.2. Ledger Entry: MPToken¶
2.2.1. Object Identifier¶
The object identifier of this ledger entry does not change.
2.2.2. Fields¶
The MPToken ledger object is updated as follows:
| Field Name | Constant | Required | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
LockedAmount |
TODO | No | UINT64 | N/A | The total of all outstanding escrows for this issuance. JSON type: string. |
2.2.3. Ownership¶
The ownership of this ledger entry does not change.
2.2.4. Reserves¶
The reserves of this ledger entry do not change.
2.2.5. Deletion¶
TODO: content pass.
2.2.6. Invariants¶
TODO: content pass.
2.2.7. RPC Name¶
The RPC name of this ledger entry does not change.
2.2.8. Example JSON¶
TODO: content pass.
2.3. Ledger Entry: MPTokenIssuance¶
2.3.1. Object Identifier¶
The object identifier of this ledger entry does not change.
2.3.2. Fields¶
The MPTokenIssuance ledger object is updated as follows:
| Field Name | Constant | Required | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
LockedAmount |
TODO | No | UINT64 | N/A | The total of all outstanding escrows for this issuance. JSON type: string. |
2.3.3. Ownership¶
The ownership of this ledger entry does not change.
2.3.4. Reserves¶
The reserves of this ledger entry do not change.
2.3.5. Deletion¶
TODO: content pass.
2.3.6. Invariants¶
TODO: content pass.
2.3.7. RPC Name¶
The RPC name of this ledger entry does not change.
2.3.8. Example JSON¶
TODO: content pass.
2.4. Ledger Entry: AccountRoot¶
2.4.1. Object Identifier¶
The object identifier of this ledger entry does not change.
2.4.2. Fields¶
The fields of this ledger entry do not change.
2.4.3. Flags¶
This proposal introduces 1 additional flag for the Flags field of AccountRoot:
| Flag Name | Flag Value | Description |
|---|---|---|
lsfAllowTrustLineLocking |
0x40000000 |
Allow trust line tokens (IOUs) issued by this account to be held in escrow. Set with the asfAllowTrustLineLocking AccountSet flag. |
2.4.4. Ownership¶
The ownership of this ledger entry does not change.
2.4.5. Reserves¶
The reserves of this ledger entry do not change.
2.4.6. Deletion¶
The deletion rules of this ledger entry do not change.
2.4.7. Invariants¶
The invariants of this ledger entry do not change.
2.4.8. RPC Name¶
The RPC name of this ledger entry does not change.
2.4.9. Example JSON¶
The JSON format of this ledger entry does not change.
2.5. Transaction: EscrowCreate¶
2.5.1. Fields¶
The EscrowCreate transaction is modified as follows:
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
Amount |
Yes | object or string | AMOUNT | N/A | The amount to deduct from the sender's balance and set aside in escrow. Once escrowed, this amount can either go to the Destination address (after any Finish times/conditions) or returned to the sender (after any cancellation times/conditions). Can represent XRP, in drops, an IOU token, or an MPT. Must always be a positive value. |
2.5.2. Transaction Fee¶
The fee for this transaction does not change.
2.5.3. Failure Conditions¶
2.5.3.1. Data Verification¶
TODO: content pass.
2.5.3.2. Protocol-Level Failures¶
- Issuer is the Source: The source account is the issuer of the token (
tecNO_PERMISSION). - Issuer Does Not Allow Token Escrow (IOU Tokens): The issuer's account does not have the
lsfAllowTrustLineLockingflag set. This flag must be set by the token issuer account before any escrows can be created with their IOUs (tecNO_PERMISSION). - Issuer Does Not Allow Token Escrow (MPTs): The
MPTokenIssuanceof the token being escrowed lacks thelsfMPTCanEscrowflag (tecNO_PERMISSION). - Issuer Does Not Allow Token Transfer (MPTs): The
MPTokenIssuanceof the token being escrowed lacks thelsfMPTCanTransferflag, unless the destination address of the Escrow is the issuer of the MPT (tecNO_PERMISSION). - Source Account Not Authorized to Hold Token: The issuer requires authorization and the source is not authorized (
tecNO_AUTH). - Source Account's Token Holding Issues (IOU Tokens): The source lacks a trustline with the issuer (
tecUNFUNDED). - Source Account's Token Holding Issues (MPTs): The source does not hold the MPT (
tecOBJECT_NOT_FOUND). - Source Account is Frozen or Token is Locked: The token is frozen (global/individual/deepfreeze) (IOU) or locked (MPT) for the source (
tecFROZEN). - Insufficient Spendable Balance: The source account lacks sufficient spendable balance (
tecUNFUNDED).
2.5.4. State Changes¶
- Adjustment from Source to Issuer (IOU Tokens): The escrow
Amountis deducted from the source's trustline balance. - Adjustment from Source to Issuer (MPTs): The escrow
Amountis deducted from the source's MPT balance. TheOutstandingAmountof the MPT issuance remains unchanged. TheLockedAmountis increased on both the source's MPT and the MPT issuance. - Escrow Object Creation: The
Escrowledger object includes:Amount: Tokens held in escrow.TransferRate:TransferRate(IOUs) orTransferFee(MPTs) at creation. TheTransferRate(IOU tokens) orTransferFee(MPTs) is captured at the time ofEscrowCreateand stored in theEscrowobject.IssuerNode: Reference to the issuer’s ledger node if applicable.
2.5.5. Example JSON¶
TODO: content pass.
2.6. Transaction: EscrowFinish¶
2.6.1. Fields¶
The fields of this transaction do not change.
2.6.2. Transaction Fee¶
The fee for this transaction does not change.
2.6.3. Failure Conditions¶
2.6.3.1. Data Verification¶
TODO: content pass.
2.6.3.2. Protocol-Level Failures¶
- Destination Not Authorized to Hold Token: Authorization is required and the destination is not authorized (
tecNO_AUTH). - Destination Lacks Trustline (IOU Tokens): The destination lacks a trustline with the issuer (
tecNO_LINE). - Destination Lacks MPT Holding (MPTs): The destination does not hold the MPT (
tecNO_PERMISSION). - Cannot Create Trustline or MPT Holding: Unable to create it due to lack of authorization (
tecNO_AUTH). - Cannot Create Trustline or MPT Holding: Unable to create it due to lack of reserves (
tecINSUFFICIENT_RESERVE). - Destination Account is Frozen (IOU Tokens): The token is deep frozen (
tecFROZEN). - Token is Locked (MPTs): The token is locked (Lock Conditions, equivalent to Deep Freeze) (
tecFROZEN).
Global/Individual Freeze (IOU Tokens): The transaction succeeds despite the token being globally or individually frozen.
2.6.4. State Changes¶
- Auto create Trustline or MPToken: A new trustline or MPT holding may be created during
EscrowFinishif authorization is not required.- IOU Tokens: If the IOU does not require authorization and the account submitting the transaction is the recipient, then a trustline will be created.
- MPTs: If the MPT does not require authorization and the account submitting the transaction is the recipient, then the MPT will be created.
- Adjustment from Issuer to Destination (IOU Tokens): The escrow
Amountis added to the destination's trustline balance. - Adjustment from Issuer to Destination (MPTs):
- If the escrow sender is the issuer of the asset that was escrowed and the destination is not the issuer, then:
- The
LockedAmounton theMPTokenIssuanceof the asset that was held in escrow is decreased byAmount. - The
Amounton the destination'sMPTokenis increased by the escrow'sAmount. - The
OutstandingAmounton theMPTokenIssuanceof the asset that was held in escrow is unchanged.
- The
- If the escrow sender is not the issuer of the asset that was escrowed but the destination is the issuer of the asset, then:
- The
LockedAmounton theMPTokenIssuanceof the asset that was held in escrow is decreased byAmount. - No
MPTokenobjects are changed because MPT issuers may not hold MPTokens. - The
OutstandingAmounton theMPTokenIssuanceof the asset that was held in escrow is decreased byAmount(i.e., this escrow finish is a "redemption").
- The
- If neither the escrow source nor destination is the issuer of the asset that was escrowed, then
- The
LockedAmounton theMPTokenIssuanceof the asset that was held in escrow is decreased by the escrowAmount. - The
LockedAmounton the source'sMPTokenis decreased by the escrowAmount. - The
Amounton the destination'sMPTokenis increased by the escrowAmount. - The
OutstandingAmounton theMPTokenIssuanceof the asset that was held in escrow is unchanged.
- The
- If the escrow sender is the issuer of the asset that was escrowed and the destination is not the issuer, then:
- Transfer Rates and Fees:
- Locked Transfer Rate (IOU Tokens): The
TransferRatestored in theEscrowobject is used duringEscrowFinish, even if the issuer changes it later. The escrowed amount is adjusted according to theTransferRateupon settlement, potentially reducing the final amount credited to the destination. - Locked Transfer Fee (MPTs): The
TransferFeestored in theEscrowobject, similar to IOUs, is used during settlement. The escrowed amount is adjusted according to theTransferFeeupon settlement, potentially reducing the final amount credited to the destination.
- Locked Transfer Rate (IOU Tokens): The
- Deletion of Escrow Object: The
Escrowobject is deleted after successful settlement.
2.6.5. Example JSON¶
The JSON format of this transaction does not change.
2.7. Transaction: EscrowCancel¶
2.7.1. Fields¶
The fields of this transaction do not change.
2.7.2. Transaction Fee¶
The fee for this transaction does not change.
2.7.3. Failure Conditions¶
2.7.3.1. Data Verification¶
TODO: content pass.
2.7.3.2. Protocol-Level Failures¶
- Source Not Authorized to Hold Token: Authorization is required and the source is not authorized (
tecNO_AUTH). - Source Lacks Trustline (IOU Tokens): The source lacks a trustline with the issuer (
tecNO_LINE). - Source Lacks MPT Holding (MPTs): The source does not hold the MPT (
tecNO_PERMISSION). - Cannot Create Trustline or MPT Holding: Unable to create it due to lack of authorization (
tecNO_AUTH). - Cannot Create Trustline or MPT Holding: Unable to create it due to lack of reserves (
tecINSUFFICIENT_RESERVE).
Source Account is Frozen or Token is Locked: The transaction succeeds, allowing the escrow to be canceled, in each of these cases: IOU Tokens with Deep Freeze, IOU Tokens with Global/Individual Freeze, and MPTs with Lock Conditions (Deep Freeze Equivalent).
2.7.4. State Changes¶
- Auto create Trustline or MPToken: A new trustline or MPT holding may be created during
EscrowCancelif authorization is not required.- IOU Tokens: If the IOU does not require authorization and the account submitting the transaction is the recipient, then a trustline will be created.
- MPTs: If the MPT does not require authorization and the account submitting the transaction is the recipient, then the MPT will be created.
- Adjustment from Issuer to Source (IOU Tokens): The escrow
Amountis added to the source's trustline balance. - Adjustment from Issuer to Source (MPTs): The escrow
Amountis added to the source's MPT balance. TheOutstandingAmountof the MPT issuance remains unchanged. TheLockedAmountis decreased on both the source's MPT and the MPT issuance. - Deletion of Escrow Object: The
Escrowobject is deleted after successful cancellation.
2.7.5. Example JSON¶
The JSON format of this transaction does not change.
2.8. Transaction: AccountSet¶
To enable IOU tokens to be held in escrow, issuers must set the lsfAllowTrustLineLocking flag on their account. This is done using the AccountSet transaction with the new asfAllowTrustLineLocking flag.
2.8.1. Fields¶
The fields of this transaction do not change.
2.8.2. Flags¶
The following AccountSet flag is added to enable trust line locking for escrows:
| Flag Name | Flag Value | Description |
|---|---|---|
asfAllowTrustLineLocking |
17 | Allow trust line tokens (IOUs) issued by this account to be held in escrow. (Requires the TokenEscrow amendment.) Can only be enabled by the issuer account. Once enabled, holders of this account's issued tokens can create escrows with those tokens. |
2.8.3. Transaction Fee¶
The fee for this transaction does not change.
2.8.4. Failure Conditions¶
TODO: content pass.
2.8.5. State Changes¶
- With
SetFlagset toasfAllowTrustLineLocking, thelsfAllowTrustLineLockingflag is set on the account. The flag applies only to IOU tokens (trust line based tokens). For MPTs, escrow permissions are controlled by thetfMPTCanEscrowflag on the MPTokenIssuance object.
2.8.6. Example JSON¶
To enable trust line locking for an issuer account:
{
"TransactionType": "AccountSet",
"Account": "rIssuerAccountAddress...",
"SetFlag": 17,
"Fee": "12",
"Sequence": 5
}
3. Rationale¶
TODO: content pass.
3.1. Consistent Fee Application¶
Both IOUs and MPTs use the transfer rate or fee stored at escrow creation, ensuring predictability for the destination.
3.2. Future Considerations¶
-
Clawback: XLS-85 currently does not provide a direct “clawback” mechanism within an active Escrow. If your use case requires clawback, you can either finish or cancel the Escrow (as appropriate) and then perform a clawback of the funds outside of the Escrow context. In other words, once the token amount returns to the issuer or source account, the existing clawback features for IOUs or MPTs can be used on those returned funds.
-
Issuer as Source: XLS-85 currently does not allow the issuer to be the source of the Escrow. If your use case requires this functionality, you should create a new account, send the MPT or IOU to that account, and then Escrow the token.
4. Security Considerations¶
TODO: content pass.
Appendix¶
Appendix A: Overview of Token Types¶
A.1: IOU Tokens¶
- Trustlines: IOUs rely on trustlines between accounts.
- Issuer Controls:
- Require Authorization (
lsfRequireAuth): Issuers may require accounts to be authorized to hold their tokens. - Freeze Conditions (
lsfGlobalFreeze,lsfDefaultRipple): Issuers can freeze tokens, affecting their transferability.
- Require Authorization (
- Transfer Mechanics: Transfers occur via adjustments to trustline balances.
- Transfer Rates: Issuers can set a
TransferRatethat affects transfers involving their tokens.
A.2: Multi-Purpose Tokens (MPTs)¶
- No Trustlines: MPTs do not utilize trustlines.
- Issuer Controls:
- Transfer Flags (
tfMPTCanTransfer): Tokens must have this flag enabled to be transferable and to participate in transactions like escrows. - Require Authorization (
tfMPTRequireAuth): Issuers may require authorization for accounts to hold their tokens. - Lock Conditions (
lsfMPTokenLock): Tokens can be locked by the issuer, affecting their transferability.
- Transfer Flags (
- Transfer Mechanics: Transfers occur by moving token balances directly between accounts.
- Transfer Fees: Issuers can set a
TransferFee(analogous toTransferRatefor IOUs) that affects transfers involving their tokens.
Appendix B: Key Differences Between IOU and MPT Escrows¶
| Aspect | IOU Tokens | Multi-Purpose Tokens (MPTs) |
|---|---|---|
| Trustlines | Required between accounts and issuer | Not used |
| Issuer Flag for Escrow | lsfAllowTrustLineLocking (account flag) |
tfMPTCanEscrow (token flag) |
| Transfer Flags | N/A | tfMPTCanTransfer must be enabled for escrow |
| Require Auth | Applicable (lsfRequireAuth); accounts must be authorized prior to holding tokens |
Applicable (tfMPTRequireAuth); accounts must be authorized prior to holding tokens |
| Destination Authorization | Not required at creation; required at settlement; cannot be granted during EscrowFinish if authorization required |
Not required at creation; required at settlement; cannot be granted during EscrowFinish if authorization required |
| Freeze/Lock Conditions | Deep Freeze prevents EscrowFinish, but allows EscrowCancel; Global/Individual Freeze allows both operations |
Lock Conditions (Deep Freeze Equivalent) prevent EscrowFinish, but allow EscrowCancel |
| Transfer Rates/Fees | TransferRate stored at creation and applied during settlement |
TransferFee stored at creation and applied during settlement |
| Outstanding Amount | Remains unchanged during escrow | Remains unchanged during escrow |
| Account Deletion | Escrows prevent account deletion | Escrows prevent account deletion |