Skip to content

Introduce compact keys for JSON metadata fields to reduce size of JSON metadata object#390

Merged
mvadari merged 5 commits intoXRPLF:masterfrom
kuan121:xls-0089-use-short-key-for-metadata-field
Oct 29, 2025
Merged

Introduce compact keys for JSON metadata fields to reduce size of JSON metadata object#390
mvadari merged 5 commits intoXRPLF:masterfrom
kuan121:xls-0089-use-short-key-for-metadata-field

Conversation

@kuan121
Copy link
Contributor

@kuan121 kuan121 commented Oct 3, 2025

High Level Changes

  1. Introduce compact keys for JSON metadata fields to reduce size of JSON metadata object
  2. Remove unnecessary URL scheme, i.e., HTTPS://

Why

This PR is meant to address WietseWind's comment in this discussion about reducing the size of JSON metadata object. With the proposed change, we can achieve a ~27.6% size reduction (from ~626 bytes to ~453 bytes) for the JSON Metadata example provided in XLS-89 Multi-Purpose Token Metadata Schema.

Before

JSON Metadata example (626 bytes)

{
  "ticker": "TBILL",
  "name": "T-Bill Yield Token",
  "desc": "A yield-bearing stablecoin backed by short-term U.S. Treasuries and money market instruments.",
  "icon": "https://example.org/tbill-icon.png",
  "asset_class": "rwa",
  "asset_subclass": "treasury",
  "issuer_name": "Example Yield Co.",
  "urls": [
    {
      "url": "https://exampleyield.co/tbill",
      "type": "website",
      "title": "Product Page"
    },
    {
      "url": "https://exampleyield.co/docs",
      "type": "docs",
      "title": "Yield Token Docs"
    }
  ],
  "additional_info": {
    "interest_rate": "5.00%",
    "interest_type": "variable",
    "yield_source": "U.S. Treasury Bills",
    "maturity_date": "2045-06-30",
    "cusip": "912796RX0"
  }
}

After

JSON Metadata example (453 bytes)

{
  "t": "TBILL",
  "n": "T-Bill Yield Token",
  "d": "A yield-bearing stablecoin backed by short-term U.S. Treasuries and money market instruments.",
  "i": "example.org/tbill-icon.png",
  "ac": "rwa",
  "as": "treasury",
  "in": "Example Yield Co.",
  "us": [
    {
      "u": "exampleyield.co/tbill",
      "c": "website",
      "t": "Product Page"
    },
    {
      "u": "exampleyield.co/docs",
      "c": "docs",
      "t": "Yield Token Docs"
    }
  ],
  "ai": {
    "interest_rate": "5.00%",
    "interest_type": "variable",
    "yield_source": "U.S. Treasury Bills",
    "maturity_date": "2045-06-30",
    "cusip": "912796RX0"
  }
}

@kuan121 kuan121 marked this pull request as ready for review October 3, 2025 21:11
@kuan121 kuan121 force-pushed the xls-0089-use-short-key-for-metadata-field branch from 7be66d0 to 4e2200f Compare October 3, 2025 21:54
@kuan121 kuan121 changed the title Introduce compact field keys for JSON metadata to reduce size of JSON metadata object Introduce compact keys for JSON metadata fields to reduce size of JSON metadata object Oct 3, 2025
@julian78780
Copy link
Contributor

Hey @WietseWind - this PR reflects the key proposals from our earlier discussions, and we’re aligned with the direction.

We propose to use the short-key format only, primarily for simplicity and to be sensible about on-ledger storage, given that all of this data is immutable once written. We also agree that we should avoid maintaining multiple standards over time, so let’s aim to settle on this one.

We’ll keep this PR open for two weeks for comments, and plan to merge afterward unless there are major objections.

Regarding encoding, we’d prefer to keep it as JSON. As you mentioned, it’s the simplest and most approachable option for the average developer.

For context, we’re also working on the XRPL Meta implementation, which will follow this short-key structure.

@WietseWind
Copy link
Contributor

Wonderful, thanks. Agree on all fronts/

@kuan121 kuan121 force-pushed the xls-0089-use-short-key-for-metadata-field branch from 55233fe to d875117 Compare October 29, 2025 20:15
Copy link

@Patel-Raj11 Patel-Raj11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mvadari mvadari merged commit e6689b3 into XRPLF:master Oct 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants