Skip to content

Commit a9c750d

Browse files
committed
Add a Field Name Format section
1 parent 10a2dac commit a9c750d

File tree

1 file changed

+17
-2
lines changed
  • XLS-0089-multi-purpose-token-metadata-schema

1 file changed

+17
-2
lines changed

XLS-0089-multi-purpose-token-metadata-schema/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,24 @@ MPTs include a 1024-byte field for arbitrary metadata. The metadata field is par
8989

9090
---
9191

92-
### JSON Metadata example
92+
## 3. Field Name Format
9393

94-
Note: The Key values from the tables above are used as the property names in the JSON metadata object.
94+
The metadata schema supports JSON objects with both long field names (e.g., `ticker`, `name`, `desc`) and short key names (e.g., `t`, `n`, `d`). However, it is recommended to use short key names to reduce storage requirements of the ledger. The MPT metadata field has a 1024-byte limit, and using compact keys can reduce the metadata size and allow more information to be stored within the available space.
95+
96+
### 3.1 Client Library Support
97+
98+
XRPL client libraries will provide utility functions to facilitate working with metadata in both formats:
99+
100+
- **Encoding utility**: Converts JSON metadata to hexadecimal format for on-ledger storage. If long field names are provided, the utility will automatically shorten them to their compact key equivalents before encoding.
101+
- **Decoding utility**: Converts hexadecimal metadata from the ledger back to JSON format. The utility will expand short keys back to their full field names for improved readability.
102+
103+
This approach provides flexibility for developers while ensuring efficient on-ledger storage. Developers can work with human-readable long field names in their applications, and the client libraries will handle the conversion to compact format automatically.
104+
105+
---
106+
107+
### 3.2 JSON Metadata Example
108+
109+
The example below demonstrates the recommended format using short key names. Note that the **Key** values from the tables in Section 2 are used as the property names in the JSON metadata object.
95110

96111
```json
97112
{

0 commit comments

Comments
 (0)