Vestige — Architecture

Performance leaves a trace. Vestige turns Hyperliquid trading history into standardized, verifiable trader reputation: cash-flow-neutral performance metrics, a transparent reputation score, a trader passport and EIP-712 signed credentials that can optionally be anchored on Elysium.

This document records what was verified about the data sources and chains (with dates), how each part works, what is deliberately not claimed, and what it costs to run.


1. Verified data sources (checked 2026-11-30)

Hyperliquid (HyperCore)

Vestige only uses Hyperliquid's public, read-only info API (POST https://api.hyperliquid.xyz/info) and the public WebSocket (wss://api.hyperliquid.xyz/ws). It never sends exchange actions and never needs trading permissions, API wallets, or keys.

Request Used for Notes verified against docs + live calls
userFillsByTime / userFills executions, realized PnL, fees, liquidation flags ≤ 2,000 fills per response. Docs state only the 10,000 most recent fills are retrievable; live tests returned more for some accounts, so Vestige detects truncation from the data instead of assuming a count. HIP-3 fills carry a dex: prefix (xyz:XYZ100), spot fills use @index. fee includes builderFee.
userFunding hourly funding payments ≤ 500 rows per response, paginated by timestamp.
userNonFundingLedgerUpdates deposits, withdrawals, transfers, vault flows, liquidations Types seen: deposit, withdraw, internalTransfer, subAccountTransfer, spotTransfer, send, accountClassTransfer, vaultCreate/Deposit/Withdraw/Distribution, liquidation, rewardsClaim, spotGenesis, cStakingTransfer…
portfolio account value + cumulative PnL history Windows day/week/month/allTime (+ perp*). Sparse: allTime has ~50–75 points even for multi-year accounts; day ≈ 2-hour spacing. Windows share sample timestamps and their PnL series differ by a constant offset → Vestige rebases all windows onto the allTime baseline and merges them. pnlHistory excludes external flows: ΔaccountValue − ΔPnL reproduced ledger flows to the cent on a real vault account. Young accounts are padded with zero-value samples, which are trimmed.
clearinghouseState (+ dex for HIP-3) / spotClearinghouseState current positions, leverage, account value weight 2.
userRole vault / subAccount / agent detection weight 60, cached after first sync. Agent (API) wallets are rejected with an explanation.
candleSnapshot (BTC 1d) market-condition classification (BTC up/down/flat days) most recent 5,000 candles available.
perpDexs HIP-3 dex list 11 dexes live at verification time.
WebSocket userFills near-real-time sync triggers max 10 unique users across user subscriptions per IP → used only for the highest-priority (claimed/watched) wallets; everything else is polled on a schedule.

Rate limits (docs): 1,200 request-weight per minute per IP; clearinghouseState 2, userRole 60, other info requests 20, plus +1 per 20 items returned for fills/funding/historical orders and +1 per 60 candles. Vestige's client runs a token bucket over weight (default 1,100/min), charges per-item surcharges after each response, retries 429/5xx with exponential backoff + jitter and drains the bucket on a 429.

Discovery (not scoring): the public leaderboard feed used by app.hyperliquid.xyz (https://stats-data.hyperliquid.xyz/Mainnet/leaderboard, ~47,000 rows, not part of the documented API) seeds the explorer with real active accounts: a mix of top all-time performers, top recent performers and a seeded random sample of active accounts (to avoid a survivors-only population). Its PnL/ROI values are never used for scores.

Elysium

Elysium is Kinetiq's Arbitrum Orbit L2 for Hyperliquid, operated by Conduit, settling to HyperEVM, with HYPE as gas. Verified from the official docs (elysium.kinetiq.xyz/docs) and directly from the RPCs:

Mainnet Testnet
Chain ID 99901 (eth_chainId → 0x1863d) 99801 (0x185d9)
Public RPC https://rpc.elysium.kinetiq.xyz https://testnet-rpc.elysium.kinetiq.xyz
Provider RPC https://elysium-mainnet.g.alchemy.com/v2/{key} https://elysium-testnet.g.alchemy.com/v2/{key}
Explorer https://elysium.kinetiq.xyz/explorer https://elysium.kinetiq.xyz/testnet-explorer
Settles to HyperEVM (999) HyperEVM testnet (998)
Min base fee 0.5 gwei 0.1 gwei
  • Mainnet opened publicly on 2026-11-09. Nitro client (web3_clientVersion), ArbOS 61, 100 ms blocks, 32M block gas limit, batches posted to HyperEVM about every 15 min (finalized trails latest by up to that), optimistic withdrawals ~24 h. Launch posture: single sequencer, permissioned validation, single AnyTrust DAS.
  • PUSH0, MCOPY, TSTORE verified with eth_call. Contracts compile with evm_version = cancun.
  • Standard deployments present: Multicall3, CREATE2 deployer, CreateX, Permit2, Safe 1.3.0 (GnosisSafeL2).
  • No Ethereum Attestation Service (EAS) deployment is listed on Elysium's official contract-addresses page → Vestige ships a minimal registry whose fields map onto EAS concepts (schema ≈ credentialType, attester ≈ issuer, recipient ≈ subject, refUID ≈ digest) so it can migrate if EAS is deployed later.
  • The HyperCore market-data precompile and ElysiumCoreWriter arrive ~4 weeks after mainnet; Vestige does not need them.

2. System overview

                ┌───────────────────────── apps/web (Next.js 16) ─────────────────────────┐
 browsers ────▶ │ landing · app (explore, profile, passport, compare, verify, developers)  │
 integrators ─▶ │ /api/v1/* public API (keys, rate limits)  · /embed/* widgets · OG images │
                └───────────────┬──────────────────────────────────────┬───────────────────┘
                                │ read models (@vestige/db)            │ Redis cache / rate limits
                         ┌──────▼──────┐                         ┌─────▼─────┐
                         │ PostgreSQL  │◀─── writes ───┐         │   Redis   │
                         └──────▲──────┘               │         └───────────┘
                                │                ┌─────┴──────────── apps/worker ───────────────┐
                                │                │ job queue (SKIP LOCKED) · sync · analytics   │
                                └────────────────│ scoring · credential signing · leaderboards  │
                                                 │ discovery · WS triggers · webhooks · anchoring│
                                                 └──────┬─────────────────────────┬─────────────┘
                                                        │ info API + WS           │ viem
                                                  Hyperliquid                Elysium registry (optional)
  • packages/core — pure TypeScript, isomorphic: Hyperliquid client, normalization, analytics engine (decimal.js, 40 significant digits), reputation scoring, credential catalog, EIP-712 format and verifier, Merkle data commitments, leaderboard ranking. The browser runs the same code to recompute credentials.
  • packages/db — postgres.js client, SQL migrations, ingestion writes and read models.
  • apps/worker — long-running Node process (kept out of serverless): job loop with FOR UPDATE SKIP LOCKED, scheduler, discovery, WebSocket listener, webhook delivery, anchoring.
  • apps/web — Next.js App Router: marketing site, application, public API, embeds, OG images.
  • contracts — Foundry: VestigeRegistry (issuers, methodologies, credential anchors, revocations) and the optional non-transferable VestigePassport (ERC-721 + ERC-5192). 58 tests, invariant suite included.

3. Indexing pipeline

  1. Lookup / claim / discovery / schedule enqueue one active job per wallet (sync_jobs, partial unique index).
  2. Sync (apps/worker/src/sync.ts): role → portfolio windows merged onto stored points → fills (newest first: a probe of the 2,000 most recent fills sizes a time window that fits the run's page budget; long histories continue in follow-up runs) → funding (adaptive window by density) → progressive backfill toward the account's start (bounded per run) → ledger → current positions (first dex + HIP-3 dexes seen in fills) and spot balances. Inserts are idempotent (ON CONFLICT DO NOTHING on natural keys), every record stores indexed_at.
  3. Analyze (apps/worker/src/analyze.ts): load dataset → computeAnalytics → computeReputation → monthly score progression recomputed from data available at each cut-off → credential evaluation & signing → passport → denormalized trader_stats → feed events → webhooks.
  4. Leaderboards recompute every 10 minutes (or after 10 analyses) into immutable snapshots with previous ranks.
  5. Freshness: claimed wallets every 15 min (+ WebSocket triggers), watched hourly, discovered 12 h, looked-up 24 h; inactive (> 30 days) at most every 3 days.

Coverage is first-class. Each analytics snapshot stores the earliest/latest record per stream, truncation flags, equity sampling density, ledger reconciliation rate and known gaps; the UI shows them next to every metric.

4. Analytics (summary — full detail in METHODOLOGY.md)

  • Returns are time-weighted and cash-flow neutral. Gain per interval = Δ Hyperliquid cumulative PnL; implied flow = ΔaccountValue − gain; Modified Dietz sub-period returns with reconciled ledger timing; intervals where flows exceed 10% of starting equity use a conservative denominator (deposits counted from the start, withdrawals at the end), so moving capital around observation points can only understate returns. Sub-periods chain into a TWR index.
  • Drawdowns are measured on the index (withdrawals are never drawdowns). Volatility/Sharpe/Sortino use log returns normalised by √(interval days) because observations are irregular. CAGR/Calmar require ≥ 90 days; risk ratios ≥ 20 observations over ≥ 30 days.
  • Trades: realized trades = closing orders (fills of one order that reduced or closed a position) for win rate, profit factor, expectancy; position round trips for holding time and sizing. Funding is attributed to the open position at payment time.
  • Every metric carries a status (ok, estimated, insufficient, unavailable), a note, its window and sample size, and a published definition (label, method, source) — the API returns them together.

5. Reputation score

Five dimensions (risk discipline 30%, performance quality 25%, consistency 20%, experience 15%, data integrity 10%), piecewise-linear transforms, sample-size shrinkage toward 50 for performance and consistency, minimum observation requirements (≥ 30 days, ≥ 20 realized trades, ≥ 20 return observations) and confidence caps (low ≤ 74, medium ≤ 89). Absolute profit is never rewarded directly; token holdings, payments and profile claims never change a score. The methodology object is hashed (keccak256 of canonical JSON) and stored in methodologies; changing any number requires a new version (the worker refuses to start if a published version's hash changes).

6. Credentials & verification

records ──normalize──▶ metrics (versioned methodology) ──▶ canonical EIP-712 payload ──▶ digest ──sign──▶ signature
   └── Merkle root of canonical record leaves = dataCommitment (inside the signed payload)        └─(optional) anchor digest on Elysium
  • Format: EIP-712 typed data, domain { name: "Vestige Credentials", version: "1" } (chain-independent), primary type TradingCredential { id, credentialType, subject, issuer, metrics[], observationStart, observationEnd, methodologyVersion, dataCommitment, issuedAt, expiresAt, revocationRef }. The digest is the anchoring key.
  • Issuance is automatic and rule-based (packages/core/src/credentials/catalog.ts, version vcr-1.0.0): a credential is issued only when eligible and the required data is present; milestone credentials never expire; performance, risk and consistency credentials expire (60–180 days) and renew near expiry; the reputation attestation (passport seal) expires after 30 days and is reissued when the score moves ≥ 1 point or the classification changes.
  • Verification (verifyCredentialDocument): format → integrity (digest) → signature (recover signer = issuer) → issuer authorization at issuance time (validity window, compromise date) → revocation → expiry → methodology published → Elysium commitment (when a registry is configured) → supporting evidence (stored records reproduce the signed Merkle root). Statuses: valid, expired, revoked, invalid signature, unknown issuer, insufficient supporting data, verification unavailable.
  • Authenticity ≠ correctness. A signature proves an authorized issuer attested to a claim. Correctness is checked by anyone: /api/credentials/{id}/evidence returns the exact committed records; the verify page recomputes the Merkle root and re-runs the analytics engine in the browser to compare every signed metric.
  • Hashed credentials are not zero-knowledge proofs. Selective disclosure is a roadmap item.

7. Elysium registry and soulbound passports

VestigeRegistry stores only commitments: issuer set (two-step admin, intended to be a Safe), immutable methodology hashes, immutable credential anchors {issuer, subject, credentialType, methodologyVersion, anchoredAt, expiresAt}, one-way revocations by the original issuer or admin. No PII, no trading history onchain. VestigePassport is soulbound (all transfers revert) so reputation can never be bought.

How the worker uses it (apps/worker/src/anchor.ts). On start it checks the chain id, the contract code, that its key is an active issuer and that both methodology hashes are published (publishing them when the key is the admin), then queues every current credential that has no anchor yet. Every minute it anchors up to 40 digests per anchorBatch — simulated first, skipped when already anchored onchain, dropped when the credential was superseded, revoked or expired in the meantime — mirrors database revocations onto the registry, and retries transient failures with backoff (2 → 60 minutes; failed after 6 attempts). It never spends its key below a reserve (ANCHOR_MIN_BALANCE_HYPE, default 0.002): when the balance is short, anchoring pauses instead of failing, and the reason is published in system_kv under anchoring.status. If the chain is unreachable at boot it re-checks every minute.

Soulbound passports are minted only at the owner's request. A signed-in owner presses "Mint soulbound passport" (POST /api/account/passport/mint); the worker mints once the passport's reputation attestation is anchored and binds the token to that attestation's digest. Token id = the Vestige sequence number (VST-000025 → 25); tokenURI = <site>/api/nft/passport/<id>, served only for minted tokens. Vestige's key pays the gas; nothing is ever minted to a wallet whose owner did not ask.

Measured cost. ≈ 120k gas per anchored credential (749 real credentials anchored in 19 batches on a local deployment, scripts/onchain-local.ts), i.e. ≈ 0.00006 HYPE at Elysium's 0.5 gwei base fee; a passport mint ≈ 145k gas.

Deployment status: live on Elysium mainnet since 2026-11-30 (chain 99901, deployed with scripts/deploy-elysium.ts): VestigeRegistry 0x045067bcd4d9330668206c7b3bcaff8e7f4fed31 and VestigePassport 0x0df4d32a2604c74c8ed24b2a2cc85be9b9e31526 (bound to the registry, tokenURI base https://vestigeprotocol.vercel.app/api/nft/passport/). Admin and first issuer: 0xc8A2a161D35bFcab85c6f4bd5A75e5340e8AeA7A (the production issuer key) until a Safe takes over via transferAdmin / acceptAdmin. Both methodology hashes (vrs-1.0.0, vcr-1.0.0) are published onchain. The contracts have not been externally audited.

8. Security (summary — see SECURITY.md)

SIWE (EIP-4361) sign-in with single-use 10-minute nonces consumed atomically (replay protection), domain binding, 24 h httpOnly sessions stored hashed, ownership proofs per wallet, no seed phrases/keys/trading permissions ever. API keys stored as SHA-256 hashes and shown once; per-key and per-IP rate limits; webhook HMAC signatures and an SSRF guard (https only, DNS-resolved public addresses only, no redirects); parameterized SQL everywhere; audit log for claims, profile changes, keys and webhooks; issuer key rotation and compromise handling; strict methodology versioning.

9. Infrastructure & cost

Component Recommendation Indicative monthly cost
Web Vercel (or any Node host) $0–20
Worker 1 small container/VM (0.5 vCPU, 512 MB) — long-running, not serverless $5–15
PostgreSQL managed, 2–10 GB to start (fills dominate: ~200 B/row) $10–25
Redis optional; managed free tier is enough $0–10
Hyperliquid API free, rate-limited per IP; more throughput = more worker IPs $0
Elysium anchoring measured on a local deployment: anchorBatch of 5 real credential digests = 610,607 gas (≈ 122k per credential); at Elysium's 0.5 gwei base-fee floor that is ≈ 0.0003 HYPE per batch of 5 dust
Issuer key cloud KMS/HSM (secp256k1) $1–5

Indexing throughput is bounded by Hyperliquid's per-IP weight: a heavy wallet's first pass costs ~1,000–1,500 weight (≈ 1–1.5 min at 1,100/min); light wallets cost < 200. Caching (Redis/in-memory), per-route rate limits and snapshot-based leaderboards keep reads cheap.