URITokens
Lightweight first-class NFTs for XRPL Protocol Chains
- Authors
- Richard Holland, Wietse Wind
- Created
- 2023-02-09
- Updated
- 2026-11-30
- Discussion
- XRPLF/XRPL-Standards/discussions/89
1. Abstract¶
The URIToken Amendment provides a lightweight alternative to XLS20 suitable for both main-net and side-chains.
The amendment adds a new type of ledger object, URIToken, a new serialized field, URITokenID, and five new transaction types:
URITokenMintURITokenBurnURITokenBuyURITokenCreateSellOfferURITokenCancelSellOffer
2. Motivation¶
XLS-20 is a Non-Fungible Token standard that is currently active and in-use on the XRP Ledger main-net. Despite this, many developers and users of the XRPL remain unsatisfied by its complexity, unusual edge-cases, lack of first-class object NFTs, and general difficulty to understand and write integrations for. We therefore propose a light-weight alternative: URIToken.
3. Specification¶
3.1. Ledger Entry: URIToken¶
The URIToken object is an owned first-class on-ledger object which lives in its owner's directory.
3.1.1. Object Identifier¶
Key Space: TODO: content pass.
ID Calculation Algorithm: It is uniquely identified by the combined hash of its Issuer (minter) and the URI. Therefore an issuer can only issue one URIToken per URI.
3.1.2. Fields¶
| Field Name | Constant | Required | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
| Issuer | Yes | Yes | ACCOUNT | N/A | The minter who issued the token. |
| Owner | No | Yes | ACCOUNT | N/A | The current owner of the token. |
| URI | TODO | Yes | BLOB | N/A | The URI the token points to. |
| Flags | No | Yes | UINT32 | N/A | A flag indicating whether or not the URIToken is burnable, and whether or not it is for sale. |
| Digest | Yes | No | HASH256 | N/A | An sha512half integrity digest of the contents pointed to by the URI |
| Amount | No | No | AMOUNT | N/A | If the URIToken is for sale, then this is the amount the seller is asking for. |
| Destination | No | No | ACCOUNT | N/A | If the URIToken is for sale and this field has been set then only this AccountID may purchase the token. |
Field Details:
3.1.2.1. Amount¶
Whether a URIToken is for sale is indicated by the presence of the Amount field in the URIToken object. If a Destination is also present in the object then only that AccountID may perform the purchase.
3.1.3. Ownership¶
Owner: Owner
Directory Registration: The URIToken lives in its owner's directory. Upon creation (minting) the Issuer is the object's first Owner. You cannot mint on behalf of a third party.
3.1.4. Reserves¶
Reserve Requirement: Standard
As with other first class objects, each URIToken locks up an owner reserve on the account that currently owns it. Disposing of a URIToken frees up these reserved funds.
3.1.5. Deletion¶
Deletion Transactions: URITokenBurn
Deletion Conditions:
- The current owner of the URIToken can burn it at any time.
- The Issuer of the token may also burn it at any time but only if
tfBurnablewas set during minting.
Account Deletion Blocker: TODO: content pass.
3.1.6. Invariants¶
TODO: content pass.
3.1.7. RPC Name¶
TODO: content pass.
3.1.8. Example JSON¶
Example URIToken object:
{
"Flags": 0,
"Issuer": "rN38hTretqygfgcvADnJwZzHu5rawAvmkX",
"LedgerEntryType": "URIToken",
"Owner": "rN38hTretqygfgcvADnJwZzHu5rawAvmkX",
"URI": "68747470733A2F2F6D656469612E74656E6F722E636F6D2F666752755A7A662D374B5541414141642F6465616C2D776974682D69742D73756E676C61737365732E676966"
}
3.2. Transaction: URITokenMint¶
3.2.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
| TransactionType | Yes | string | UINT16 | URITokenMint |
Identifies this as a URITokenMint transaction. |
| URI | Yes | string | BLOB | N/A | The URI the token points to. |
| Digest | No | string | HASH256 | N/A | An SHA512-Half integrity digest of the contents pointed to by the URI |
| Flags | No | number | UINT32 | 0 |
tfBurnable (0x00000001) or 0 or absent |
Field Details:
3.2.1.1. Digest¶
If Digest is specified then the minted token will contain the hash specified by this field. For the end user this means they can verify the content served at the URI against this immutable hash, to ensure, for example that the properties of the NFT are not maliciously altered by changing the content at the URI. It may also be desirable to have a dynamic NFT where the content is intended to be altered, in which case simply omit Digest during minting, and the resulting URIToken will not contain this field.
3.2.2. Flags¶
| Flag Name | Flag Value | Description |
|---|---|---|
tfBurnable |
0x00000001 |
If Flags is present and set to tfBurnable then the URIToken may be later burned by the Issuer. |
3.2.3. Transaction Fee¶
TODO: content pass.
3.2.4. Failure Conditions¶
3.2.4.1. Data Verification¶
TODO: content pass.
3.2.4.2. Protocol-Level Failures¶
- A
URITokenwith the sameIssuerandURIexists in the ledger, because the object identifier is derived from these two values (see Object Identifier). (TODO: content pass — result code.)
3.2.5. State Changes¶
- Create a new
URITokenobject with theAccountas itsIssuerand as its firstOwner. - If
Digestis specified, the minted token contains the hash specified by this field. - The
URITokenlocks up an owner reserve on theAccount.
3.2.6. Example JSON¶
Example Mint:
{
"Account": "raKG2uCwu71ohFGo1BJr7xqeGfWfYWZeh3",
"Digest": "894E3B7ECDC9F6D00EE1D892F86E9BF0098F86BBD6CBB94D6ABFD78030EB5B9B",
"TransactionType": "URITokenMint",
"URI": "68747470733A2F2F6D656469612E74656E6F722E636F6D2F666752755A7A662D374B5541414141642F6465616C2D776974682D69742D73756E676C61737365732E6A736F6E"
}
3.3. Transaction: URITokenBurn¶
3.3.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
| TransactionType | Yes | string | UINT16 | URITokenBurn |
Identifies this as a URITokenBurn transaction. |
| URITokenID | Yes | string | HASH256 | N/A | The Keylet for the URIToken object being destroyed |
3.3.2. Transaction Fee¶
TODO: content pass.
3.3.3. Failure Conditions¶
3.3.3.1. Data Verification¶
TODO: content pass.
3.3.3.2. Protocol-Level Failures¶
- The
Accountis not the current owner of the URIToken, and is not its Issuer. (TODO: content pass — result code.) - The
Accountis the Issuer but not the current owner, andtfBurnablewas not set during minting (see Deletion). (TODO: content pass — result code.)
3.3.4. State Changes¶
- Burning a URIToken removes the specified
URITokenobject from the ledger and from the owner’s directory.
3.3.5. Example JSON¶
Example Burn:
{
"Account": "r9XAC6zP5Db4qZBgRbweKUPtroxYnydTEQ",
"TransactionType": "URITokenBurn",
"URITokenID": "0FAC3CD45FCB800BB9CCCF907775E7D4FB167847D8999FF05CE7456D6C3A70FA"
}
3.4. Transaction: URITokenCreateSellOffer¶
A user may offer to sell their URIToken for a preset amount. There are no buy offers. If a user executes a URITokenBuy then it must immediately cross an existing sell offer.
To offer the URIToken for sale: specify its URITokenID, an Amount to sell for, and optionally a Destination.
3.4.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
| TransactionType | Yes | string | UINT16 | URITokenCreateSellOffer |
Identifies this as a URITokenCreateSellOffer transaction. |
| URITokenID | Yes | string | HASH256 | N/A | The Keylet for the URIToken object being offered for sale |
| Amount | Yes | string or object | AMOUNT | N/A | The minimum amount a buyer must pay to purchase this URIToken. May be an IOU or XRP. |
| Destination | No | string | ACCOUNT | N/A | If provided then only this account may purchase the URIToken. |
3.4.2. Transaction Fee¶
TODO: content pass.
3.4.3. Failure Conditions¶
3.4.3.1. Data Verification¶
- The
Amountis 0 and noDestinationis set. If the Amount is 0 then a Destination must be set. (This prevents an accidental "transfer to anyone" scenario.) (TODO: content pass — result code.)
3.4.3.2. Protocol-Level Failures¶
TODO: content pass.
3.4.4. State Changes¶
- The URIToken is offered for sale for the
Amount. IfDestinationis set then only the specified account may purchase the URIToken. - A given URIToken may have at most one current sell offer. If a previous sell offer was present on the URIToken then it is simply replaced with the new offer.
3.4.5. Example JSON¶
Example Sell:
{
"Account": "r9XAC6zP5Db4qZBgRbweKUPtroxYnydTEQ",
"Amount": "100000",
"Flags": 524288,
"TransactionType": "URITokenCreateSellOffer",
"URITokenID": "0FAC3CD45FCB800BB9CCCF907775E7D4FB167847D8999FF05CE7456D6C3A70FA"
}
3.5. Transaction: URITokenBuy¶
A user may purchase a URIToken from another user if that URIToken has an active sell offer on it.
To purchase the URIToken, a user specifies its URITokenID and a purchase Amount.
3.5.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
| TransactionType | Yes | string | UINT16 | URITokenBuy |
Identifies this as a URITokenBuy transaction. |
| URITokenID | Yes | string | HASH256 | N/A | The Keylet for the URIToken object being purchased. |
| Amount | Yes | string or object | AMOUNT | N/A | The purchase price the buyer is willing to send. Must be the same currency as the sell offer. May not be less than the sale amount. |
3.5.2. Transaction Fee¶
TODO: content pass.
3.5.3. Failure Conditions¶
3.5.3.1. Data Verification¶
- The transaction uses pathing. No pathing is allowed in this transaction. (TODO: content pass — result code.)
3.5.3.2. Protocol-Level Failures¶
- The URIToken has no active sell offer (no
Amountfield in theURITokenobject). (TODO: content pass — result code.) - A
Destinationis present in theURITokenobject and theAccountis not that AccountID. (TODO: content pass — result code.) - The purchase
Amountis less than the amount specified in the sell offer. The purchase amount must be at least the amount specified in the sell offer (but may also exceed if the user wishes to tip the seller.) (TODO: content pass — result code.) - The purchase
Amountis not the same currency as the amount in the sell offer. (TODO: content pass — result code.) - The user does not have sufficient currency available to cover the purchase. (TODO: content pass — result code.)
3.5.4. State Changes¶
- The buyer becomes the current
Ownerof the URIToken. - The purchase
Amount, including any amount above the sell offer, is sent to the seller.
3.5.5. Example JSON¶
Example Buy:
{
"Account": "rpiLN1C94hGKGpLUbhsadVHzdSXtB2Ldra",
"Amount": "100001",
"TransactionType": "URITokenBuy",
"URITokenID": "0FAC3CD45FCB800BB9CCCF907775E7D4FB167847D8999FF05CE7456D6C3A70FA"
}
3.6. Transaction: URITokenCancelSellOffer¶
When a user has offered their URIToken for sale and later changes their mind, they may perform a clear operation.
3.6.1. Fields¶
| Field Name | Required | JSON Type | Internal Type | Default Value | Description |
|---|---|---|---|---|---|
| TransactionType | Yes | string | UINT16 | URITokenCancelSellOffer |
Identifies this as a URITokenCancelSellOffer transaction. |
| URITokenID | Yes | string | HASH256 | N/A | The Keylet for the URIToken object being cleared of any active sell offer. |
3.6.2. Transaction Fee¶
TODO: content pass.
3.6.3. Failure Conditions¶
TODO: content pass.
3.6.4. State Changes¶
- A clear operation simply clears the current sell offer from the URIToken.
3.6.5. Example JSON¶
Example Clear
{
"Account": "rpiLN1C94hGKGpLUbhsadVHzdSXtB2Ldra",
"TransactionType": "URITokenCancelSellOffer",
"URITokenID": "0FAC3CD45FCB800BB9CCCF907775E7D4FB167847D8999FF05CE7456D6C3A70FA"
}
4. Rationale¶
TODO: content pass.
5. Security Considerations¶
5.1. Issuer Hooks on Burnable URITokens¶
‼️ If the Hooks amendment is active on the chain the tfBurnable flag also indicates that the Issuer is a strong transactional stakeholder. In this event the Issuer's hooks will be executed whenever an attempt to buy or sell this URIToken occurs, and those hooks may reject the transaction and prevent it from happening if their own internal logic is not satisfied. It is therefore highly advisable to check whether or not a URIToken has tfBurnable set before purchasing or accepting it in trade.
Appendix¶
Appendix A: URI Metadata Schema¶
The URI pointed to by a URIToken should resolve to a JSON document that follows the below schema.
This schema may be extended over time as additional categories and use-cases present themselves.
‼️ Note that the Digest, if provided during Minting, is the hash of this JSON document not the content pointed to by the JSON document. The Digest is calculated by taking the SHA-512 Half of the stringified, whitespace trimmed content JSON.
- Schema gist: https://gist.github.com/WietseWind/83cd89906ed79fb510ec1eae3fc70bb6
- Sample digest generator gist: https://gist.github.com/WietseWind/d5072777814b6f239c3baba5cbe29e39
A.1. JSON Schema¶
export interface xls35category {
code: string
description: string
}
// EXAMPLES (!)
export const xls35categories: xls35category[] = [
{ code: '0000', description: 'Testing-purpose token' },
{ code: '0001', description: 'Art' },
{ code: '0001.0001', description: 'Physical art' },
{ code: '0001.0002', description: 'Digital art' },
{ code: '0002', description: 'Licenses' },
{ code: '0002.0001', description: 'Software licenses' },
{ code: '0003', description: 'Admission tickets' },
{ code: '0004', description: 'Ownership (physical)' },
{ code: '0004.0001', description: 'Land (plots)' },
{ code: '0004.0002', description: 'Time shares' },
]
export interface xls35attachment {
description?: string
filename: string
url: string
}
export interface xls35schema {
// Custom schema for additional information
schema?: {
url: string
digest?: string
}
// Custom external information, to match your own specified schema (^^)
content?: {
url: string
digest?: string
}
// Basic information: to allow instant rendering, ...
details: {
title: string
categories?: xls35category[]
publisher?: {
name: string
url?: string
email?: string
}
previewUrl?: {
thumbnail: string
regular?: string
highres?: string
}
group?: {
code?: string
title: string
}
attachments?: xls35attachment[]
}
}
A.2. Example JSON document¶
{
"content": {
"url": "https://someuri"
},
"details": {
"title": "Some URIToken",
"categories": ["0000"],
"publisher": {
"name": "XRPL-Labs"
}
}
}
A.3. Computing the Digest over your JSON document¶
Pseudo-code:
metadata = {
details: {
title: "Some Title",
},
};
jsonstring = json_encode(metadata);
whitespaceremoved = trim(jsonstring);
hash = sha512(whitespaceremoved);
sha512half = slice(hash, 0, 64);
digest = sha512half;