ZK Primitives
A zero-knowledge primitive layer for Solana-native AI models. The on-chain program and TypeScript SDK that give every model in the Clawd fleet a verifiable, tamper-proof, rent-free on-chain identity.
Three ZK Primitives
A 32-byte deterministic per-action hash that proves an action was taken exactly once. Stored as a compressed PDA — 15,000 lamports vs. 890,880 for a regular PDA (~60× cheaper).
- Anti-double-publish for model attestations
- Anti-double-claim for inference rewards
- Anti-double-issuance of agent tokens
On-chain bn128 / alt-bn128 zk-SNARK verifier (~200k CU). Lets agents prove off-chain computation — inference correctness, encrypted-state commitment, license-bound action auth — without re-executing on-chain.
- Model inference correctness proofs
- Encrypted-state commitment
- License-bound action authorization
- ZK identity attestations
Model metadata, attestation records, and encrypted parameters live in rent-free compressed accounts in 26-deep (V1) or 32-deep (V2) state trees. Reads via Helius Photon; writes via CPI to the Light System Program.
- 67M leaves per state tree (V2: 4B)
- 128-byte validity proofs for Merkle inclusion
- Photon indexer for compressed-state reads
- ~5,000 lamports per state tree touched
System Architecture
The Three Instructions
publish_attestationCreates a nullifier compressed PDA and writes an attestation record. Groth16 proof gates the write.
attester (32 bytes)model_hash (32 bytes)payload_commitment (32 bytes)nullifier[0..N]consume_attestationReads an existing attestation via validity proof, transitions status 0→1 (active→consumed).
consumer (32 bytes)attestation_address (32 bytes)consume_nonce (32 bytes)commit_encrypted_stateWrites an encrypted state commitment. Plaintext stays off-chain; the on-chain record is the ciphertext hash.
committer (32 bytes)model_hash (32 bytes)ciphertext_commitment (32 bytes)version (u64)Cost Economics
| Action | Cost | vs. Standard | Savings |
|---|---|---|---|
| New compressed nullifier | 15,000 lamports | 890,880 (regular PDA) | ~60× |
| State tree touch | 5,000 lamports | N/A (no equivalent) | — |
| New state leaf | ~300 lamports | varies | substantial |
| Validity proof verify | ~100k CU | ~50k CU (CPI) | added security |
Repo Layout
SDK Quick Start
Why this matters for the Clawd stack
Provenance
Every inference or attestation gets a nullifier — the same model can't claim the same reward twice.
Confidentiality
Weights and training data can be committed in encrypted form, with ZK proof of the committer's authority.
Portability
Any Clawd agent on any device can read a model's attestation via a single Helius Photon getCompressedAccount call.
This is the missing layer between "we trained a model" and "we have provable, on-chain, sovereign identity for that model."