Solana OS Attestations PoC

The Solana Attestation Service (SAS) from solana.com/developers/docs/tools/attestations, modeled in pure Lean 4 as Poc/Attestations.lean — first faithfully, then updated for dark DeFi: commitment-only on-chain records, selective disclosure, and one-show nullifier presentation.

Layer A — the SAS core (from the solana.com docs)

SAS is "a public good program for associating offchain data with onchain accounts", built on three components:

Credential — an attestation authority. Each credential has authorized signers who can create attestations under it. In the model: an id, an authority, and a signer list.

Schema — a template under a credential defining the structure and validation rules: an ordered list of named, typed fields (natK / strK / boolK) plus a version.

Attestation — a verified claim about a subject account, optionally linked to a specific token account, issued by an authorized signer following a schema. issue succeeds only for an authorized signer with schema-conforming data; verify additionally checks revocation, expiry, and credential/schema linkage.

The catch the docs state plainly: SAS keeps attestation data on-chain "for transparency and permanence". For dark DeFi that is the failure mode — a KYC tier or jurisdiction claim readable by everyone, forever, is a targeting list, not a credential. Layer B is the fix.

Layer B — the dark DeFi updates

PrivateAttestation — the on-chain record stores only a whole-record commitment sha256(recordPreimage) (record fields + encoded data + salt), the per-field hashes, and public metadata (subject, schema/credential ids, signer, expiry, revocation). There is no plaintext data field — by construction.

verifyDisclosure — selective disclosure: the holder reveals exactly one field, and anyone can check its hash against the stored per-field hash at that index. Revealing the tier does not reveal the jurisdiction.

present — nullifier one-show presentation: presenting derives nullifier = sha256(encode(recordId, holderSecret)) and succeeds only if the record is valid (unrevoked, unexpired, authorized signer), the required disclosure verifies, and the nullifier is fresh. The gate state spends the nullifier — double-presentation is impossible, and that is a theorem (present_double), not a comment.

darkGate — the composed gate for a dark pool: accept only a presentation disclosing field 0 (the tier) at value ≥ 2 — the accredited/KYC tier — with a fresh nullifier consumed.

Expiry and revocation still bite at presentation time: an expired or revoked record cannot be presented, even with a correct disclosure and a fresh nullifier.

Theorems — status in Lean (Poc/Attestations.lean, 31 total)

issue_signer_mem · issue_conformsPROVEN — anything issue returns was signed by an authorized signer and carries schema-conforming data.

issue_unauthorized · issue_nonconformingPROVEN — an unauthorized signer, or non-conforming data, can never issue.

verify_sound · verify_expired_false · verify_revoked_falsePROVEN — a public verify = true means every checked fact holds; expired or revoked attestations never verify.

recordPreimage_inj · encData_inj_of_length · encVal_injPROVEN — the commitment preimage encoding is injective: equal preimages fix every record field, the full data list, and the salt bytes.

issuePrivate_signer · issuePrivate_fieldHashes · issuePrivate_fieldHash_atPROVEN — private issuance has the same authorization gate, and the stored per-field hashes are exactly the hashes of the issued data, in order, at every index.

verifyDisclosure_sound · verifyDisclosure_wrongPROVEN — a verified disclosure means the revealed value's hash byte-matches the stored hash at that index; a value whose hash differs cannot verify.

present_facts · present_double · present_expired · present_revokedPROVEN — a successful presentation means a valid record, a sound disclosure, and a fresh nullifier; presenting again against the resulting state always fails; expired or revoked records cannot be presented.

darkGate_factsPROVEN — if the dark gate accepts, there is a valid private attestation behind it whose disclosed tier is ≥ 2 (its hash is the stored hash at field 0) and a fresh nullifier was consumed.

Distinct data ⇒ distinct commitmentsASSUMPTION — follows from recordPreimage_inj plus SHA-256 collision resistance, which is assumed, not proven (the same assumption every hash-commitment scheme makes).

ZK proofs · ed25519 verification · TEE attestationNOT MODELED — disclosure reveals the one field (that is the design); signer authorization is credential membership, with signature crypto out of scope; a ZK or TEE verifier would slot in where verifyDisclosure sits, and the gate composition above it would not change.

Lean demo transcript (poc-attestations, 20/20 checks)

The binary's scenario: a dark-pool access schema (tier, jurisdiction, epoch), data (tier 3, jurisdiction 840, epoch 12) issued by authorized signer 7. The private record's on-chain footprint is exactly the hashes below.

commitment: 77ec0a43baac3375d25108e9c39519842acbdf4c85d074137f7c280949a18d91 fieldHashes: [20a63514f83dec263f520fc6444731f7ff049af9db76456c05503e3f8fd1e117, 432438d95346d92e86b891cacb2af819340d41b17dc35c956a888e9f0ef01da5, 1382e9efc8faa4d632d5c4ab090421d8d6847d06bdd4bdc9e7a495e8a4eee6d9] nullifier (holder secret 42): 802988948f05cfdc8681e2355d6c0655a58b234285134ba03a6f13ba79e2b26a PASS SAS: authorized signer issues a public attestation PASS SAS: the public attestation verifies at t=100 PASS SAS: unauthorized signer 9 cannot issue PASS SAS: non-conforming data (wrong kind, wrong count) cannot issue PASS SAS: expired attestation does not verify (t=2000) PASS SAS: revoked attestation does not verify PASS dark: authorized signer issues a private attestation PASS dark: the private record stores 3 field hashes, one per field PASS dark: stored hash at field 0 is the hash of tier = 3 PASS dark: selective disclosure of jurisdiction (field 1) verifies PASS dark: wrong disclosure value (tier = 1) fails PASS dark: disclosure at an out-of-range field fails PASS dark: presentation with a fresh nullifier is accepted PASS dark: double-presentation is rejected (nullifier spent) PASS dark: darkGate accepts a tier-3 disclosure PASS dark: darkGate rejects a tier-1 disclosure PASS dark: expired record cannot be presented (t=2000) PASS dark: revoked record cannot be presented PASS dark: unauthorized signer 9 cannot issue privately PASS dark: commitment binds the data — tier 2 hashes to a different commitment SUMMARY: 20/20 checks passed RESULT: PASS