|
| 1 | +# Proof Bundle v2 Format |
| 2 | + |
| 3 | +Canonical envelope for ZAP1 attestation proofs. Used by zap1_audit, zap1_export, and consumer applications. |
| 4 | + |
| 5 | +## Single proof bundle |
| 6 | + |
| 7 | +Returned by `/verify/{hash}/proof.json` and consumed by `zap1_audit --bundle`. |
| 8 | + |
| 9 | +```json |
| 10 | +{ |
| 11 | + "protocol": "ZAP1", |
| 12 | + "version": "2", |
| 13 | + "leaf": { |
| 14 | + "hash": "075b00df...", |
| 15 | + "event_type": "PROGRAM_ENTRY", |
| 16 | + "wallet_hash": "e2e_wallet_20260327", |
| 17 | + "serial_number": null, |
| 18 | + "created_at": "2026-03-27 03:28:57" |
| 19 | + }, |
| 20 | + "proof": [ |
| 21 | + { "hash": "de62554a...", "position": "right" } |
| 22 | + ], |
| 23 | + "root": { |
| 24 | + "hash": "024e3651...", |
| 25 | + "leaf_count": 2, |
| 26 | + "created_at": "2026-03-27T03:29:26Z" |
| 27 | + }, |
| 28 | + "anchor": { |
| 29 | + "txid": "98e1d6a0...", |
| 30 | + "height": 3286631 |
| 31 | + } |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +## Export package |
| 36 | + |
| 37 | +Returned by `zap1_export` and consumed by `zap1_audit --export`. |
| 38 | + |
| 39 | +```json |
| 40 | +{ |
| 41 | + "protocol": "ZAP1", |
| 42 | + "generated_at": "2026-03-30T22:53:11Z", |
| 43 | + "scope": "wallet=e2e_wallet_2", |
| 44 | + "proofs": [ |
| 45 | + { |
| 46 | + "leaf_hash": "075b00df...", |
| 47 | + "event_type": "PROGRAM_ENTRY", |
| 48 | + "wallet_hash": "e2e_wallet_20260327", |
| 49 | + "serial_number": null, |
| 50 | + "created_at": "2026-03-27 03:28:57", |
| 51 | + "proof_steps": [ { "hash": "...", "position": "right" } ], |
| 52 | + "root": "024e3651...", |
| 53 | + "anchor_txid": "98e1d6a0...", |
| 54 | + "anchor_height": 3286631, |
| 55 | + "witness": { |
| 56 | + "wallet_hash_preimage": "e2e_wallet_20260327", |
| 57 | + "serial_number": null, |
| 58 | + "hash_function": "BLAKE2b-256", |
| 59 | + "personalization": "NordicShield_", |
| 60 | + "recompute": "hash(type_byte || length_prefixed_fields) with NordicShield_ personalization" |
| 61 | + } |
| 62 | + } |
| 63 | + ], |
| 64 | + "verification": { |
| 65 | + "sdk": "zap1-verify", |
| 66 | + "crate_url": "https://crates.io/crates/zap1-verify", |
| 67 | + "memo_decoder": "https://crates.io/crates/zcash-memo-decode", |
| 68 | + "procedure": [ |
| 69 | + "for each proof entry, verify the Merkle proof from leaf_hash to root", |
| 70 | + "use BLAKE2b-256 with NordicShield_MRK personalization for tree nodes", |
| 71 | + "confirm the root matches the anchor_txid on Zcash mainnet", |
| 72 | + "confirm the anchor_txid is mined at anchor_height", |
| 73 | + "optionally use zap1_schema --emit-witness to verify preimage fields" |
| 74 | + ] |
| 75 | + } |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +## Profiles |
| 80 | + |
| 81 | +`zap1_export --profile <name>` selects event types to include: |
| 82 | + |
| 83 | +| Profile | Events included | |
| 84 | +|---|---| |
| 85 | +| auditor | PROGRAM_ENTRY, OWNERSHIP_ATTEST, HOSTING_PAYMENT, SHIELD_RENEWAL, CONTRACT_ANCHOR, EXIT | |
| 86 | +| counterparty | PROGRAM_ENTRY, OWNERSHIP_ATTEST, DEPLOYMENT | |
| 87 | +| member | PROGRAM_ENTRY, OWNERSHIP_ATTEST, HOSTING_PAYMENT, SHIELD_RENEWAL | |
| 88 | +| regulator | All lifecycle events | |
| 89 | + |
| 90 | +## Verification tools |
| 91 | + |
| 92 | +| Tool | Input | Command | |
| 93 | +|---|---|---| |
| 94 | +| zap1_audit | single proof bundle | `zap1_audit --bundle proof.json` | |
| 95 | +| zap1_audit | export package | `zap1_audit --export package.json` | |
| 96 | +| zap1_audit | proof URL | `zap1_audit --bundle-url https://...` | |
| 97 | +| zap1_schema | witness validation | `zap1_schema --witness events.json --emit-witness` | |
| 98 | +| evaluate.sh | full stack check | `bash scripts/evaluate.sh` | |
| 99 | + |
| 100 | +## Compatibility |
| 101 | + |
| 102 | +v1 proof bundles (missing `version` field) are accepted by all tools. The version field distinguishes formats when both are in circulation. |
0 commit comments