Swarm KYA JSON-LD — Consumer Processing Guide (v1.1)
Purpose
Each asset page includes a hidden, machine-readable JSON-LD block at the end of the document. This block is the canonical data source for integrations, indexing, and automation. Human-facing tables are informative only.
Example (pretty-printed by default):
<script type="application/ld+json">
{
"type": "Asset",
"...": "..."
}
</script>
Audience
Consumers of KYA data (indexers, apps, validators, explorers).
1) Discovery
- In the rendered HTML of an asset page, select the last
<script type="application/ld+json">…</script>block. - Parse JSON and assert
type === "Asset". If absent, treat the page as not machine-ready. - Producers may emit either pretty-printed (default) or minified JSON. Consumers must accept both.
Robust extraction (pseudo)
Prefer DOM parsing; fallback to regex only if DOM is unavailable. If multiple JSON-LD blocks exist, pick the last one where type equals "Asset".
2) Data Model (summary)
Root object: type: "Asset"
| Field | Type | Req | Notes |
|---|---|---|---|
displayTitle | string | ✓ | Title string. |
assetType | string | ✓ | e.g., “Stock Certificate Token”. |
symbol | string | ✓ | Primary ticker. |
isin | string | Optional. | |
wkn | string | Optional. | |
underlying | object | ✓ | { name, assetType, symbol?, isin?, wkn? }. |
tokenStandard | string | ✓ | Constant: "SX1411". |
documents | object | { prospectusFinalTerms?, baseProspectus?, terms[]? }. | |
actors | object | ✓ | Roles: issuer, guardian, agent → { title, url? }. |
onChain | array | ✓ | Deployments (see below). |
versions | object | ✓ | { kyaVersion, tokenVersion }. |
swarm | object | { assetId?, kyaId? }. | |
extra | object | Passthrough for future fields. | |
createdAt / updatedAt | ISO 8601 | Optional timestamps. |
On-chain deployment item
{
"network": "Polygon PoS", // label in human table
"chainId": 137, // integer
"tokenAddress": "0x...", // EVM address
"ticker": "AAPL", // often same as root symbol
"decimals": 18, // 0–36
"usdcTokenAddress": "0x..." // optional; present where USDC redemption applies
}
Documents
baseProspectus— URL (if present).prospectusFinalTerms— URL (if present).terms[]— array of{ title?, url }items.
Versions
kyaVersion— KYA document version string.tokenVersion— token implementation version string.
3) Processing Rules
- Canonical: JSON-LD overrides human tables when discrepancies are found.
- Deployment key: index deployments by
(symbol, network, chainId, tokenAddress). - Ticker default: if omitted, assume
ticker = symbol. - USDC redemption: if
usdcTokenAddressis present, redemption is available on that network. - Extras: preserve unknown fields under
extrafor forward compatibility. - Timestamps: parse
createdAt/updatedAt(if present) as ISO 8601.
4) Validation Hints (Consumer-side)
typemust equal"Asset".tokenStandardmust equal"SX1411".actorsmust includeissuer,guardian,agentwith atitlestring.onChainmust have ≥ 1 item. Each item:chainIdinteger;decimalsinteger in[0,36].- EVM addresses:
^0x[a-fA-F0-9]{40}$(relax if a non-EVM network appears in the future).
5) Integration Examples
Node.js (jsdom)
import { JSDOM } from "jsdom";
export function extractAssetJSONLD(html) {
const dom = new JSDOM(html);
const scripts = [...dom.window.document.querySelectorAll("script[type='application/ld+json']")];
for (const el of scripts.reverse()) {
try {
const obj = JSON.parse(el.textContent);
if (obj && obj.type === "Asset") return obj;
} catch {}
}
throw new Error("No Asset JSON-LD found");
}
Python (BeautifulSoup + json)
Code fences use txt intentionally to avoid renderer restrictions.
from bs4 import BeautifulSoup
import json
def extract_asset_jsonld(html: str):
soup = BeautifulSoup(html, "html.parser")
blocks = soup.find_all("script", {"type": "application/ld+json"})
for b in reversed(blocks): # prefer last
try:
data = json.loads(b.string)
if isinstance(data, dict) and data.get("type") == "Asset":
return data
except Exception:
pass
raise ValueError("No Asset JSON-LD found")
6) Versioning & Compatibility
- Schema version: v1.1 (no breaking changes).
- Consumers should ignore unknown fields to remain forward-compatible.
Changelog
- 2025-09-26 (v1.1): Document that JSON-LD is pretty-printed by default; minified is still valid.
- 2025-09-26 (v1.0): Initial publication.
