enigma-memory 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +36 -17
  2. package/apps/cli/bin/enigma.mjs +320 -42
  3. package/deploy/docker-compose.local-production-simulation.yml +10 -11
  4. package/docs/benchmark-attestation-network.md +487 -487
  5. package/docs/benchmark-reproducibility.md +10 -9
  6. package/docs/demo-proof-network.md +275 -275
  7. package/docs/developer-ecosystem.md +223 -223
  8. package/docs/developer-proof-quickstart.md +325 -325
  9. package/docs/enigma-memory-ready-conformance.md +376 -376
  10. package/docs/hosted-cloud-product.md +10 -0
  11. package/docs/install-anywhere.md +34 -17
  12. package/docs/installers-and-desktop.md +9 -7
  13. package/docs/proof-network-build-notes.md +240 -240
  14. package/docs/proof-network.md +257 -257
  15. package/docs/sdk-api.md +324 -324
  16. package/docs/solana-devnet-acceptance.md +48 -0
  17. package/docs/solana-proof-rail.md +453 -453
  18. package/examples/ci/github-actions.yml +6 -8
  19. package/package.json +8 -1
  20. package/packages/mcp-server/src/index.js +1 -1
  21. package/packages/passport/src/index.js +9 -5
  22. package/scripts/build-benchmark-proof-release.mjs +391 -0
  23. package/scripts/build-goal-completion-audit.mjs +11 -5
  24. package/scripts/build-hosted-api-key-lifecycle.mjs +1 -1
  25. package/scripts/build-hosted-customer-lifecycle.mjs +1 -1
  26. package/scripts/build-installer-assets.mjs +126 -10
  27. package/scripts/build-production-handoff-packet.mjs +7 -6
  28. package/scripts/build-production-unblocker.mjs +409 -0
  29. package/scripts/build-proof-network-packet.mjs +1 -1
  30. package/scripts/release-audit.mjs +71 -2
  31. package/scripts/run-standard-memory-benchmarks.mjs +1 -1
  32. package/scripts/wait-for-backend-ready.mjs +4 -2
@@ -1,453 +1,453 @@
1
- # Solana proof rail
2
-
3
- Enigma's Solana rail is a proof, permission, and settlement layer for AI memory. It anchors opaque commitments, grants scoped capabilities, records revocations/nullifiers, attests benchmark reports, escrows service jobs, and registers operators. It does **not** store raw memory, prompts, transcripts, completions, embeddings, provider responses, tenant names, secrets, private keys, seed phrases, or ACL bodies on-chain.
4
-
5
- The hot memory path stays local, hosted, BYOC, or on-prem under the deployment owner's custody. Solana receives only public-safe hashes, roots, counts, refs, public keys, signatures, timestamps/slots, and settlement amounts.
6
-
7
- ## Design principles
8
-
9
- 1. **Public chain payloads are content-minimized.** Every account and instruction must be acceptable for permanent public disclosure.
10
- 2. **Plaintext rejection happens before signing.** Client SDKs and CLI commands must reject forbidden keys and secret-like values before producing a transaction or chain-ready artifact.
11
- 3. **Solana is not canonical storage.** Durable memory, ACL bodies, benchmark reports, invoices, operator terms, and customer policy documents live off-chain in controlled storage. Chain state references them by hash/ref only.
12
- 4. **Receipts remain verifier-friendly.** Every on-chain object maps to an `enigma.proof_network.*.v1` artifact so an offline verifier can validate shape, hashes, signatures, ordering, and claim boundaries without RPC access.
13
- 5. **Program state is append-only where possible.** Anchors and attestations are immutable after creation. Mutable accounts are limited to registry status, escrow state, grant status, and explicit revocations.
14
- 6. **No token or ROI claims.** Settlement proves job/quote/receipt linkage and payment movement only. It is not investment, yield, provider invoice, savings guarantee, compliance, provider deletion, or model-forgetting evidence.
15
-
16
- ## Artifact-to-chain mapping
17
-
18
- | Enigma artifact | Solana object | Purpose | Public fields only |
19
- | --- | --- | --- | --- |
20
- | `enigma.proof_network.anchor_batch.v1` | `BatchAnchor` account plus `AnchorBatchCreated` event | Batch opaque proof roots for later verification. | batch hash, Merkle root, artifact counts, schema ids, optional public refs, authority, slot. |
21
- | `enigma.proof_network.capability_grant.v1` | `CapabilityGrant` account plus event | Grant a public key permission to perform a scoped proof-network action. | issuer, grantee, scope hash, policy hash, capability kind, expiry, nonce, grant hash. |
22
- | `enigma.proof_network.capability_revocation.v1` | `CapabilityRevocation` / `Nullifier` account plus event | Revoke or nullify a grant/job/attestation capability without disclosing private policy content. | target hash, nullifier hash, revoker, reason code, slot, revocation hash. |
23
- | `enigma.proof_network.benchmark_attestation.v1` | `BenchmarkAttestation` account plus event | Bind a benchmark result packet to dataset, runner, package, environment, and metrics roots. | report hash, dataset hash/ref, runner hash/ref, package hash/ref, metrics root, counts, signer. |
24
- | `enigma.proof_network.packet.v1` | No single required account; verifier envelope over the above | Portable offline proof packet that may include chain refs. | artifact list, hashes, chain ids, signatures, validation results. |
25
- | Settlement artifacts | `JobEscrow` account plus settlement events | Lock, release, refund, or dispute payment against a hash-only job. | job hash, quote hash, usage hash, memory root, policy hash, amount, mint, parties, state. |
26
- | Operator metadata | `OperatorRegistry` account plus events | Discover operators and verify authorized signing keys/services. | operator authority, service classes, signing key hash/pubkey, terms hash/ref, status, reputation root. |
27
-
28
- ## Program accounts
29
-
30
- All account seeds must avoid private identifiers. Use public keys and hashes, never tenant names, human-readable workspace names, or raw policy labels.
31
-
32
- ### `BatchAnchor`
33
-
34
- `BatchAnchor` commits to a set of Enigma proof artifacts generated off-chain.
35
-
36
- Recommended PDA seeds:
37
-
38
- ```text
39
- ["batch_anchor", authority_pubkey, batch_hash]
40
- ```
41
-
42
- Fields:
43
-
44
- | Field | Type | Required | Notes |
45
- | --- | --- | --- | --- |
46
- | `version` | `u8` | yes | Starts at `1`. |
47
- | `schema` | fixed string/hash | yes | `enigma.proof_network.anchor_batch.v1`. |
48
- | `authority` | `Pubkey` | yes | Signer authorized to anchor the batch. |
49
- | `batch_hash` | `[u8; 32]` | yes | SHA-256 of canonical public batch artifact. |
50
- | `merkle_root` | `[u8; 32]` | yes | Root over artifact hashes. |
51
- | `artifact_count` | `u32` | yes | Count only, not artifact bodies. |
52
- | `schema_hashes` | `Vec<[u8; 32]>` | yes | Hashes of schema ids included in the batch. |
53
- | `public_refs_hash` | `Option<[u8; 32]>` | optional | Hash of public ref list, not URLs containing credentials. |
54
- | `created_slot` | `u64` | yes | Slot at creation. |
55
- | `created_unix_time` | `i64` | yes | Clock sysvar time. |
56
- | `bump` | `u8` | yes | PDA bump. |
57
-
58
- Validation rules:
59
-
60
- - `artifact_count > 0`.
61
- - `merkle_root`, `batch_hash`, and every `schema_hash` are non-zero 32-byte values.
62
- - No instruction arg may contain arbitrary JSON text; clients pass fixed bytes and counts.
63
- - Duplicate `batch_hash` for the same authority is rejected by PDA uniqueness.
64
-
65
- ### `CapabilityGrant`
66
-
67
- `CapabilityGrant` gives a grantee a scoped permission such as anchoring batches, opening escrows, signing benchmark attestations, or administering an operator profile.
68
-
69
- Recommended PDA seeds:
70
-
71
- ```text
72
- ["capability_grant", issuer_pubkey, grantee_pubkey, grant_hash]
73
- ```
74
-
75
- Fields:
76
-
77
- | Field | Type | Required | Notes |
78
- | --- | --- | --- | --- |
79
- | `version` | `u8` | yes | Starts at `1`. |
80
- | `schema` | fixed string/hash | yes | `enigma.proof_network.capability_grant.v1`. |
81
- | `issuer` | `Pubkey` | yes | Grant authority. |
82
- | `grantee` | `Pubkey` | yes | Capability holder. |
83
- | `capability_kind` | enum | yes | `anchor_batch`, `grant_capability`, `revoke_capability`, `attest_benchmark`, `open_job_escrow`, `settle_job`, `admin_operator`. |
84
- | `scope_hash` | `[u8; 32]` | yes | Hash of private/off-chain scope document or public-safe scope tuple. |
85
- | `policy_hash` | `[u8; 32]` | yes | Hash of policy body; policy body stays off-chain. |
86
- | `not_before_slot` | `u64` | yes | Prevents early use. |
87
- | `expires_slot` | `u64` | yes | Must be greater than `not_before_slot`. |
88
- | `nonce` | `[u8; 32]` | yes | Public random nonce for unlinkability across grants. |
89
- | `grant_hash` | `[u8; 32]` | yes | Canonical artifact hash. |
90
- | `status` | enum | yes | `active`, `revoked`, `expired`. |
91
- | `bump` | `u8` | yes | PDA bump. |
92
-
93
- Validation rules:
94
-
95
- - A grant is usable only when the current slot is within the grant window and no matching revocation/nullifier exists.
96
- - `scope_hash` must commit to least privilege. It should include capability kind, allowed program ids, public operator id/hash, and approved artifact schemas.
97
- - `policy_hash` never reveals policy text, tenant names, memory ids, or ACL bodies.
98
-
99
- ### `CapabilityRevocation` / `Nullifier`
100
-
101
- A revocation makes a grant unusable. A nullifier prevents replay of a one-time right, escrow settlement, or attestation authorization without publishing the underlying private policy.
102
-
103
- Recommended PDA seeds:
104
-
105
- ```text
106
- ["capability_revocation", target_hash, revocation_hash]
107
- ["nullifier", domain_hash, nullifier_hash]
108
- ```
109
-
110
- Fields:
111
-
112
- | Field | Type | Required | Notes |
113
- | --- | --- | --- | --- |
114
- | `version` | `u8` | yes | Starts at `1`. |
115
- | `schema` | fixed string/hash | yes | `enigma.proof_network.capability_revocation.v1`. |
116
- | `revoker` | `Pubkey` | yes | Issuer, delegated revoker, or program authority. |
117
- | `target_hash` | `[u8; 32]` | yes | Hash of grant/job/attestation capability being revoked. |
118
- | `domain_hash` | `[u8; 32]` | yes | Separates grant, job, operator, and benchmark domains. |
119
- | `nullifier_hash` | `[u8; 32]` | yes | One-way nullifier. |
120
- | `reason_code` | enum | yes | `rotation`, `expiry`, `compromise`, `policy_change`, `operator_exit`, `error`, `other`. No free-text reason. |
121
- | `revocation_hash` | `[u8; 32]` | yes | Canonical artifact hash. |
122
- | `created_slot` | `u64` | yes | Slot at revocation. |
123
- | `bump` | `u8` | yes | PDA bump. |
124
-
125
- Validation rules:
126
-
127
- - Free-text revocation reasons are not accepted on-chain.
128
- - Revocation authority must be the issuer, a valid delegated revoker, or a configured program governance authority.
129
- - A nullifier can be created once per domain/hash pair; duplicate creation fails.
130
-
131
- ### `BenchmarkAttestation`
132
-
133
- `BenchmarkAttestation` binds benchmark evidence to immutable public-safe references. It must not include prompts, completions, answers, dataset rows, provider outputs, or private runner logs.
134
-
135
- Recommended PDA seeds:
136
-
137
- ```text
138
- ["benchmark_attestation", signer_pubkey, report_hash]
139
- ```
140
-
141
- Fields:
142
-
143
- | Field | Type | Required | Notes |
144
- | --- | --- | --- | --- |
145
- | `version` | `u8` | yes | Starts at `1`. |
146
- | `schema` | fixed string/hash | yes | `enigma.proof_network.benchmark_attestation.v1`. |
147
- | `signer` | `Pubkey` | yes | Attestation authority. |
148
- | `report_hash` | `[u8; 32]` | yes | Hash of public-safe benchmark report. |
149
- | `dataset_ref_hash` | `[u8; 32]` | yes | Hash of dataset manifest/ref, not dataset content. |
150
- | `runner_ref_hash` | `[u8; 32]` | yes | Hash of runner version/source ref. |
151
- | `package_ref_hash` | `[u8; 32]` | yes | Hash of package/version/provenance ref. |
152
- | `metrics_root` | `[u8; 32]` | yes | Merkle root over public metrics and counts. |
153
- | `sample_count` | `u32` | yes | Count only. |
154
- | `claim_boundary_hash` | `[u8; 32]` | yes | Commits to allowed claims/non-claims. |
155
- | `created_slot` | `u64` | yes | Slot at attestation. |
156
- | `bump` | `u8` | yes | PDA bump. |
157
-
158
- Validation rules:
159
-
160
- - Attestation creation requires an active `attest_benchmark` capability or operator registry authority.
161
- - `sample_count` must match the off-chain report summary committed by `report_hash` and `metrics_root`.
162
- - Any comparison or leadership claim must be represented only by a report hash and claim-boundary hash until a reviewed public report exists.
163
-
164
- ### `JobEscrow`
165
-
166
- `JobEscrow` connects permissionless access and settlement to Enigma's hash-only job artifacts. It does not execute memory work and does not reveal job contents.
167
-
168
- Recommended PDA seeds:
169
-
170
- ```text
171
- ["job_escrow", payer_pubkey, operator_pubkey, job_hash]
172
- ```
173
-
174
- State machine:
175
-
176
- ```text
177
- initialized -> funded -> completed -> released
178
- initialized -> funded -> refunded
179
- initialized -> funded -> disputed -> released|refunded
180
- initialized -> cancelled
181
- ```
182
-
183
- Fields:
184
-
185
- | Field | Type | Required | Notes |
186
- | --- | --- | --- | --- |
187
- | `version` | `u8` | yes | Starts at `1`. |
188
- | `payer` | `Pubkey` | yes | Funds escrow. |
189
- | `operator` | `Pubkey` | yes | Provides the service. |
190
- | `mint` | `Pubkey` | yes | SPL token mint or native SOL sentinel design. |
191
- | `vault` | `Pubkey` | yes | Token account owned by the escrow PDA. |
192
- | `amount` | `u64` | yes | Smallest units. |
193
- | `job_hash` | `[u8; 32]` | yes | Hash-only job commitment. |
194
- | `quote_hash` | `[u8; 32]` | yes | Operator quote hash. |
195
- | `usage_hash` | `[u8; 32]` | yes | Usage event/aggregate hash. |
196
- | `memory_root` | `[u8; 32]` | yes | Opaque memory commitment root. |
197
- | `policy_hash` | `[u8; 32]` | yes | Policy hash. |
198
- | `service_receipt_hash` | `Option<[u8; 32]>` | set on completion | Hash of service receipt. |
199
- | `settlement_ref_hash` | `Option<[u8; 32]>` | set on release/refund | Hash of settlement reference. |
200
- | `deadline_slot` | `u64` | yes | Refund/dispute boundary. |
201
- | `state` | enum | yes | State machine above. |
202
- | `bump` | `u8` | yes | PDA bump. |
203
-
204
- Instruction rules:
205
-
206
- - `open_job_escrow` requires payer signature and an active operator profile.
207
- - `fund_job_escrow` transfers tokens into the escrow vault and sets `funded`.
208
- - `complete_job_escrow` requires operator signature plus an active grant or registry authority and writes only `service_receipt_hash`.
209
- - `release_job_escrow` requires payer approval, arbitrator approval, or pre-agreed auto-release conditions committed by `policy_hash`.
210
- - `refund_job_escrow` requires deadline expiry, payer/operator agreement, or dispute resolution.
211
- - `dispute_job_escrow` records dispute state without free-text evidence.
212
-
213
- The public invariant mirrors Enigma settlement receipts:
214
-
215
- ```text
216
- settled_amount <= quote_price <= job_max_price
217
- ```
218
-
219
- The program can enforce the escrow amount and quote hash linkage. The off-chain verifier enforces full job/quote/usage/receipt consistency from public-safe artifacts.
220
-
221
- ### `OperatorRegistry`
222
-
223
- `OperatorRegistry` declares who may operate proof-network services and which signing keys/capabilities are current.
224
-
225
- Recommended PDA seeds:
226
-
227
- ```text
228
- ["operator_registry", operator_authority_pubkey]
229
- ```
230
-
231
- Fields:
232
-
233
- | Field | Type | Required | Notes |
234
- | --- | --- | --- | --- |
235
- | `version` | `u8` | yes | Starts at `1`. |
236
- | `operator_authority` | `Pubkey` | yes | Admin authority. |
237
- | `operator_id_hash` | `[u8; 32]` | yes | Hash of public operator id/ref; no tenant/customer names. |
238
- | `signing_keys` | `Vec<Pubkey>` | yes | Active keys for attestations, grants, and service receipts. |
239
- | `service_classes` | bitset/enum vec | yes | `anchor`, `benchmark_attester`, `memory_optimizer`, `gateway`, `arbiter`. |
240
- | `terms_ref_hash` | `[u8; 32]` | yes | Hash of public terms/ref. |
241
- | `capacity_ref_hash` | `Option<[u8; 32]>` | optional | Hash of public capacity profile/ref. |
242
- | `reputation_root` | `Option<[u8; 32]>` | optional | Root over public-safe operator metrics. |
243
- | `status` | enum | yes | `active`, `paused`, `exiting`, `removed`. |
244
- | `updated_slot` | `u64` | yes | Last registry update. |
245
- | `bump` | `u8` | yes | PDA bump. |
246
-
247
- Validation rules:
248
-
249
- - Updating signing keys requires `operator_authority` and creates a registry update event.
250
- - Paused/removed operators cannot open new escrows, issue new attestations, or use operator-scoped grants.
251
- - `reputation_root` may commit to uptime, completion counts, dispute counts, or benchmark-attestation acceptance counts, but not customer names or private job metadata.
252
-
253
- ## Instruction set
254
-
255
- | Instruction | Required signers | Writes | Notes |
256
- | --- | --- | --- | --- |
257
- | `create_batch_anchor` | anchor authority | `BatchAnchor` | Emits `AnchorBatchCreated`. |
258
- | `create_capability_grant` | issuer | `CapabilityGrant` | Issuer must be program authority, operator authority, or holder of a valid grant-capability grant. |
259
- | `revoke_capability` | revoker | `CapabilityGrant`, `CapabilityRevocation`/`Nullifier` | Marks grant revoked and emits revocation event. |
260
- | `create_nullifier` | authorized signer | `Nullifier` | One-time replay prevention for grants/jobs/attestations. |
261
- | `create_benchmark_attestation` | attestation signer | `BenchmarkAttestation` | Requires grant or registry authority. |
262
- | `register_operator` | operator authority | `OperatorRegistry` | Creates active or paused profile. |
263
- | `update_operator` | operator authority | `OperatorRegistry` | Rotates keys, refs, status, service classes. |
264
- | `open_job_escrow` | payer | `JobEscrow` | Initializes hash-only escrow. |
265
- | `fund_job_escrow` | payer | `JobEscrow`, token accounts | Moves funds into PDA vault. |
266
- | `complete_job_escrow` | operator | `JobEscrow` | Adds service receipt hash only. |
267
- | `release_job_escrow` | payer/arbiter/authorized signer | `JobEscrow`, token accounts | Releases funds and records settlement ref hash. |
268
- | `refund_job_escrow` | payer/operator/arbiter according to policy | `JobEscrow`, token accounts | Refunds funds and records settlement ref hash. |
269
- | `dispute_job_escrow` | payer or operator | `JobEscrow` | No free-text evidence on-chain. |
270
-
271
- ## Events
272
-
273
- Events should be sufficient for indexers without requiring account fetches for every proof, but must remain public-safe.
274
-
275
- Required event fields:
276
-
277
- - `schema_hash`
278
- - primary object hash (`batch_hash`, `grant_hash`, `revocation_hash`, `report_hash`, `job_hash`, or `operator_id_hash`)
279
- - authority/signing pubkey
280
- - slot and Unix time
281
- - status/state enum
282
- - chain/program id
283
-
284
- Events must not include JSON blobs, URLs with query credentials, local paths, tenant names, email addresses, memory ids, prompts, completions, transcripts, embeddings, ACL bodies, or free-text dispute/revocation details.
285
-
286
- ## Off-chain packet structure
287
-
288
- `enigma.proof_network.packet.v1` is the portable verifier envelope. It may contain:
289
-
290
- ```json
291
- {
292
- "schema": "enigma.proof_network.packet.v1",
293
- "network": "solana-devnet",
294
- "program_id": "ProofRail1111111111111111111111111111111111",
295
- "transaction_submitted": false,
296
- "raw_memory_on_chain": false,
297
- "artifacts": [
298
- {
299
- "schema": "enigma.proof_network.anchor_batch.v1",
300
- "artifact_hash": "sha256:0000000000000000000000000000000000000000000000000000000000000001",
301
- "chain_ref": "solana:devnet:signature-placeholder",
302
- "account_ref_hash": "sha256:0000000000000000000000000000000000000000000000000000000000000002"
303
- }
304
- ],
305
- "claim_boundary": {
306
- "proves": ["opaque commitment anchored", "public-safe artifact hash linked"],
307
- "does_not_prove": ["provider deletion", "model forgetting", "raw memory storage", "provider invoice savings", "token ROI"]
308
- }
309
- }
310
- ```
311
-
312
- The example uses placeholder hashes only. Real packets must be generated by the SDK/CLI from canonical JSON and must pass `assertNoPrivateProofPayload` before signing or export.
313
-
314
- ## Privacy and threat model
315
-
316
- ### Protected assets
317
-
318
- - raw memory and deleted/tombstoned memory bodies;
319
- - prompts, transcripts, completions, embeddings, and provider responses;
320
- - ACL bodies, tenant/customer names, workspace names, support tickets, and legal-hold details;
321
- - private keys, seed phrases, API keys, cloud credentials, and signing material;
322
- - benchmark dataset rows, private answers, grader traces, and provider outputs;
323
- - local file paths that reveal usernames, customer names, or private project names.
324
-
325
- ### Adversaries
326
-
327
- | Adversary | Risk | Controls |
328
- | --- | --- | --- |
329
- | Chain observer/indexer | Correlates public keys, refs, timings, and repeated hashes. | Use nonces, domain-separated hashes, batched anchors, delayed submission where acceptable, and avoid tenant/customer names. |
330
- | Malicious operator | Publishes broad grants, false benchmark claims, or settlement receipts without work. | Capability expiry, registry status, benchmark claim-boundary hashes, escrow state machine, dispute/nullifier flow, offline verifier checks. |
331
- | Compromised client | Attempts to put memory/plaintext fields in proof artifacts. | `assertNoPrivateProofPayload`, strict schemas, fixed instruction args, no arbitrary JSON instruction payloads. |
332
- | Replay attacker | Reuses an old grant, job completion, or attestation authorization. | Slot windows, nonce fields, domain-separated nullifiers, PDA uniqueness. |
333
- | Registry key compromise | Signs fraudulent attestations or grants. | Key rotation, registry pause/remove status, revocation/nullifier accounts, short-lived grants, multi-sig governance for high-impact roles. |
334
- | Documentation/marketing overclaim | Claims storage, compliance, ROI, provider deletion, or model forgetting from chain evidence. | Claim-boundary hashes, public docs non-claims, mainnet release review gates. |
335
-
336
- ### Data minimization checklist
337
-
338
- Before a client emits any chain-ready artifact, it must verify:
339
-
340
- - `transaction_submitted` is explicit and accurate.
341
- - `raw_memory_on_chain:false` is present for local planning packets and chain receipts.
342
- - No forbidden key names appear: `memory`, `prompt`, `completion`, `transcript`, `embedding`, `acl`, `tenant_name`, `api_key`, `private_key`, `seed_phrase`, `provider_response`, or close variants.
343
- - No secret-like values appear: bearer tokens, base64 private-key material, seed phrase patterns, credentialed URLs, local absolute paths, or human-readable private content.
344
- - Every public reference is either a hash, content-addressed id, package/version ref, public documentation ref, or redacted opaque id.
345
-
346
- ## Why Solana is proof/permission/settlement, not storage
347
-
348
- Solana is valuable here because it provides low-latency finality, inexpensive account writes, programmable permissions, public ordering, and token settlement. Those strengths fit proof rails and settlement rails. They do not make a public chain a suitable memory store.
349
-
350
- | Need | Correct location | Why |
351
- | --- | --- | --- |
352
- | Raw memory retrieval | Local vault, hosted vault, BYOC/on-prem storage | Requires privacy, low-latency query, deletion/tombstone controls, and customer custody. |
353
- | Prompt/context assembly | Local SDK, gateway, approved client/session | Requires private user intent and provider-specific insertion controls. |
354
- | ACL body and tenant policy | Customer/operator policy store | Contains private roles, purposes, legal holds, regions, and escalation paths. |
355
- | Benchmark rows and traces | Benchmark report store | May contain dataset license restrictions and provider outputs. |
356
- | Public proof roots | Solana `BatchAnchor` | Hashes/roots are safe to publish and benefit from public ordering. |
357
- | Permission state | Solana `CapabilityGrant` and nullifiers | Public keys, scopes, expiries, and revocations benefit from shared verification. |
358
- | Service payment | Solana `JobEscrow` | Escrow and release/refund states benefit from atomic settlement. |
359
- | Operator discovery | Solana `OperatorRegistry` | Public operator keys, service classes, and status are useful to all clients. |
360
-
361
- The boundary is simple: if it helps anyone reconstruct private memory, customer identity, private policy, provider output, or secret material, it stays off-chain.
362
-
363
- ## Devnet rollout
364
-
365
- ### Phase 0: local artifact contract
366
-
367
- - Implement SDK/CLI artifacts for anchor batches, grants, revocations, benchmark attestations, packets, and settlement links.
368
- - Enforce `assertNoPrivateProofPayload` on all public exports.
369
- - Add local-only CLI commands: `enigma chain anchor`, `enigma chain grant`, `enigma chain revoke`, `enigma chain attest`, and `enigma chain verify`.
370
- - Default local command output to `transaction_submitted:false` and `raw_memory_on_chain:false`.
371
- - Produce deterministic fixture packets with placeholder hashes and no live RPC.
372
-
373
- Exit criteria:
374
-
375
- - Local verifier accepts supported artifacts and rejects private payload keys/values.
376
- - Docs and examples contain only hashes, roots, refs, counts, signatures, and public keys.
377
-
378
- ### Phase 1: devnet program prototype
379
-
380
- - Build the Solana program with the account layouts above.
381
- - Deploy to devnet under an explicitly non-production program id.
382
- - Support `create_batch_anchor`, `create_capability_grant`, `revoke_capability`, `create_benchmark_attestation`, `register_operator`, and read-only verifier tooling first.
383
- - Keep `JobEscrow` behind a feature flag until token-vault behavior and dispute/refund semantics have focused tests.
384
-
385
- Exit criteria:
386
-
387
- - Devnet transactions contain no arbitrary JSON payloads.
388
- - Indexer can reconstruct event stream from public-safe fields.
389
- - Offline verifier can compare packet hashes to devnet accounts/events.
390
-
391
- ### Phase 2: controlled devnet pilots
392
-
393
- - Register one or more test operators with rotated signing keys.
394
- - Anchor benchmark-attestation packets generated from public-safe benchmark reports.
395
- - Exercise grant expiry, revocation/nullifier, operator pause, and key rotation.
396
- - Exercise `JobEscrow` with devnet tokens only after vault, release, refund, and dispute tests pass.
397
-
398
- Exit criteria:
399
-
400
- - At least one end-to-end packet links local artifact hash, devnet account, transaction signature, and offline verifier result.
401
- - Revoked grants fail closed in client and program paths.
402
- - Operator pause blocks new actions while preserving historical verification.
403
- - No private values appear in transaction data, logs, account data, events, docs, or fixtures.
404
-
405
- ### Phase 3: mainnet candidate
406
-
407
- - Freeze account layouts for v1 or provide an explicit migration plan.
408
- - Review program upgrade authority, governance, emergency pause, and registry removal controls.
409
- - Run independent security review of escrow/token flows, PDA seeds, authority checks, replay/nullifier logic, and privacy boundaries.
410
- - Publish a claim-boundary packet explaining exactly what mainnet evidence proves and does not prove.
411
-
412
- Exit criteria:
413
-
414
- - Mainnet launch checklist is complete.
415
- - Legal/security review approves public wording.
416
- - No hosted/BYOC/live-infrastructure readiness is implied by proof-rail launch.
417
-
418
- ## Mainnet gates
419
-
420
- Mainnet use is blocked until all gates below are satisfied for the exact program id and release version:
421
-
422
- 1. **Program security review:** independent review for authority checks, PDA derivation, account reinitialization, escrow vault ownership, token mint handling, arithmetic, and replay protection.
423
- 2. **Privacy review:** transaction data, emitted logs, account data, examples, fixtures, and docs are scanned for forbidden private keys/values and human-readable customer identifiers.
424
- 3. **Upgrade governance:** upgrade authority is multi-sig or intentionally burned; emergency pause and recovery paths are documented.
425
- 4. **Verifier parity:** offline verifier and on-chain layouts agree on canonical hashing, schema ids, chain refs, and account/event parsing.
426
- 5. **Revocation reliability:** grants, nullifiers, operator pause/remove, and key rotation fail closed in SDK, CLI, and program tests.
427
- 6. **Escrow safety:** token-vault operations have focused tests for fund, release, refund, dispute, close-account, and wrong-mint/wrong-owner cases.
428
- 7. **Claim governance:** public materials state that Solana is proof/permission/settlement only, not raw memory storage, provider deletion proof, model forgetting proof, compliance status, token ROI, or provider invoice savings.
429
- 8. **Operational ownership:** operator registry admin, incident response, key rotation, monitoring, and support ownership are assigned.
430
- 9. **Devnet evidence:** controlled devnet packets show successful anchor, grant, revoke, attestation, registry update, and escrow lifecycle without private payload leakage.
431
- 10. **Release alignment:** docs, CLI help, schema names, package exports, and examples reference the same v1 artifact contracts.
432
-
433
- ## Implementation notes
434
-
435
- - Use SHA-256 for Enigma artifact hashes and Merkle roots unless a Solana-native verifier path explicitly requires another hash. If another hash is added, domain-separate it and keep the original SHA-256 in the off-chain packet.
436
- - Canonical JSON hashing must sort object keys, preserve numbers as JSON numbers where safe, and reject non-finite values.
437
- - Use domain tags for every hash: `anchor_batch`, `capability_grant`, `capability_revocation`, `benchmark_attestation`, `job_escrow`, `operator_registry`, and `packet`.
438
- - Prefer fixed-size byte arrays and enums in instruction args. Avoid variable user text and arbitrary JSON on-chain.
439
- - Keep account sizes bounded. Store hash lists off-chain behind roots when a vector could grow without a hard cap.
440
- - Every chain-writing CLI command should have a local planning mode first. The default for release `0.1.13` planning artifacts is no transaction submission.
441
- - Chain refs should include cluster, program id, signature/account id, and slot. They should not include RPC URLs with credentials.
442
-
443
- ## Future implementation checklist
444
-
445
- - [ ] Finalize Rust/Anchor account structs and instruction args from this document.
446
- - [ ] Add deterministic PDA derivation helpers to the SDK.
447
- - [ ] Add client-side artifact builders for all `enigma.proof_network.*.v1` schemas.
448
- - [ ] Add private-payload rejection before serialization, signing, and file output.
449
- - [ ] Add local packet verification independent of Solana RPC.
450
- - [ ] Add optional devnet submission only behind explicit flags and clear warnings.
451
- - [ ] Add devnet indexer/parser fixtures with public-safe account/event examples.
452
- - [ ] Add escrow focused tests before any mainnet candidate.
453
- - [ ] Complete mainnet gates before presenting the proof rail as live mainnet infrastructure.
1
+ # Solana proof rail
2
+
3
+ Enigma's Solana rail is a proof, permission, and settlement layer for AI memory. It anchors opaque commitments, grants scoped capabilities, records revocations/nullifiers, attests benchmark reports, escrows service jobs, and registers operators. It does **not** store raw memory, prompts, transcripts, completions, embeddings, provider responses, tenant names, secrets, private keys, seed phrases, or ACL bodies on-chain.
4
+
5
+ The hot memory path stays local, hosted, BYOC, or on-prem under the deployment owner's custody. Solana receives only public-safe hashes, roots, counts, refs, public keys, signatures, timestamps/slots, and settlement amounts.
6
+
7
+ ## Design principles
8
+
9
+ 1. **Public chain payloads are content-minimized.** Every account and instruction must be acceptable for permanent public disclosure.
10
+ 2. **Plaintext rejection happens before signing.** Client SDKs and CLI commands must reject forbidden keys and secret-like values before producing a transaction or chain-ready artifact.
11
+ 3. **Solana is not canonical storage.** Durable memory, ACL bodies, benchmark reports, invoices, operator terms, and customer policy documents live off-chain in controlled storage. Chain state references them by hash/ref only.
12
+ 4. **Receipts remain verifier-friendly.** Every on-chain object maps to an `enigma.proof_network.*.v1` artifact so an offline verifier can validate shape, hashes, signatures, ordering, and claim boundaries without RPC access.
13
+ 5. **Program state is append-only where possible.** Anchors and attestations are immutable after creation. Mutable accounts are limited to registry status, escrow state, grant status, and explicit revocations.
14
+ 6. **No token or ROI claims.** Settlement proves job/quote/receipt linkage and payment movement only. It is not investment, yield, provider invoice, savings guarantee, compliance, provider deletion, or model-forgetting evidence.
15
+
16
+ ## Artifact-to-chain mapping
17
+
18
+ | Enigma artifact | Solana object | Purpose | Public fields only |
19
+ | --- | --- | --- | --- |
20
+ | `enigma.proof_network.anchor_batch.v1` | `BatchAnchor` account plus `AnchorBatchCreated` event | Batch opaque proof roots for later verification. | batch hash, Merkle root, artifact counts, schema ids, optional public refs, authority, slot. |
21
+ | `enigma.proof_network.capability_grant.v1` | `CapabilityGrant` account plus event | Grant a public key permission to perform a scoped proof-network action. | issuer, grantee, scope hash, policy hash, capability kind, expiry, nonce, grant hash. |
22
+ | `enigma.proof_network.capability_revocation.v1` | `CapabilityRevocation` / `Nullifier` account plus event | Revoke or nullify a grant/job/attestation capability without disclosing private policy content. | target hash, nullifier hash, revoker, reason code, slot, revocation hash. |
23
+ | `enigma.proof_network.benchmark_attestation.v1` | `BenchmarkAttestation` account plus event | Bind a benchmark result packet to dataset, runner, package, environment, and metrics roots. | report hash, dataset hash/ref, runner hash/ref, package hash/ref, metrics root, counts, signer. |
24
+ | `enigma.proof_network.packet.v1` | No single required account; verifier envelope over the above | Portable offline proof packet that may include chain refs. | artifact list, hashes, chain ids, signatures, validation results. |
25
+ | Settlement artifacts | `JobEscrow` account plus settlement events | Lock, release, refund, or dispute payment against a hash-only job. | job hash, quote hash, usage hash, memory root, policy hash, amount, mint, parties, state. |
26
+ | Operator metadata | `OperatorRegistry` account plus events | Discover operators and verify authorized signing keys/services. | operator authority, service classes, signing key hash/pubkey, terms hash/ref, status, reputation root. |
27
+
28
+ ## Program accounts
29
+
30
+ All account seeds must avoid private identifiers. Use public keys and hashes, never tenant names, human-readable workspace names, or raw policy labels.
31
+
32
+ ### `BatchAnchor`
33
+
34
+ `BatchAnchor` commits to a set of Enigma proof artifacts generated off-chain.
35
+
36
+ Recommended PDA seeds:
37
+
38
+ ```text
39
+ ["batch_anchor", authority_pubkey, batch_hash]
40
+ ```
41
+
42
+ Fields:
43
+
44
+ | Field | Type | Required | Notes |
45
+ | --- | --- | --- | --- |
46
+ | `version` | `u8` | yes | Starts at `1`. |
47
+ | `schema` | fixed string/hash | yes | `enigma.proof_network.anchor_batch.v1`. |
48
+ | `authority` | `Pubkey` | yes | Signer authorized to anchor the batch. |
49
+ | `batch_hash` | `[u8; 32]` | yes | SHA-256 of canonical public batch artifact. |
50
+ | `merkle_root` | `[u8; 32]` | yes | Root over artifact hashes. |
51
+ | `artifact_count` | `u32` | yes | Count only, not artifact bodies. |
52
+ | `schema_hashes` | `Vec<[u8; 32]>` | yes | Hashes of schema ids included in the batch. |
53
+ | `public_refs_hash` | `Option<[u8; 32]>` | optional | Hash of public ref list, not URLs containing credentials. |
54
+ | `created_slot` | `u64` | yes | Slot at creation. |
55
+ | `created_unix_time` | `i64` | yes | Clock sysvar time. |
56
+ | `bump` | `u8` | yes | PDA bump. |
57
+
58
+ Validation rules:
59
+
60
+ - `artifact_count > 0`.
61
+ - `merkle_root`, `batch_hash`, and every `schema_hash` are non-zero 32-byte values.
62
+ - No instruction arg may contain arbitrary JSON text; clients pass fixed bytes and counts.
63
+ - Duplicate `batch_hash` for the same authority is rejected by PDA uniqueness.
64
+
65
+ ### `CapabilityGrant`
66
+
67
+ `CapabilityGrant` gives a grantee a scoped permission such as anchoring batches, opening escrows, signing benchmark attestations, or administering an operator profile.
68
+
69
+ Recommended PDA seeds:
70
+
71
+ ```text
72
+ ["capability_grant", issuer_pubkey, grantee_pubkey, grant_hash]
73
+ ```
74
+
75
+ Fields:
76
+
77
+ | Field | Type | Required | Notes |
78
+ | --- | --- | --- | --- |
79
+ | `version` | `u8` | yes | Starts at `1`. |
80
+ | `schema` | fixed string/hash | yes | `enigma.proof_network.capability_grant.v1`. |
81
+ | `issuer` | `Pubkey` | yes | Grant authority. |
82
+ | `grantee` | `Pubkey` | yes | Capability holder. |
83
+ | `capability_kind` | enum | yes | `anchor_batch`, `grant_capability`, `revoke_capability`, `attest_benchmark`, `open_job_escrow`, `settle_job`, `admin_operator`. |
84
+ | `scope_hash` | `[u8; 32]` | yes | Hash of private/off-chain scope document or public-safe scope tuple. |
85
+ | `policy_hash` | `[u8; 32]` | yes | Hash of policy body; policy body stays off-chain. |
86
+ | `not_before_slot` | `u64` | yes | Prevents early use. |
87
+ | `expires_slot` | `u64` | yes | Must be greater than `not_before_slot`. |
88
+ | `nonce` | `[u8; 32]` | yes | Public random nonce for unlinkability across grants. |
89
+ | `grant_hash` | `[u8; 32]` | yes | Canonical artifact hash. |
90
+ | `status` | enum | yes | `active`, `revoked`, `expired`. |
91
+ | `bump` | `u8` | yes | PDA bump. |
92
+
93
+ Validation rules:
94
+
95
+ - A grant is usable only when the current slot is within the grant window and no matching revocation/nullifier exists.
96
+ - `scope_hash` must commit to least privilege. It should include capability kind, allowed program ids, public operator id/hash, and approved artifact schemas.
97
+ - `policy_hash` never reveals policy text, tenant names, memory ids, or ACL bodies.
98
+
99
+ ### `CapabilityRevocation` / `Nullifier`
100
+
101
+ A revocation makes a grant unusable. A nullifier prevents replay of a one-time right, escrow settlement, or attestation authorization without publishing the underlying private policy.
102
+
103
+ Recommended PDA seeds:
104
+
105
+ ```text
106
+ ["capability_revocation", target_hash, revocation_hash]
107
+ ["nullifier", domain_hash, nullifier_hash]
108
+ ```
109
+
110
+ Fields:
111
+
112
+ | Field | Type | Required | Notes |
113
+ | --- | --- | --- | --- |
114
+ | `version` | `u8` | yes | Starts at `1`. |
115
+ | `schema` | fixed string/hash | yes | `enigma.proof_network.capability_revocation.v1`. |
116
+ | `revoker` | `Pubkey` | yes | Issuer, delegated revoker, or program authority. |
117
+ | `target_hash` | `[u8; 32]` | yes | Hash of grant/job/attestation capability being revoked. |
118
+ | `domain_hash` | `[u8; 32]` | yes | Separates grant, job, operator, and benchmark domains. |
119
+ | `nullifier_hash` | `[u8; 32]` | yes | One-way nullifier. |
120
+ | `reason_code` | enum | yes | `rotation`, `expiry`, `compromise`, `policy_change`, `operator_exit`, `error`, `other`. No free-text reason. |
121
+ | `revocation_hash` | `[u8; 32]` | yes | Canonical artifact hash. |
122
+ | `created_slot` | `u64` | yes | Slot at revocation. |
123
+ | `bump` | `u8` | yes | PDA bump. |
124
+
125
+ Validation rules:
126
+
127
+ - Free-text revocation reasons are not accepted on-chain.
128
+ - Revocation authority must be the issuer, a valid delegated revoker, or a configured program governance authority.
129
+ - A nullifier can be created once per domain/hash pair; duplicate creation fails.
130
+
131
+ ### `BenchmarkAttestation`
132
+
133
+ `BenchmarkAttestation` binds benchmark evidence to immutable public-safe references. It must not include prompts, completions, answers, dataset rows, provider outputs, or private runner logs.
134
+
135
+ Recommended PDA seeds:
136
+
137
+ ```text
138
+ ["benchmark_attestation", signer_pubkey, report_hash]
139
+ ```
140
+
141
+ Fields:
142
+
143
+ | Field | Type | Required | Notes |
144
+ | --- | --- | --- | --- |
145
+ | `version` | `u8` | yes | Starts at `1`. |
146
+ | `schema` | fixed string/hash | yes | `enigma.proof_network.benchmark_attestation.v1`. |
147
+ | `signer` | `Pubkey` | yes | Attestation authority. |
148
+ | `report_hash` | `[u8; 32]` | yes | Hash of public-safe benchmark report. |
149
+ | `dataset_ref_hash` | `[u8; 32]` | yes | Hash of dataset manifest/ref, not dataset content. |
150
+ | `runner_ref_hash` | `[u8; 32]` | yes | Hash of runner version/source ref. |
151
+ | `package_ref_hash` | `[u8; 32]` | yes | Hash of package/version/provenance ref. |
152
+ | `metrics_root` | `[u8; 32]` | yes | Merkle root over public metrics and counts. |
153
+ | `sample_count` | `u32` | yes | Count only. |
154
+ | `claim_boundary_hash` | `[u8; 32]` | yes | Commits to allowed claims/non-claims. |
155
+ | `created_slot` | `u64` | yes | Slot at attestation. |
156
+ | `bump` | `u8` | yes | PDA bump. |
157
+
158
+ Validation rules:
159
+
160
+ - Attestation creation requires an active `attest_benchmark` capability or operator registry authority.
161
+ - `sample_count` must match the off-chain report summary committed by `report_hash` and `metrics_root`.
162
+ - Any comparison or leadership claim must be represented only by a report hash and claim-boundary hash until a reviewed public report exists.
163
+
164
+ ### `JobEscrow`
165
+
166
+ `JobEscrow` connects permissionless access and settlement to Enigma's hash-only job artifacts. It does not execute memory work and does not reveal job contents.
167
+
168
+ Recommended PDA seeds:
169
+
170
+ ```text
171
+ ["job_escrow", payer_pubkey, operator_pubkey, job_hash]
172
+ ```
173
+
174
+ State machine:
175
+
176
+ ```text
177
+ initialized -> funded -> completed -> released
178
+ initialized -> funded -> refunded
179
+ initialized -> funded -> disputed -> released|refunded
180
+ initialized -> cancelled
181
+ ```
182
+
183
+ Fields:
184
+
185
+ | Field | Type | Required | Notes |
186
+ | --- | --- | --- | --- |
187
+ | `version` | `u8` | yes | Starts at `1`. |
188
+ | `payer` | `Pubkey` | yes | Funds escrow. |
189
+ | `operator` | `Pubkey` | yes | Provides the service. |
190
+ | `mint` | `Pubkey` | yes | SPL token mint or native SOL sentinel design. |
191
+ | `vault` | `Pubkey` | yes | Token account owned by the escrow PDA. |
192
+ | `amount` | `u64` | yes | Smallest units. |
193
+ | `job_hash` | `[u8; 32]` | yes | Hash-only job commitment. |
194
+ | `quote_hash` | `[u8; 32]` | yes | Operator quote hash. |
195
+ | `usage_hash` | `[u8; 32]` | yes | Usage event/aggregate hash. |
196
+ | `memory_root` | `[u8; 32]` | yes | Opaque memory commitment root. |
197
+ | `policy_hash` | `[u8; 32]` | yes | Policy hash. |
198
+ | `service_receipt_hash` | `Option<[u8; 32]>` | set on completion | Hash of service receipt. |
199
+ | `settlement_ref_hash` | `Option<[u8; 32]>` | set on release/refund | Hash of settlement reference. |
200
+ | `deadline_slot` | `u64` | yes | Refund/dispute boundary. |
201
+ | `state` | enum | yes | State machine above. |
202
+ | `bump` | `u8` | yes | PDA bump. |
203
+
204
+ Instruction rules:
205
+
206
+ - `open_job_escrow` requires payer signature and an active operator profile.
207
+ - `fund_job_escrow` transfers tokens into the escrow vault and sets `funded`.
208
+ - `complete_job_escrow` requires operator signature plus an active grant or registry authority and writes only `service_receipt_hash`.
209
+ - `release_job_escrow` requires payer approval, arbitrator approval, or pre-agreed auto-release conditions committed by `policy_hash`.
210
+ - `refund_job_escrow` requires deadline expiry, payer/operator agreement, or dispute resolution.
211
+ - `dispute_job_escrow` records dispute state without free-text evidence.
212
+
213
+ The public invariant mirrors Enigma settlement receipts:
214
+
215
+ ```text
216
+ settled_amount <= quote_price <= job_max_price
217
+ ```
218
+
219
+ The program can enforce the escrow amount and quote hash linkage. The off-chain verifier enforces full job/quote/usage/receipt consistency from public-safe artifacts.
220
+
221
+ ### `OperatorRegistry`
222
+
223
+ `OperatorRegistry` declares who may operate proof-network services and which signing keys/capabilities are current.
224
+
225
+ Recommended PDA seeds:
226
+
227
+ ```text
228
+ ["operator_registry", operator_authority_pubkey]
229
+ ```
230
+
231
+ Fields:
232
+
233
+ | Field | Type | Required | Notes |
234
+ | --- | --- | --- | --- |
235
+ | `version` | `u8` | yes | Starts at `1`. |
236
+ | `operator_authority` | `Pubkey` | yes | Admin authority. |
237
+ | `operator_id_hash` | `[u8; 32]` | yes | Hash of public operator id/ref; no tenant/customer names. |
238
+ | `signing_keys` | `Vec<Pubkey>` | yes | Active keys for attestations, grants, and service receipts. |
239
+ | `service_classes` | bitset/enum vec | yes | `anchor`, `benchmark_attester`, `memory_optimizer`, `gateway`, `arbiter`. |
240
+ | `terms_ref_hash` | `[u8; 32]` | yes | Hash of public terms/ref. |
241
+ | `capacity_ref_hash` | `Option<[u8; 32]>` | optional | Hash of public capacity profile/ref. |
242
+ | `reputation_root` | `Option<[u8; 32]>` | optional | Root over public-safe operator metrics. |
243
+ | `status` | enum | yes | `active`, `paused`, `exiting`, `removed`. |
244
+ | `updated_slot` | `u64` | yes | Last registry update. |
245
+ | `bump` | `u8` | yes | PDA bump. |
246
+
247
+ Validation rules:
248
+
249
+ - Updating signing keys requires `operator_authority` and creates a registry update event.
250
+ - Paused/removed operators cannot open new escrows, issue new attestations, or use operator-scoped grants.
251
+ - `reputation_root` may commit to uptime, completion counts, dispute counts, or benchmark-attestation acceptance counts, but not customer names or private job metadata.
252
+
253
+ ## Instruction set
254
+
255
+ | Instruction | Required signers | Writes | Notes |
256
+ | --- | --- | --- | --- |
257
+ | `create_batch_anchor` | anchor authority | `BatchAnchor` | Emits `AnchorBatchCreated`. |
258
+ | `create_capability_grant` | issuer | `CapabilityGrant` | Issuer must be program authority, operator authority, or holder of a valid grant-capability grant. |
259
+ | `revoke_capability` | revoker | `CapabilityGrant`, `CapabilityRevocation`/`Nullifier` | Marks grant revoked and emits revocation event. |
260
+ | `create_nullifier` | authorized signer | `Nullifier` | One-time replay prevention for grants/jobs/attestations. |
261
+ | `create_benchmark_attestation` | attestation signer | `BenchmarkAttestation` | Requires grant or registry authority. |
262
+ | `register_operator` | operator authority | `OperatorRegistry` | Creates active or paused profile. |
263
+ | `update_operator` | operator authority | `OperatorRegistry` | Rotates keys, refs, status, service classes. |
264
+ | `open_job_escrow` | payer | `JobEscrow` | Initializes hash-only escrow. |
265
+ | `fund_job_escrow` | payer | `JobEscrow`, token accounts | Moves funds into PDA vault. |
266
+ | `complete_job_escrow` | operator | `JobEscrow` | Adds service receipt hash only. |
267
+ | `release_job_escrow` | payer/arbiter/authorized signer | `JobEscrow`, token accounts | Releases funds and records settlement ref hash. |
268
+ | `refund_job_escrow` | payer/operator/arbiter according to policy | `JobEscrow`, token accounts | Refunds funds and records settlement ref hash. |
269
+ | `dispute_job_escrow` | payer or operator | `JobEscrow` | No free-text evidence on-chain. |
270
+
271
+ ## Events
272
+
273
+ Events should be sufficient for indexers without requiring account fetches for every proof, but must remain public-safe.
274
+
275
+ Required event fields:
276
+
277
+ - `schema_hash`
278
+ - primary object hash (`batch_hash`, `grant_hash`, `revocation_hash`, `report_hash`, `job_hash`, or `operator_id_hash`)
279
+ - authority/signing pubkey
280
+ - slot and Unix time
281
+ - status/state enum
282
+ - chain/program id
283
+
284
+ Events must not include JSON blobs, URLs with query credentials, local paths, tenant names, email addresses, memory ids, prompts, completions, transcripts, embeddings, ACL bodies, or free-text dispute/revocation details.
285
+
286
+ ## Off-chain packet structure
287
+
288
+ `enigma.proof_network.packet.v1` is the portable verifier envelope. It may contain:
289
+
290
+ ```json
291
+ {
292
+ "schema": "enigma.proof_network.packet.v1",
293
+ "network": "solana-devnet",
294
+ "program_id": "ProofRail1111111111111111111111111111111111",
295
+ "transaction_submitted": false,
296
+ "raw_memory_on_chain": false,
297
+ "artifacts": [
298
+ {
299
+ "schema": "enigma.proof_network.anchor_batch.v1",
300
+ "artifact_hash": "sha256:0000000000000000000000000000000000000000000000000000000000000001",
301
+ "chain_ref": "solana:devnet:signature-placeholder",
302
+ "account_ref_hash": "sha256:0000000000000000000000000000000000000000000000000000000000000002"
303
+ }
304
+ ],
305
+ "claim_boundary": {
306
+ "proves": ["opaque commitment anchored", "public-safe artifact hash linked"],
307
+ "does_not_prove": ["provider deletion", "model forgetting", "raw memory storage", "provider invoice savings", "token ROI"]
308
+ }
309
+ }
310
+ ```
311
+
312
+ The example uses placeholder hashes only. Real packets must be generated by the SDK/CLI from canonical JSON and must pass `assertNoPrivateProofPayload` before signing or export.
313
+
314
+ ## Privacy and threat model
315
+
316
+ ### Protected assets
317
+
318
+ - raw memory and deleted/tombstoned memory bodies;
319
+ - prompts, transcripts, completions, embeddings, and provider responses;
320
+ - ACL bodies, tenant/customer names, workspace names, support tickets, and legal-hold details;
321
+ - private keys, seed phrases, API keys, cloud credentials, and signing material;
322
+ - benchmark dataset rows, private answers, grader traces, and provider outputs;
323
+ - local file paths that reveal usernames, customer names, or private project names.
324
+
325
+ ### Adversaries
326
+
327
+ | Adversary | Risk | Controls |
328
+ | --- | --- | --- |
329
+ | Chain observer/indexer | Correlates public keys, refs, timings, and repeated hashes. | Use nonces, domain-separated hashes, batched anchors, delayed submission where acceptable, and avoid tenant/customer names. |
330
+ | Malicious operator | Publishes broad grants, false benchmark claims, or settlement receipts without work. | Capability expiry, registry status, benchmark claim-boundary hashes, escrow state machine, dispute/nullifier flow, offline verifier checks. |
331
+ | Compromised client | Attempts to put memory/plaintext fields in proof artifacts. | `assertNoPrivateProofPayload`, strict schemas, fixed instruction args, no arbitrary JSON instruction payloads. |
332
+ | Replay attacker | Reuses an old grant, job completion, or attestation authorization. | Slot windows, nonce fields, domain-separated nullifiers, PDA uniqueness. |
333
+ | Registry key compromise | Signs fraudulent attestations or grants. | Key rotation, registry pause/remove status, revocation/nullifier accounts, short-lived grants, multi-sig governance for high-impact roles. |
334
+ | Documentation/marketing overclaim | Claims storage, compliance, ROI, provider deletion, or model forgetting from chain evidence. | Claim-boundary hashes, public docs non-claims, mainnet release review gates. |
335
+
336
+ ### Data minimization checklist
337
+
338
+ Before a client emits any chain-ready artifact, it must verify:
339
+
340
+ - `transaction_submitted` is explicit and accurate.
341
+ - `raw_memory_on_chain:false` is present for local planning packets and chain receipts.
342
+ - No forbidden key names appear: `memory`, `prompt`, `completion`, `transcript`, `embedding`, `acl`, `tenant_name`, `api_key`, `private_key`, `seed_phrase`, `provider_response`, or close variants.
343
+ - No secret-like values appear: bearer tokens, base64 private-key material, seed phrase patterns, credentialed URLs, local absolute paths, or human-readable private content.
344
+ - Every public reference is either a hash, content-addressed id, package/version ref, public documentation ref, or redacted opaque id.
345
+
346
+ ## Why Solana is proof/permission/settlement, not storage
347
+
348
+ Solana is valuable here because it provides low-latency finality, inexpensive account writes, programmable permissions, public ordering, and token settlement. Those strengths fit proof rails and settlement rails. They do not make a public chain a suitable memory store.
349
+
350
+ | Need | Correct location | Why |
351
+ | --- | --- | --- |
352
+ | Raw memory retrieval | Local vault, hosted vault, BYOC/on-prem storage | Requires privacy, low-latency query, deletion/tombstone controls, and customer custody. |
353
+ | Prompt/context assembly | Local SDK, gateway, approved client/session | Requires private user intent and provider-specific insertion controls. |
354
+ | ACL body and tenant policy | Customer/operator policy store | Contains private roles, purposes, legal holds, regions, and escalation paths. |
355
+ | Benchmark rows and traces | Benchmark report store | May contain dataset license restrictions and provider outputs. |
356
+ | Public proof roots | Solana `BatchAnchor` | Hashes/roots are safe to publish and benefit from public ordering. |
357
+ | Permission state | Solana `CapabilityGrant` and nullifiers | Public keys, scopes, expiries, and revocations benefit from shared verification. |
358
+ | Service payment | Solana `JobEscrow` | Escrow and release/refund states benefit from atomic settlement. |
359
+ | Operator discovery | Solana `OperatorRegistry` | Public operator keys, service classes, and status are useful to all clients. |
360
+
361
+ The boundary is simple: if it helps anyone reconstruct private memory, customer identity, private policy, provider output, or secret material, it stays off-chain.
362
+
363
+ ## Devnet rollout
364
+
365
+ ### Phase 0: local artifact contract
366
+
367
+ - Implement SDK/CLI artifacts for anchor batches, grants, revocations, benchmark attestations, packets, and settlement links.
368
+ - Enforce `assertNoPrivateProofPayload` on all public exports.
369
+ - Add local-only CLI commands: `enigma chain anchor`, `enigma chain grant`, `enigma chain revoke`, `enigma chain attest`, and `enigma chain verify`.
370
+ - Default local command output to `transaction_submitted:false` and `raw_memory_on_chain:false`.
371
+ - Produce deterministic fixture packets with placeholder hashes and no live RPC.
372
+
373
+ Exit criteria:
374
+
375
+ - Local verifier accepts supported artifacts and rejects private payload keys/values.
376
+ - Docs and examples contain only hashes, roots, refs, counts, signatures, and public keys.
377
+
378
+ ### Phase 1: devnet program prototype
379
+
380
+ - Build the Solana program with the account layouts above.
381
+ - Deploy to devnet under an explicitly non-production program id.
382
+ - Support `create_batch_anchor`, `create_capability_grant`, `revoke_capability`, `create_benchmark_attestation`, `register_operator`, and read-only verifier tooling first.
383
+ - Keep `JobEscrow` behind a feature flag until token-vault behavior and dispute/refund semantics have focused tests.
384
+
385
+ Exit criteria:
386
+
387
+ - Devnet transactions contain no arbitrary JSON payloads.
388
+ - Indexer can reconstruct event stream from public-safe fields.
389
+ - Offline verifier can compare packet hashes to devnet accounts/events.
390
+
391
+ ### Phase 2: controlled devnet pilots
392
+
393
+ - Register one or more test operators with rotated signing keys.
394
+ - Anchor benchmark-attestation packets generated from public-safe benchmark reports.
395
+ - Exercise grant expiry, revocation/nullifier, operator pause, and key rotation.
396
+ - Exercise `JobEscrow` with devnet tokens only after vault, release, refund, and dispute tests pass.
397
+
398
+ Exit criteria:
399
+
400
+ - At least one end-to-end packet links local artifact hash, devnet account, transaction signature, and offline verifier result.
401
+ - Revoked grants fail closed in client and program paths.
402
+ - Operator pause blocks new actions while preserving historical verification.
403
+ - No private values appear in transaction data, logs, account data, events, docs, or fixtures.
404
+
405
+ ### Phase 3: mainnet candidate
406
+
407
+ - Freeze account layouts for v1 or provide an explicit migration plan.
408
+ - Review program upgrade authority, governance, emergency pause, and registry removal controls.
409
+ - Run independent security review of escrow/token flows, PDA seeds, authority checks, replay/nullifier logic, and privacy boundaries.
410
+ - Publish a claim-boundary packet explaining exactly what mainnet evidence proves and does not prove.
411
+
412
+ Exit criteria:
413
+
414
+ - Mainnet launch checklist is complete.
415
+ - Legal/security review approves public wording.
416
+ - No hosted/BYOC/live-infrastructure readiness is implied by proof-rail launch.
417
+
418
+ ## Mainnet gates
419
+
420
+ Mainnet use is blocked until all gates below are satisfied for the exact program id and release version:
421
+
422
+ 1. **Program security review:** independent review for authority checks, PDA derivation, account reinitialization, escrow vault ownership, token mint handling, arithmetic, and replay protection.
423
+ 2. **Privacy review:** transaction data, emitted logs, account data, examples, fixtures, and docs are scanned for forbidden private keys/values and human-readable customer identifiers.
424
+ 3. **Upgrade governance:** upgrade authority is multi-sig or intentionally burned; emergency pause and recovery paths are documented.
425
+ 4. **Verifier parity:** offline verifier and on-chain layouts agree on canonical hashing, schema ids, chain refs, and account/event parsing.
426
+ 5. **Revocation reliability:** grants, nullifiers, operator pause/remove, and key rotation fail closed in SDK, CLI, and program tests.
427
+ 6. **Escrow safety:** token-vault operations have focused tests for fund, release, refund, dispute, close-account, and wrong-mint/wrong-owner cases.
428
+ 7. **Claim governance:** public materials state that Solana is proof/permission/settlement only, not raw memory storage, provider deletion proof, model forgetting proof, compliance status, token ROI, or provider invoice savings.
429
+ 8. **Operational ownership:** operator registry admin, incident response, key rotation, monitoring, and support ownership are assigned.
430
+ 9. **Devnet evidence:** controlled devnet packets show successful anchor, grant, revoke, attestation, registry update, and escrow lifecycle without private payload leakage.
431
+ 10. **Release alignment:** docs, CLI help, schema names, package exports, and examples reference the same v1 artifact contracts.
432
+
433
+ ## Implementation notes
434
+
435
+ - Use SHA-256 for Enigma artifact hashes and Merkle roots unless a Solana-native verifier path explicitly requires another hash. If another hash is added, domain-separate it and keep the original SHA-256 in the off-chain packet.
436
+ - Canonical JSON hashing must sort object keys, preserve numbers as JSON numbers where safe, and reject non-finite values.
437
+ - Use domain tags for every hash: `anchor_batch`, `capability_grant`, `capability_revocation`, `benchmark_attestation`, `job_escrow`, `operator_registry`, and `packet`.
438
+ - Prefer fixed-size byte arrays and enums in instruction args. Avoid variable user text and arbitrary JSON on-chain.
439
+ - Keep account sizes bounded. Store hash lists off-chain behind roots when a vector could grow without a hard cap.
440
+ - Every chain-writing CLI command should have a local planning mode first. The default for release `0.1.14` planning artifacts is no transaction submission.
441
+ - Chain refs should include cluster, program id, signature/account id, and slot. They should not include RPC URLs with credentials.
442
+
443
+ ## Future implementation checklist
444
+
445
+ - [ ] Finalize Rust/Anchor account structs and instruction args from this document.
446
+ - [ ] Add deterministic PDA derivation helpers to the SDK.
447
+ - [ ] Add client-side artifact builders for all `enigma.proof_network.*.v1` schemas.
448
+ - [ ] Add private-payload rejection before serialization, signing, and file output.
449
+ - [ ] Add local packet verification independent of Solana RPC.
450
+ - [ ] Add optional devnet submission only behind explicit flags and clear warnings.
451
+ - [ ] Add devnet indexer/parser fixtures with public-safe account/event examples.
452
+ - [ ] Add escrow focused tests before any mainnet candidate.
453
+ - [ ] Complete mainnet gates before presenting the proof rail as live mainnet infrastructure.