Last reviewed: 2026-11-21
Every quote, fill, failure, and settlement latency an anchor produces is recorded as an outcome. Outcomes aggregate into a public, user-verifiable score. The goal is carrot, not stick: an anchor earns a track record it can point to.
Source of truth: lib/reputation/,
types/reputation.ts, the
/api/reputation/* routes, and the Soroban contract in
contracts/reputation/ (see
docs/ORACLE_SPEC.md).
This project keeps two separate records about an anchor, and the difference between them is the difference between what we watched and what a user lived through.
| Health | Reputation | |
|---|---|---|
| Measures | What we observed by probing | What happened when someone settled |
| Signals | uptime, quote availability, issuer match, TOML integrity | fill rate, settlement time, slippage |
| Source | probe_samples, written every five minutes |
outcome_log, written on settlement |
| Needs | nothing from the anchor or the user | real completed transactions |
| Method | lib/reputation/health.ts |
lib/reputation/composite.ts |
Health never contributes to the composite score. An anchor can be perfectly healthy and still carry no reputation score at all, and that is the honest reading: it has not performed badly, it has not been observed performing.
Both are published. Anything that reports one is labelled with which one it is —
the leaderboard response carries an explicit
basis: { reputation: 'execution-outcomes', health: 'probe-observations' }.
Defined in lib/reputation/health.ts. Every
registered anchor is probed on a five-minute clock across four signals, each
stored as a ProbeKind row in probe_samples, keyed by the anchor's probe
domain (serviceDomain ?? homeDomain):
| Signal | ProbeKind |
What it checks |
|---|---|---|
| Uptime | uptime |
The anchor's stellar.toml resolves and is reachable. |
| Quote availability | quote |
A SEP-38 quote round-trip returns a quote. |
| Issuer match | issuer-mismatch |
The issuer the anchor advertises still matches the asset on-chain. |
| TOML integrity | toml-integrity |
The stellar.toml still parses and validates. |
The health score is a weighted mean over the signals that were actually sampled, with the weights renormalised across exactly those:
healthScore = Σ wᵢ · successRateᵢ ÷ Σ wᵢ (over signals with samples > 0)
HEALTH_WEIGHTS = { uptime: 0.4, quoteAvailability: 0.2,
issuerMatch: 0.2, tomlIntegrity: 0.2,
depositAvailability: 0 }
Uptime carries the most weight because it is the signal a user feels first: an anchor that does not answer cannot be used at any price.
depositAvailability is reported next to the four scored signals and has weight 0:
the SEP-24 deposit probe (one sample per deposit asset, stored as kind deposit)
says whether an anchor has switched deposits off while withdrawals keep working, which
is a different question from whether it is healthy to withdraw through today. Its rows
are also left out of the sample count, the score threshold and the probing streak, so
the withdraw-side numbers read the same with or without a deposit sweep. A disabled
deposit is a verdict about the anchor; a deposit probe that could not complete is not.
For the two comparison signals — issuer match and TOML integrity — a probe row
counts only if it either succeeded or produced that signal's own verdict:
mismatch for the issuer check, integrity for the TOML check. A row that
failed for any other reason means the check never reached a verdict, and it is
excluded from the signal's counts entirely and reported separately as
incomplete.
This is not a technicality. MoneyGram's issuer check has 583 rows in the ledger,
zero successes, and has never once returned mismatch — every failure is
unknown, meaning the check did not complete. Counting those as failures would
publish "issuer match: 0%" about a real company on a public page, which is an
accusation the data does not support. The probe layer already draws this
distinction; probeIssuerMismatch documents that an unreachable result "covers
both a genuine mismatch … and a probe that could not complete".
Uptime and quote availability are liveness observations rather than comparisons, so every failure counts for those two: a request that did not come back is the answer, whatever the transport reason.
Two further rules follow from the renormalisation, and both are deliberate:
successRate is null, and
the UI prints not sampled rather than 0%.MIN_HEALTH_SAMPLES (12, roughly one hour of probing) no score is
published. The signals are still reported, because they are observations
and they are true; the state is insufficient_data and healthScore is
null.observedDays and continuousDays come from the same
buildProbeCoverageReport that backs GET /api/reputation/probe-coverage, so
the two surfaces cannot disagree. A streak whose last observation is older than
yesterday is reported as 0 — an anchor last probed a week ago is not on a
seven-day run.
Defined in lib/reputation/composite.ts:
score = fillRate × (1 − slippage) ÷ (settleSeconds / NORM_SETTLE_SECONDS)
fillRate — fraction of quotes that settled, [0, 1].slippage — fractional gap between quoted and delivered value, [0, 1].settleSeconds — median settlement time; floored at MIN_SETTLE_SECONDS (1).NORM_SETTLE_SECONDS = 300 — the "baseline fast" reference.A score of 1.0 = perfect fill, zero slippage, settled at exactly the 300 s reference. > 1.0 = faster than reference. Higher is better.
Stated here rather than left for a reader to discover, because a published method that does not match the running code is worse than no published method.
composite() is the
formula published here and written on-chain. The corridor leaderboard, the
standings page and lib/reputation/scores.ts all rank on
weightedComposite() instead — a clamped 0.4 × fill + 0.3 × (1 − slippage/0.05) + 0.3 × (1 − settle/300) bounded to [0, 1]. The two produce
different orderings. lib/reputation/composite.ts acknowledges the split in
its own comments; the choice is still open (the follow-up to #917).state flips at one outcome, not thirty. MIN_SAMPLES = 1 in
lib/reputation/aggregate.ts is what moves a scorecard from
insufficient_data to ok. MIN_OUTCOMES_THRESHOLD = 30 is a display
threshold only — it gates the "Collecting Data" notice in the UI. The
progression table below describes the display threshold.lib/reputation/bands.ts maps a raw score to a band
via SCORE_THRESHOLDS (getScoreBand / getBandLabel) so the UI can render
confidence labels rather than raw floats.
The reputation store is pluggable (lib/reputation/store.ts):
lib/reputation/sqlite.ts).lib/reputation/postgres.ts).Aggregation, bucketing, reconciliation, locking, and PII redaction live alongside
(aggregate.ts, buckets.ts, reconcile.ts, lock.ts, redact.ts). Migrations
are in lib/reputation/migrations/.
| Method & path | Purpose |
|---|---|
GET /api/reputation/actuarial |
settlement-SLA actuarial accumulation (#813). |
GET /api/reputation/leaderboard?corridor=… |
Ranked anchors (optionally per-corridor). |
GET /api/reputation/probe-coverage |
90-day probe-accumulation progress JSON. |
GET /api/reputation/[anchor] |
Current score + bands for one anchor. |
GET /api/reputation/[anchor]/history?window=… |
Historical score series. |
POST /api/reputation/append |
Append a signed outcome tuple. |
POST /api/reputation/dispute |
File a dispute against an outcome. |
GET|POST /api/reputation/reconcile |
Reconcile aggregates (maintenance). |
GET|POST /api/reputation/reconcile-volume-savings |
Reconciles DB volume and savings against on-chain stats. |
GET|POST /api/reputation/refresh |
Refresh materialized aggregates. |
GET /api/reputation/sdf-export |
Candidate export for SDF's Anchor Directory — see docs/ANCHOR_DIRECTORY_CONTRIBUTION.md. |
Outcomes are signed and replayable, so a dispute resolves on evidence, not
opinion. Admin-only review is gated by ADMIN_SECRET_KEY via
/api/admin/disputes.
POST /api/reputation/appendThis route is the only way an outcome row enters the store from outside, and an accepted row feeds anchor scores and, through the publisher, the on-chain oracle. It is strict about what it accepts:
publicKey, G…) and signature, an Ed25519 signature by that account over
intentHash. The server checks it with verifyIntentSignature
(lib/intent/verify.ts, the same helper the dispute
route uses), which accepts a raw signature over the 32 hash bytes or a SEP-53
signature over the hex string, which is what Freighter's signMessage produces.
A missing or non-verifying signature gets 401. The off-ramp page hashes an
intent that binds the SEP-24 transaction id to the wallet, anchor and corridor,
and signs it with Freighter when execution starts.anchorId must be in the registry
(constants/anchors.ts) and corridor must be one that
anchor serves. intentHash and stellarTransactionId are 64-character hex hashes,
amounts and rates are non-negative decimals under fixed ceilings, and
settleSeconds is capped at 90 days. Anything else gets 400. Server-managed
columns (createdAt, reconcile, dispute and publish state) are not accepted from
the client at all.ON CONFLICT (intent_hash) DO NOTHING.
A second POST for a known intentHash gets 409, including a byte-identical
retry, and the stored row is never rewritten. It cannot change an outcome, move a
row to another signer, or clear published_at and send the row back through the
publisher.enforceRateLimit, 20 requests per window).Each stored row records attested and signer_account (migration
006_outcome_attestation.sql,
also applied inline by both drivers). ReputationStore.query() returns only
attested rows unless a caller passes includeUnattested: true, so every score,
leaderboard, coverage and actuarial read skips unattested rows. The publisher's
pending scan, corridor-rate derivation and median-rate lookup filter on
attested = TRUE too. Rows written before the migration default to unattested and
stop counting. Server-side seeds (lib/reputation/seed.ts) write straight to the
store as unattested rows and never go through the public route. Probe samples are a
separate table and are unaffected.
The same outcomes are written to the Soroban reputation contract for permissionless
reads. The contract interface (submit_outcome, anchor registry, admin) is
specified in docs/ORACLE_SPEC.md. Mainnet deployment is a
roadmap gate (see docs/MAINNET_LAUNCH.md, the 90-day probe window and the audit).
The account that attested an outcome can dispute it, and a maintainer accepts or
rejects the dispute. See DISPUTES.md for who can file, how
resolution works and which routes are involved.
When an anchor is first onboarded to the fleet, it has no transaction history. This section explains how the reputation system handles this cold-start period.
Source of truth:
lib/reputation/thresholds.ts,
lib/reputation/aggregate.ts,
lib/reputation/bands.ts, and the
ScorecardCard component.
On onboarding, a new anchor has no composite score — the system does not
assign a synthetic seed value. Instead, the scorecard enters an
insufficient_data state, and the UI displays a "Collecting Data" notice
that tells consumers the anchor is still being evaluated.
During bootstrap:
compositeScore is null — no score is computed or displayedstate field is "insufficient_data" (see
Scorecard type)ScorecardCard)Example bootstrap API response (GET /api/reputation/[anchor]):
| Field | Value |
|---|---|
state |
"insufficient_data" |
sampleSize |
0 |
compositeScore |
null |
scoreBand |
(not assigned) |
As the anchor processes transactions, each terminal outcome (completed,
partial, refunded, expired, or error) is appended to the outcome log
(types/reputation.ts). Rolling scorecards
aggregate these outcomes over 7-, 30-, and 90-day windows.
The composite score formula
(lib/reputation/composite.ts) combines the
three factors as:
composite = fillRate × (1 − slippage) ÷ (settleSeconds / 300)
A score of 1.0 means a perfect fill, zero slippage, at exactly the 300-second
reference settle time; values above 1.0 indicate faster-than-reference
settlement. Aggregation over each window uses a flat window — every
transaction in the window contributes with equal weight, with no exponential
decay or recency bias (lib/reputation/aggregate.ts).
Progression toward live status:
| Outcomes | Scorecard state |
Score Band | Phase |
|---|---|---|---|
| 0 | insufficient_data |
(none) | bootstrap |
| 1–29 | insufficient_data |
(none) | bootstrap |
| 30+ | ok |
green / amber / red | live |
The threshold of 30 outcomes is defined by MIN_OUTCOMES_THRESHOLD in
lib/reputation/thresholds.ts and can be
overridden with the NEXT_PUBLIC_MIN_OUTCOMES environment variable.
An anchor graduates to live status when it has accumulated at least
MIN_OUTCOMES_THRESHOLD (default 30) terminal outcomes within the
scorecard window. At that point:
The scorecard state becomes "ok" and exposes full metrics: fillRate,
settleMs (p50 / p95), and slippage (p50 / p95)
A composite score is computed and mapped to a score band:
| Band | Score range | Label |
|---|---|---|
| green | ≥ 95 | Excellent |
| amber | 80 – 94 | Needs Improvement |
| red | < 80 | Critical |
The reputation score is fully evidence-based and trusted by downstream consumers for routing and risk decisions
If your integration reads anchor reputation scores, inspect the scorecard
state field before acting on the score:
"insufficient_data" — the anchor is still in bootstrap. Treat it as
unscored; apply wider risk tolerances or defer high-value routing decisions
until enough outcomes have been recorded."ok" — the anchor has a live, evidence-based score. Use the
compositeScore and score band with standard confidence.You can also call
hasEnoughData(outcomesCount) and
estimateTimeToThreshold(outcomesCount)
to programmatically check readiness and display a progress indicator in your
UI, as the built-in
ScorecardCard does.
A firm quote comes from an anchor's SEP-38 quote server and is binding until it expires. An indicative estimate is computed by Stellar Intel from the anchor's published fees and a reference price, and is never a promise. Every estimate is labelled with which of the two it is.
The reference price answers “what is one unit of this asset worth in the local currency”. USDC is treated as exactly 1 USD and converted with the open.er-api USD→fiat rate. A fiat-pegged asset (for example NGNC→NGN) uses the open.er-api rate between its peg and the local currency. Any other asset uses the midpoint of the best bid and ask on the SDEX order book against USDC, then the same USD→fiat rate. If a side of the book is empty or the spread is wider than 5%, no price is shown rather than a bad one.
What actually landed is measured from the anchor's own transaction record as amount_out / amount_in (fees included). A second figure, amount_out / (amount_in − amount_fee), strips the fee out when the anchor reports it.
Before the wallet is asked to sign a withdrawal, the anchor's own amount_out estimate is compared with a minimum-receive floor. The floor is the selected rate's expected net amount less MIN_RECEIVE_TOLERANCE, which is 2%. If the anchor now estimates less than the floor, the payment is blocked and the user is told both figures. If the anchor gives no estimate, the flow continues and the final amount is set by the anchor.