0087 XLS-87d: Token Pre-Authorization #258
mvadari
started this conversation in
Standard Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Token Pre-Authorization
Abstract
Managing the authorization of tokens on the XRP Ledger is a complex task. This complexity is compounded when issuers use highly secure, locked-up keys, as frequent interactions to authorize trustlines or MPT holders can undermine the security benefits of these keys. Each authorization requires deliberate action by the issuer, making it impractical at scale and creating friction for both issuers and token holders. Without a streamlined mechanism to pre-approve or manage token authorizations efficiently, issuers face a tradeoff between operational efficiency and maintaining the security and decentralization principles of the ledger. This gap underscores the need for a robust solution that streamlines and simplifies the operational overhead of token authorization while preserving the integrity of issuer keys.
This spec proposes a solution to this problem by allowing issuers to pre-authorize token holders, either by authorizing specific accounts or by authorizing certain credentials/domains (which essentially allows them to move the burden of authorization to another account). By integrating token pre-authorization into the XRPL's existing trustline and MPT frameworks, issuers can establish robust controls over token distribution while maintaining a user-friendly process for holders. This allows issuers to manage their assets more effectively without compromising on security.
1. Overview
This feature mirrors the Deposit Authorization functionality, but for token authorization instead of payments.
We propose:
TokenPreauth
ledger objectTokenPreauth
transaction typeTrustSet
transaction typeMPTokenAuthorize
transaction typeThis feature will require an amendment, tentatively titled
TokenPreauth
. It also depends on XLS-70d, On-Chain Credentials and XLS-80d, Permissioned Domains (though it can be adjusted to avoid those dependencies).1.1. Background: Authorized Trustlines
Authorized trustlines allow issuers to control who can hold their issued tokens. By enabling the
RequireAuth
flag on their account, an issuer can enforce a policy where trustlines to that issuer must be explicitly authorized before any tokens can be held. Once authorized, the trustline functions as "normal" and the token holder can send, receive, or hold the issuer's tokens, subject to the usual rules of trustline limits and balances.However, approving each trustline requires a signed
TrustSet
transaction from the issuer for each trustline to authorize.1.2. Background: Authorized MPTs
Authorized MPTs function very similarly to authorized trustlines. The main differences are that the
RequireAuth
flag lives on theMPTokenIssuance
object instead of the account object, and theMPTokenAuthorize
transaction is used to authorize tokens instead.2. On-Ledger Object:
TokenPreauth
This object mirrors the
DepositPreauth
object post-XLS-70d in fields.2.1. Fields
The fields of this object mirror the fields of
DepositPreauth
, including changes made in XLS-70d.LedgerEntryType
string
UInt16
TokenPreauth
).Account
string
AccountID
Currency
string
Currency
MPTokenIssuanceID
string
UInt192
Holder
string
AccountID
Credentials
array
STArray
DomainID
OwnerNode
string
UInt64
Account.PreviousTxnID
.PreviousTxnID
string
Hash256
PreviousTxnLgrSeq
number
UInt32
2.1.1. Object ID
The ID of this object will be a hash of the
Account
and either theHolder
,Credentials
, orDomainID
fields (whichever of those fields is included in the object), combined with the unique space key forTokenPreauth
objects, which will be defined during implementation.If a
Currency
orMPTokenIssuanceID
is included, that will also be included in the hash.2.2. Account Deletion
The
TokenPreauth
object is not a deletion blocker.3. Transaction:
TokenPreauth
This transaction mirrors the
DepositPreauth
transaction post-XLS-70d in fields.3.1. Fields
Flags
number
UInt32
Currency
string
Currency
MPTokenIssuanceID
string
UInt192
Holder
string
AccountID
Credentials
array
STArray
DomainID
string
Hash256
Exactly one of the
Holder
,Credentials
, andDomainID
fields must be included.3.1.1.
Flags
tfUnauthorize
0x00000001
TokenPreauth
object will be deleted as a result (if the transaction is successful).3.1.2.
Currency
andMPTokenIssuanceID
At most one of these fields can be provided.
If either
Currency
orMPTokenIssuanceID
is provided, then this pre-authorization will only apply to that token.3.2. Failure Conditions
Holder
,Credentials
, andDomainID
are included (i.e. there must be exactly one of these fields included).TokenPreauth
object, if authorizing a new account/credential/domain.tfUnauthorize
flag is set, the account is not currently authorized.tfUnauthorize
flag is unset:tfUnauthorize
flag is set, the credentials are not currently authorized.tfUnauthorize
flag is unset, the credentials are already authorized.tfUnauthorize
flag is set, the domain is not currently authorized.tfUnauthorize
flag is unset, the domain is already authorized.MPTokenIssuanceID
isn't issued byAccount
.3.3. State Changes
If authorizing:
TokenPreauth
object is created, with the provided fields.If unauthorizing:
TokenPreauth
object is deleted.4. Transaction:
TrustSet
The
TrustSet
transaction already exists on the XRPL. We propose a slight modification to support token pre-authorization.4.1. Fields
As a reference, here are the fields that the
TrustSet
transaction currently has.LimitAmount
object
Amount
LimitAmount.currency
string
Amount.currency
)LimitAmount.value
string
Amount.value
)LimitAmount.issuer
string
Amount.issuer
)QualityIn
number
UInt32
QualityOut
number
UInt32
We propose these additions:
CredentialIDs
array
Vector256
DomainID
array
Vector256
No more than one of the
CredentialIDs
andDomainID
fields must be included.4.2. Failure Conditions
TrustSet
will still be obeyed.CredentialIDs
andDomainID
are included.CredentialIDs
is included:CredentialIDs
:Credential
object.Credential
object.Account
sending the transaction.CredentialIDs
is not authorized by the destination (or isn't authorized for this token).CredentialIDs
.DomainID
is included:DomainID
field is not a domain.DomainID
is not authorized by the destination (or isn't authorized for this token).4.3. State Changes
If the issuer has the
lsfRequireAuth
flag set, and the user is pre-authorizedin some way (either themselves or via credentials/domains), thelsfLowAuth
/lsfHighAuth
flag on the trustline will be enabled. This will be true even when editing an existing trustline, not just when creating a new one.5. Transaction:
MPTokenAuthorize
The
MPTokenAuthorize
transaction already exists on the XRPL - it is the transaction that allows an account to opt-in to holding a token, and also can be used by issuers who have authorization turned on to approve token holders.We propose a slight modification to support token pre-authorization.
5.1. Fields
As a reference, here are the fields that the
MPTokenAuthorize
transaction currently has.Account
string
AccountID
TransactionType
object
UInt16
MPTokenIssuanceID
string
UInt256
MPTokenHolder
string
AccountID
Flags
string
UInt32
We propose these additions:
CredentialIDs
array
Vector256
DomainID
array
Vector256
No more than one of the
CredentialIDs
andDomainID
fields must be included.5.2. Failure Conditions
MPTokenAuthorize
will still be obeyed.CredentialIDs
andDomainID
are included.CredentialIDs
is included:CredentialIDs
:Credential
object.Credential
object.Account
sending the transaction.CredentialIDs
is not authorized by the destination (or isn't authorized for this token).CredentialIDs
.DomainID
is included:DomainID
field is not a domain.DomainID
is not authorized by the destination (or isn't authorized for this token).5.3. State Changes
If the issuer has the
lsfMPTRequireAuth
flag set, and the user is pre-authorized in some way (either themselves or via credentials/domains), thelsfMPTAuthorized
flag on theMPToken
object will be enabled. This will be true even when editing an existingMPToken
, not just when creating a new one.6. Examples
In this example, Rowan is an RWA issuer, and there are certain legal criteria that must be met before a customer can hold his token (for example, they may need to be an accredited investor). A trusted issuer, Isabel, is issuing a credential that indicates that Alice meets these criteria.
6.1.
TokenPreauth
TransactionNote: Rowan already has the
lsfRequireAuth
flag set on his account and thelsfMPTRequireAuth
flag set on hisMPTokenIssuance
.6.2.
TokenPreauth
Ledger Object6.3.
TrustSet
TransactionThis transaction will result in Alice's trustline with Rowan automatically being authorized.
This transaction will succeed, but the trustline will remain unauthorized.
This transaction will fail, since the attached credential isn't Bob's.
6.4.
MPTokenAuthorize
This transaction will result in Alice being authorized to hold Rowan's RWA issuance.
This transaction will fail, since Alice didn't provide her credential. She can re-submit with the credential attached (like above).
This transaction will fail, since the attached credential isn't Bob's.
7. Invariants
A
TokenPreauth
ledger object always has exactly one of theHolder
,Credentials
, andDomainID
field, and has at most one of theCurrency
andMPTokenIssuanceID
fields.If the
Credentials
field is included, the array contains between 1 and 10 credentials.8. Security
8.1. Trust Assumptions
Issuers need to trust a credential issuer to only be issuing valid credentials, and to not delete a credential without a legitimate reason.
Issuers need to trust a domain issuer to only be allowing legitimate credentials into their domain.
Appendix
Appendix A: FAQ
A.1: Can I still authorize accounts that haven't been pre-authorized in any way?
Yes. The existing authorization flow will still work for those accounts.
A.2: What will happen during existing authorization flows if a holder has been pre-authorized?
A holder will be authorized on trustline/
MPToken
creation, essentially. So attempting to re-authorize the holder will have the same effect as attempting to re-authorize a holder in existing flows.A.3: Why doesn't this use the existing Deposit Auth flow?
This would be a problem for issuers who want to authorize token holders but don't want those token holders to be able to send funds to their address (for compliance reasons).
Beta Was this translation helpful? Give feedback.
All reactions