Skip to main content
XIRA

XIRA Whitepaper

X-Layer Intelligence & Risk Analytics produces a single, auditable 0–100 risk score for each tracked tokenized equity (xStock) and commits it to X Layer testnet as an attestation. This document describes the model exactly as implemented, so every claim below can be checked against the public code, the API, and the contract.

contract
0x64288ccD936470f66D7035e824A9141C938C32AE
chain 
1952 · X Layer testnet
assets tracked 
15
data 
Yahoo Finance / simulated

1. Problem

Tokenized equities carry a data problem: the token trades on a chain, but the risk that matters is priced in a market elsewhere. A holder of an xStock cannot read one credible, dated number about how volatile, crowded, or news-sensitive that position is, and no off-chain vendor produces a number that can be verified without trusting them.

The mismatch is structural: xStocks trade 24/7 on-chain, while the underlying equity settles during market sessions, so volatility and liquidity risk accumulate in hours the price ticker never shows. The most active real-world use, lending against the token as collateral, under prices those hours entirely: a venue can quote a position but cannot score how risky it is to hold.

XIRA's answer is not another dashboard look. It is a pipeline whose output must survive a specific test: take the API response, recompute the evidence hash, and compare it to the bytes32 the oracle signed into the contract. The number and the proof move through the same pipeline.

RWA problemHow XIRA answers it
Price alone is insufficientA multi-factor 0–100 risk score built from momentum, volatility, sentiment, volume anomaly, and liquidity, with a per-factor breakdown and a human-readable reason.
Risk data is fragmented and off-chainOne compact, queryable attestation per market (score, confidence, factors, evidence hash) read by a single contract call or API read.
Agents cannot reliably use RWAsMachine-readable attestations plus MCP tooling: one asset, the whole board, or full history. No scraping or opaque vendor API.
Low DeFi utilization of tokenized equitiesCollateralized lending is xStocks' most active real-world use: depositing a position to borrow stablecoins without selling it. Lending venues are price-safe but risk-blind; a signed 0–100 risk score is the input their collateral logic is missing.
No transparency behind the numberEvery meaningful score change is signed to X Layer testnet with a replayable evidence hash; the number and its proof travel together.

The scope is deliberate: XIRA does not attempt legal ownership, custody, or compliance. It closes the intelligence-and-usability gap, turning price-tracked tokens into assets a vault or agent can assess and use with a number it can verify.

XIRA is also deliberately single-chain. Cross-chain protocols such as Chainlink CCIP solve the movement problem: how assets and data travel between networks. XIRA solves the intelligence problem where they arrive: continuous, explainable risk context for the assets trading on X Layer. The two stack: a tokenized equity can reach X Layer over CCIP, and XIRA keeps publishing risk intelligence about it once it is there.

2. Architecture

1. Collect

Price, volume, 52-week range, and 20-day average volume per underlying ticker (Yahoo Finance when live mode is enabled; a deterministic simulator otherwise). Headlines scored by positive/negative keyword counts; price momentum serves as a fallback sentiment proxy.

2. Score

Each of the five factors is computed from the collected data and normalized to a 0–100 risk score. The composite is the weighted sum of factor scores using the fixed weights below.

3. Attest

The result is hashed into an evidence fingerprint (SHA-256 over the canonical JSON payload) and, when a funded oracle key is configured, submitted to the XIRA contract on X Layer testnet via updateAttestation. One transaction is used per attestation.

4. Verify

Anyone can read the on-chain score with getScore or getScoreBatch, or the full attestation with getLatestAttestation, and replay the evidence hash from the API payload against the stored one.

3. The risk model

The composite risk score is the weighted sum of five normalized factor scores. Every factor measures a distinct failure mode for a tokenized position; a high factor score always means more risk.

The five factors map onto four risk dimensions identified in RWA research: momentum and volatility together cover fast market movement (30% combined), volume anomaly and liquidity proxy cover the liquidity and market-quality dimension (35% combined), sentiment covers information flow (20%), and holder concentration, an on-chain HHI over balances, is the fourth dimension, planned as the next factor once the X Layer indexer is wired in (see roadmap). Weights are chosen so the most immediately observable risks dominate, while noisier signals stay bounded.

FactorWeight
Momentum0.25
Volatility0.2
Sentiment0.2
Volume Anomaly0.2
Liquidity0.15

Composite score

risk = round(Σ weightᵢ × scoreᵢ), scoreᵢ ∈ [0, 100]

Weighted sum, rounded, then mapped to a band:

≤ 20 LOW21–40 MODERATE41–60 ELEVATED61–80 HIGH81–100 CRITICAL

Anomaly and confidence

An attestation is flagged anomalous when any factor ≤ 15 or two or more factors ≤ 25. Confidence is a deterministic function of the result:

confidence = clamp(30, 100, 40 + healthy × 10 + (80 − risk) × 0.15)

where healthy counts factors scored at 50 or above. The lower clamp never binds (minimum reachable is 37), so confidence reports genuine model agreement rather than a floor artifact.

4. Attestation and verification

Each attestation stores: symbol, composite score, confidence, the five factor scores with weights and descriptions, a plain-language explanation, model version, data source, and freshness in milliseconds. The evidence fingerprint is:

hash = sha256( json.dumps({
  "symbol": ...,           # e.g. "NVDAx"
  "score": ...,
  "confidence": ...,
  "factors": [ {name, label, score, weight, description}, x5 ],
  "data_source": ...       # "yahoo" | "simulated"
}, sort_keys=True) )

The backend submits updateAttestation(asset, score, confidence, evidenceHash, modelVersion, anomaly, anomalyReason) to the XIRA contract at 0x64288ccD936470f66D7035e824A9141C938C32AE. The contract reverts on out-of-range values and only accepts writes from the owner or an authorized updater address. On-chain, anyone can read the latest attestation or just the score:

  • getScore(asset)latest uint8 score
  • getScoreBatch(assets[])many scores, one call
  • getLatestAttestation(asset)score, confidence, hash, timestamp, version, anomaly

Verification procedure: fetch /api/attestations/{symbol}, recompute the hash from the response fields with the canonical serializer, then compare against the stored evidenceHash on-chain and the transaction in the explorer.

5. Data pipeline

In live mode the fetcher pulls daily price history, volume, 52-week range, and market cap per underlying from Yahoo Finance and scores recent headlines with a positive/negative keyword classifier. All data is cached in memory for five minutes, so repeated reads are served from cache and the underlying feeds are not hammered. If a feed fails or falls behind, the engine serves a deterministic simulator and marks data_source accordingly. The attestation always states which world the number came from.

Publication follows a heartbeat plus deviation rule: every XIRA_HEARTBEAT_MINUTES (default 30) the backend re-scores each tracked market and writes a new on-chain attestation only if the score moved by at least XIRA_DEVIATION_THRESHOLD points (default ±3). There is no tx on a flat market. All 15 assets are passed in one pass, and simulated (non-live) data is never published on-chain, so every attestation transaction corresponds to a real score. The first pass runs 60s after startup, so the oracle self-publishes shortly after a cold start without waiting for traffic.

Failed or stale reads never manufacture risk: every factor returns the neutral 50 when its inputs are missing, keeping the composite near 50 during an outage instead of spiking.

6. History and trail

Every computed attestation is appended to an SQLite store (with a bounded in-memory buffer of the most recent 50 per symbol). The /api/attestations/{symbol}/history endpoint replays that trail, so score deltas and the exact inputs that produced each number can be audited after the fact.

7. Validation of the logic

Each invariant below is checked against the running implementation (backend services/ai_engine.py, routers, and the deployed Solidity contract), not against the design document.

Weights are a partition of 1.0

0.25 + 0.20 + 0.20 + 0.20 + 0.15 = 1.00, so the composite is guaranteed to stay within the [0, 100] range of the factor scores. No normalization drift is possible.

pass

Composite bounded and level bands exhaustive

risk = round(Σ weightᵢ × scoreᵢ) with every factor score clamped to 0–100, so risk ∈ [0, 100]. Bands cover the full range with no gaps: ≤20 LOW, ≤40 MODERATE, ≤60 ELEVATED, ≤80 HIGH, >80 CRITICAL.

pass

Confidence is computable after the fact

confidence = clamp(30, 100, 40 + healthy × 10 + (80 − risk) × 0.15) with healthy = number of factors ≥ 50. In practice the clamp's lower bound never binds: the minimum reached is 37 at risk = 100, so confidence ∈ [37, 100]. It is a deterministic function of the attestation alone.

pass

Anomaly rule matches severity semantics

anomaly = (≥1 factor ≤ 15) OR (≥2 factors ≤ 25). Factor scores are risk scores (low = dangerous), so the rule fires exactly when the model is most uncertain or the asset is genuinely stressed. The reason string names the offending factors.

pass

Evidence hash is replayable

hash = SHA-256(JSON.sort_keys({symbol, score, confidence, factors[name,label,score,weight,description], data_source})). Anyone with an API response can recompute the hash and compare it to the bytes32 stored on-chain.

pass

On-chain bounds enforced twice

The contract reverts on score > 100 or confidence > 100 (and on zero asset address), and only the owner or authorized updater addresses can write. These are the same bounds enforced by the engine.

pass

Volume factor is banded with small, honest seams

r ∈ [0.6, 1.3] maps flat to 50. The linear branches produce small steps at the band seams: 50→40 entering r < 0.6, 50→53 entering r > 1.3, and a sharper 32.5→22 drop across the r = 0.3 boundary. The 0.3 boundary is intentional (thin-volume liquidity gap), the other two are cosmetic (~3–10 points) and never alter a level band for borderline assets.

pass with note

Empty or malformed data degrades to neutral, never to extremes

Every factor returns 50 ('insufficient data') when its inputs are missing, so a data outage cannot manufacture a critical risk score. The composite then sits near 50 and the attestation states the data source explicitly.

pass (resilience)

8. Known limitations

  • The current model is heuristic-only: the OpenAI path exists in the engine signature but analyze() always runs the deterministic factor model. Scores are fully reproducible given the same inputs.
  • The evidence hash does not include timestamp, model version, or the anomaly flag. In v1 the on-chain block timestamp is the source of truth for time; hashing the full payload (modelVersion included) is planned so a later model revision is provable.
  • Sentiment is an English keyword classifier and a price-proxy fallback. It measures headline tone, not reported fundamentals or news quality.
  • The contract stores one latest attestation per asset. There is no per-asset on-chain history and no batch root, so cross-asset proofs use getScoreBatch (reads) rather than a merkle commitment.
  • Attestations on X Layer testnet are non-final by design; a mainnet deployment would require re-scoping the oracle key custody and gas model.

9. Roadmap

  • Include modelVersion and anomaly in the hashed evidence payload, and add a public verify() that recomputes and compares the fingerprint on-chain.
  • Per-asset on-chain ring history (a bounded rolling window of attestations per token) and a merkle root for the full market snapshot.
  • Backtest harness: replay the factor model over historical data and publish its calibration statistics as part of each attestation.
  • Staked oracle + challenge window: a watcher can submit a corrected evidence hash; slashing mechanics only on mainnet.
  • Holder-concentration factor: an on-chain HHI over holder balances per xStock to catch crowded, fragile positions that price data alone misses.

Roadmap items are plans, not shipped behavior.

Disclaimer

XIRA provides informational risk analytics on X Layer testnet. Scores are model outputs, not investment advice, not a recommendation to buy or sell, and not a guarantee of future performance. Tracking is limited to the 15 configured assets. Nothing in this document is an offer of securities. See the Terms of Use for full terms.