@wzrd_sol/attestation-writer
v0.1.0
Published
Write TWZRD reputation scores as on-chain Solana attestations (SAS) in an ERC-8004 / SATI-compatible shape. TWZRD as the canonical Solana scoring provider for the agent-registry standard.
Maintainers
Readme
@wzrd_sol/attestation-writer
Write TWZRD reputation scores as on-chain Solana attestations, in a shape compatible with the ERC-8004 Reputation Registry and the SATI / Solana Agent Registry standard.
Why
ERC-8004 and its Solana port (SATI) ship their Reputation Registry empty — the standards deliberately store only the raw feedback primitive and defer score aggregation to off-chain third parties. TWZRD already runs the only cross-facilitator payment-behavior corpus on Solana (with wash-fleet detection). This package writes those scores into the canonical on-chain registry, so a TWZRD score is portable, verifiable, and reads back through any ERC-8004/SATI-aware tool — making TWZRD the scoring provider the standard left blank.
Two layers
1. Pure mapping core (no chain dependencies)
mapScoreToAttestation() converts a TWZRD corpus reputation record into ERC-8004/SATI attestation fields. Deterministic, dependency-free, fully unit-tested offline.
import { mapScoreToAttestation, Outcome } from "@wzrd_sol/attestation-writer";
const mapped = mapScoreToAttestation({
reputation_score: 87, // 0-100
reputation_confidence_bps: 9000, // or `confidence: 0.9`
reputation_score_version: "intel_renorm_v1",
reputation_data_quality: "cross_facilitator",
wash_flagged: false,
});
// → { value: 87, valueDecimals: 0, tag1: "trust", tag2: "intel_renorm_v1",
// outcome: Outcome.Positive, score: 87, confidenceBps: 9000, content: "{...}" }2. On-chain writer (optional peer dep sas-lib)
Issues a raw Solana Attestation Service (SAS) attestation under a TWZRD-owned Credential + Schema — full control, no dependency on SATI's SDK. sas-lib is an optional peer dependency: the mapping core works without it; install sas-lib@^1.0.10 only to write on-chain.
import { buildSetupInstructions, buildAttestationInstruction } from "@wzrd_sol/attestation-writer";
// One-time per issuer: create the TWZRD credential + twzrd.reputation.v1 schema
const { createCredentialInstruction, createSchemaInstruction, credentialPda, schemaPda } =
await buildSetupInstructions({ authority, payer, authorityAddress });
// Per subject: build the attestation instruction (caller sends the tx)
const { instruction, attestationPda, mapped } = await buildAttestationInstruction({
reputation, subject, authority, payer, schemaAccount, schemaPda, credentialPda,
});The writer returns instructions + derived PDAs; the caller assembles and sends the transaction (lets you batch and own RPC/signing).
Field mapping (TWZRD → ERC-8004 / SATI)
| TWZRD corpus field | ERC-8004 / SATI field | Notes |
|---|---|---|
| reputation_score (0-100) | value (int128) + valueDecimals (=0) | Spec example: 87 → value 87, decimals 0 |
| derived from score + wash_flagged | outcome (0=Neg, 1=Neutral, 2=Pos) | wash-flagged → always Negative |
| reputation_confidence_bps / confidence | confidence (0-10000 bps) | bps preferred; fraction ×10000; default 8000 |
| reputation_score_version | tag2 (string) | e.g. intel_renorm_v1 |
| (fixed) | tag1 (string) | default "trust" |
| score + provenance | SATI content (JSON) | score, confidence, version, data_quality, window, wash flag |
Key addresses
| Item | Value | Source |
|---|---|---|
| SAS program (mainnet) | 22zoJMtdu4tQc2PzL74ZUT7FrwgB1Udec8DdW4yw4BdG | CONFIRMED (program lib.rs + generated client) |
| SATI program (mainnet) | satiRkxEiwZ51cv8PRu8UMzuaqeaNU9jABo6oAFMsLe | Cascade Protocol docs |
| TWZRD receipt pubkey | 9V6Pn19kiUA5Rn6JpQfNduanvGt2aXGwsarosNfa2Ldf | intel.twzrd.xyz/.well-known/x402 |
Unverified / before-mainnet checklist
This is a spike. The pure mapping core is tested and final; the on-chain leg is wired against the verified sas-lib API but not yet executed against devnet. Resolve before production:
- SAS devnet program ID — the program declares one address with no network branching (same-as-mainnet expected) but confirm on-chain.
- Raw-SAS cost — the ~$0.002/attestation figure is SATI's compressed (Light Protocol) number, not raw SAS. A raw SAS attestation pays Solana rent (~a few cents). Use SATI's compressed path for high volume.
ReputationScoreV3exact layout — SATI's aggregate-score schema layout beyond its 131-byte base is not published; this package writes a self-owned schema, notReputationScoreV3, until that lands.- Which ERC-8004 draft SATI mirrors — SATI's structured
outcomeu8 + JSONscorematches neither current ERC-8004 (int128 value+valueDecimals) nor the olderuint8 scoredraft cleanly. We map onto current ERC-8004 (value/valueDecimals) and carry the raw score incontent. - Devnet end-to-end — issue one attestation about a subject wallet and read it back (
fetchAttestation+deserializeAttestationData).
Develop
npm install
npm test # offline core tests (no chain deps)
npm run typecheck
npm run buildLicense
MIT
