XRP Ledger Standards
XLS-0077 Final Amendment

Deep Freeze

Enhancement to prevent token misuse by frozen account holders and improve regulatory compliance

Author
Shawn Xie
Created
2024-07-08
Updated
2026-11-30
Discussion
XRPLF/XRPL-Standards/discussions/220

1. Abstract

This amendment empowers token issuers on the XRP Ledger to prevent token misuse by frozen account holders. The document outlines enhancements to the interactions between frozen assets and payments, ensuring that frozen token holders cannot receive funds until or unless their trustline is unfrozen. These changes will enable token issuers to more easily comply with regulations on the XRPL. For example, prevent tokens from flowing to wallets identified on sanctions lists, thereby enhancing regulatory compliance for use cases such as regulated stablecoins and real-world assets (RWA).

2. Motivation

This proposal introduces a new deep-freeze feature for the trustlines that interacts with payment, offers, DEX and AMM. In essence, issuers can block sending and receiving of funds for holders who have been deep-frozen.

3. Specification

3.1. Ledger Entry: RippleState

3.1.1. Object Identifier

The object identifier of this ledger entry does not change.

3.1.2. Fields

The fields of this ledger entry do not change.

3.1.3. Flags

Two new flags lsfLowDeepFreeze and lsfHighDeepFreeze are introduced in the RippleState (trustline) object.

Flag Name Flag Value Description
lsfLowDeepFreeze 0x02000000 The low account has deep-frozen the trust line, preventing the high account from sending and receiving the asset.
lsfHighDeepFreeze 0x04000000 The high account has deep-frozen the trust line, preventing the low account from sending and receiving the asset.

3.1.4. Ownership

The ownership of this ledger entry does not change.

3.1.5. Reserves

The reserves of this ledger entry do not change.

3.1.6. Deletion

The deletion rules of this ledger entry do not change.

3.1.7. Freeze/Lock

The Deep-freeze feature is a setting on a trust line. When an issuer enacts Deep-freeze, the following rules apply to the tokens in that trust line:

  • Payments can still occur directly between the two parties of the deep-frozen trust line.
  • The counterparty of that trust line can no longer increase or decrease its balance on the deep-frozen trust line, except in direct payments to the issuer. The counterparty can only send the deep-frozen currencies directly to the issuer.
  • The counterparty can neither send nor receive from others on the deep-frozen trustline.
  • The counterparty's offers to buy or sell the tokens in the deep-frozen trustline are considered unfunded.

An individual address can deep-freeze its trust line to an issuer or financial institution. This has no effect on transactions between the institution and other users. However it does the following:

  • It prevents other addresses from sending that financial institution's tokens to the individual address.
  • It also prevents the individual address from sending the token to other non-issuer addresses.

3.1.8. Invariants

Possible invariants:

  1. Disallowing any increase in the balance of a deep-frozen trustline as a result of any type of transaction.
  2. A trust line cannot have the lsfLowDeepFreeze flag set without also having the lsfLowFreeze flag set, and the same applies to the lsfHighDeepFreeze flag.

3.1.9. RPC Name

The RPC name of this ledger entry does not change.

3.1.10. Example JSON

The JSON format of this ledger entry does not change.

3.2. Transaction: TrustSet

3.2.1. Fields

The fields of this transaction do not change.

3.2.2. Flags

Two new flags tfSetDeepFreeze and tfClearDeepFreeze are introduced in the TrustSet transaction.

Flag Name Flag Value Description
tfSetDeepFreeze 0x00400000 Deep freeze the trust line.
tfClearDeepFreeze 0x00800000 Clear the deep-freeze on the trust line.

3.2.3. Transaction Fee

The fee for this transaction does not change.

3.2.4. Failure Conditions

3.2.4.1. Protocol-Level Failures
  1. The transaction sets tfSetDeepFreeze, but the holder is not already frozen (indicated by lsfLowFreeze/lsfHighFreeze on the trust line) and tfSetFreeze is not also set in the same TrustSet transaction. Deep-freeze requires that the issuer must have "regularly frozen" the trust line before they can enact a deep-freeze. (TODO: content pass — result code.)
  2. The transaction sets tfSetDeepFreeze, and the issuer has enabled No Freeze on their account. The issuer cannot enact a deep-freeze if they have enabled No Freeze. (TODO: content pass — result code.)
  3. The trust line is deep-frozen by the issuer (indicated by lsfLowDeepFreeze/lsfHighDeepFreeze), and the issuer sets the tfClearFreeze flag without also setting the tfClearDeepFreeze flag. In other words, the issuer cannot clear the regular freeze on a trust line unless they also clear the deep-freeze. (TODO: content pass — result code.)

3.2.5. State Changes

  1. If tfSetDeepFreeze is set, the trust line is deep-frozen: lsfLowDeepFreeze is set when the low account deep-freezes the trust line, and lsfHighDeepFreeze when the high account does.
  2. If tfClearDeepFreeze is set, the deep-freeze on the trust line is cleared.

3.2.6. Example JSON

The JSON format of this transaction does not change.

3.3. Transaction: OfferCreate

3.3.1. Fields

The fields of this transaction do not change.

3.3.2. Transaction Fee

The fee for this transaction does not change.

3.3.3. Failure Conditions

3.3.3.1. Protocol-Level Failures
  1. The TakerPays (buy amount) token has been deep-frozen by the issuer (tecFROZEN).

3.3.4. State Changes

  1. Any existing offers where the owner has been deep-frozen on the TakerPays token can no longer be consumed and will be considered as an unfunded offer that will be implicitly canceled by new Offers that cross it.

3.3.5. Example JSON

The JSON format of this transaction does not change.

3.4. Transaction: Payment

Payment engine executes paths that are made of steps to connect the sender to the receiver. In general, funds can be deposited into a trustline through one of two steps:

  • Rippling
  • Order book or AMM

This proposal proposes changes to both steps above to ensure a deep-frozen trustline cannot increase its balance. In the payment engine, offers and AMM pools can be consumed in the path when a cross-currency payment is involved, resulting in a change to the trustline balance. This proposal introduces behavior changes to the order book step when trustlines have been deep-frozen. See Appendix B for examples.

3.4.1. Fields

The fields of this transaction do not change.

3.4.2. Transaction Fee

The fee for this transaction does not change.

3.4.3. Failure Conditions

3.4.3.1. Protocol-Level Failures
  1. Rippling: the receipt of funds in a deep-frozen trust line as a result of a rippling step will fail. (TODO: content pass — result code.)

3.4.4. State Changes

  1. Order book: if the offer owner has been deep-frozen for the TakerPays token (buy amount), the offer is considered to be unfunded and the step fails. This is not a failure of the Payment: the payment engine handles the offer as it handles any other unfunded offer.

TODO: content pass.

3.4.5. Example JSON

The JSON format of this transaction does not change.

4. Rationale

4.1. Why can't we embed the disallow-receiving into the existing freeze without introducing a new flag?

Altering the existing freeze functionality to disallow receiving would be a significant breaking change, potentially disrupting the workflows of current users. Instead, it is preferable to introduce a configurable flag, offering additional flexibility without affecting the existing behavior.

4.2. Why can't this be a separate feature named "block-receiving"?

The block-receiving feature shares similarities with the existing freeze functionality, as both aim to prevent unauthorized or blacklisted parties from transferring funds. Creating it as a separate feature would introduce unnecessary complexities, such as the need to add a new account-level flag to toggle the feature. Integrating it into the existing framework avoids these complications while maintaining consistency.

4.3. AMM

The AMM step of the payment engine does not require any changes because, currently, an AMM step fails if the AMM account is frozen for any involved asset. Since a deep-frozen asset would already be regularly frozen, no additional checks are needed when an asset is deep-frozen.

4.4. AMMWithdraw Transaction

This proposal does not need to change the AMMWithdraw transaction due to the deep-freeze, as all deep-frozen tokens have already been regularly frozen, preventing the withdrawal of either regularly frozen or deep-frozen tokens.

5. Security Considerations

TODO: content pass.

Appendix

Appendix A: FAQ

A.1: How does MPT freeze/lock behavior differ from IOU?

The MPT freeze/lock functionality differs somewhat from how IOUs work today. When an MPT holder is locked, they cannot send or receive MPT payments, so a single flag is sufficient. In contrast, for IOUs, the regular freeze only disallows sending. If the issuer wants to block receiving as well, they must apply a deep-freeze.

Appendix B: Payment Engine Examples

B.1: Rippling

Let's take a look at an example of how deep-freeze impacts rippling:

+-------+           USD           +---------+           USD           +-------+
| Alice | ----------------------> | Gateway | ----------------------> |  Bob  |
+-------+                         +---------+ (Bob is deep-frozen)    +-------+

Consider the following scenario:

  1. Issuer account issues USD to both Alice and Bob, each of which has a trustline.
  2. Issuer deep-freezes Bob's trustline by submitting a TrustSet with tfSetFreeze and tfSetDeepFreeze flags.
  3. Alice attempts to send a USD Payment to Bob. The transaction fails because Bob's USD trustline has been deep-frozen and can no longer receive funds.

B.2: Order Book

Let's take a look at an example of how deep-freeze impacts order book:

                                                                 Bob's Offer
+-------+         USD            +---------+        USD       +--------------+      XRP     +-------+
| Alice | ---------------------> | Gateway | ---------------> | Sell: 100 XRP| -----------> | Carol |
+-------+     SendMax: 100 USD   +---------+                  +--------------+              +-------+
              Amount: 100 XRP                                 | Buy: 100 USD |
                                                              +--------------+
                                                            (Bob is deep-frozen)

Consider the following scenario:

  1. Issuer account issues USD to both Alice and Bob, each of which has a trustline.
  2. Issuer deep-freezes Bob's trustline by submitting a TrustSet with tfSetFreeze and tfSetDeepFreeze flags.
  3. Alice attempts to send XRP to Carol through a Payment transaction using Bob's offer to exchange USD for XRP. Alice fails to send XRP to Carol because Bob's offer is unfunded due to the deep-frozen trustline.