Multi-Purpose Tokens
Learn how to create and manage Multi-Purpose Tokens (MPT) on the XRP Ledger.
Multi-Purpose Tokens (MPT) are a recent amendment to the XRP Ledger, enhancing the token system by allowing tokens to serve multiple functions beyond just being a medium of exchange. This amendment introduces new capabilities for token issuers and holders.
Use Cases
Stablecoins: Create stablecoins with features like freezing and clawback.
Utility Tokens: Design tokens with specific utility functions.
Security Tokens: Implement security tokens with transfer restrictions.
Community Credit: Track debts and credits between known parties.
MPToken Flags
Each flag is a power of 2, allowing them to be combined using bitwise operations. The total value is the sum of all enabled flags.
canLock
2
Lock tokens globally or per account
requireAuth
4
Require issuer approval for new holders
canEscrow
8
Enable time-locked escrow (Not implemented)
canTrade
16
Enable DEX trading (Not implemented)
canTransfer
32
Enable basic token transfers
canClawback
64
Allow issuer to recover tokens
Common Flag Combinations:
Basic: canTransfer (32)
Secure: canLock + canClawback + canTransfer (98)
Regulated: canLock + canClawback + canTransfer + requireAuth (102)
Getting Started: Creating the Main Structure of Your Script
Create a new file or edit index.ts:
Understanding MPTokenIssuanceID
The mpt_issuance_id is a unique identifier generated when an MPToken is created via MPTokenIssuanceCreate. This ID is:
Automatically generated by the XRPL network upon successful token creation
Globally unique across all MPTokens on the ledger
Required for all subsequent operations (payments, clawbacks, authorization)
To obtain the MPTokenIssuanceID:
Submit an
MPTokenIssuanceCreatetransactionRetrieve the ID from the transaction result:
result.meta?.mpt_issuance_idStore this ID for future operations with your token
Alternative ways to find the MPTokenIssuanceID:
From Explorer: You can find the ID on the XRPL explorer (https://devnet.xrpl.org/) by searching with the transaction hash or the creator's address
Query by Issuer: Use the
account_linesAPI method with the issuer's address to find all tokens issued by that account
The relationship between issuer, token properties, and ID:
Issuer: The account that created the token (unchangeable)
Token Properties: Metadata, flags, and rules defined at creation
MPTokenIssuanceID: The unique identifier linking all operations to this specific token issuance
Technical Specifications
Uses decimal (base-10) math with 15 digits of precision
Can express values from 1.0 × 10^-81 to 9999999999999999 × 10^80
Supports transfer fees that are automatically deducted
Allows issuers to define tick sizes for exchange rates
Destroying MPTokens
The MPTokenIssuanceDestroy transaction allows an issuer to permanently destroy an MPToken issuance. This is useful for:
Retiring deprecated or unused tokens
Removing tokens that were created in error
Regulatory compliance and token lifecycle management
Requirements
Only the original issuer can destroy the MPToken issuance
All tokens must be owned by the issuer (transferred back) before destruction
The MPTokenIssuanceID must be valid and reference an existing issuance
Example Transaction
Freezing MPToken Issuance
The MPTokenIssuanceSet transaction allows an issuer to modify the state of an MPToken issuance, including freezing/unfreezing transfers. This is useful for:
Temporarily halting transfers during maintenance or upgrades
Responding to security incidents
Complying with regulatory requirements
Managing token lifecycle events
Requirements
Only the original issuer can modify the issuance settings
The MPTokenIssuanceID must be valid and reference an existing issuance
Appropriate flags must be set during issuance to enable freezing
Example Transaction
Authorizing MPToken Holders
The MPTokenAuthorize transaction enables fine-grained control over who can hold and transfer Multi-Purpose Tokens (MPTs) on the XRPL. This mechanism supports compliance, prevents unsolicited token spam, and allows issuers to manage token distribution effectively.
Features
Authorize a Holder: Permit a specific account to receive and hold a designated MPT
Revoke Authorization: Remove a holder's permission, effectively locking their MPT balance
Self-Unauthorize: Allow a holder to voluntarily relinquish their MPT holdings (requires zero balance)
Global Locking: Restrict all transfers of a particular MPT issuance
Requirements
Only the original issuer can authorize/revoke holders
The MPTokenIssuanceID must be valid and reference an existing issuance
Authorization flags must be enabled during issuance
Holder accounts must be valid XRPL addresses
Example Transaction
Transaction Type modifications
The introduction of Multi-Purpose Tokens (MPT) on the XRP Ledger has brought significant changes to existing transaction types, especially Payment and Clawback. These transactions now support MPTokens, allowing you to transfer or recover tokens issued under the new amendment.
Changes introduced:
Payment: The Payment transaction can now transfer MPTokens by using the
Amountfield as an object containing the issuance identifier (mpt_issuance_id) and the amount to transfer. Example:Clawback: The Clawback transaction allows the issuer to recover MPTokens from a specific account, also using the adapted
Amountfield for MPTokens. Example:
Putting It All Together
Let's create a complete example that demonstrates all the MPToken features by simulating a real-world scenario: issuing company shares to investors. In this example, we'll:
Create a company share token with regulatory controls
Authorize investors to receive shares
Distribute shares to investors
Demonstrate compliance controls (locking and clawback)
You can check every transaction hash on : https://devnet.xrpl.org/
Resources
Last updated

