Zcash Verifier
Local Proving
Client-side witness construction and SP1 proof requests
Overview
The browser experience uses the zfun_wasm package (compiled from crates/wasm) to deserialize a Zcash light-wallet database entirely in memory. Rusqlite runs against a temporary, read-only copy of the file; no wallet bytes leave the device. Once the witness is built, the module mirrors the native CLI and runs verify_holdings locally before uploading the serialized SP1 stdin to the prover service.
All network calls are plain HTTPS requests to the prover server (/queue, /hashes, /artifact/{is_tee},/proof). The server never sees decrypted notes or UFVKs, only the domain-separated alternate nullifiers and transparent commitment hashes that are already public in the resulting proof.
Browser Execution Flow
- 1.
Initialize WASM
init()configures logging and prepares sqlite virtual tables.get_snapshot_metadata()exposes the baked-inSNAPSHOT, letting the UI show the exact height and Merkle roots before any wallet file is touched. - 2.
Deserialize Wallet Bytes
load_processed_input(dbBytes)copies the uploaded SQLite file into an in-memory connection, invokescreate_witness, runsverify_holdings, and returns aProofInputwith (a) the serializedSP1Stdin, (b) the rawHoldingsWitness, and (c) the already-verifiedProcessedHoldingssummary. - 3.
Run Local Safety Checks
Before any upload occurs, the frontend queries
/queueto ensure the prover capacity is available and/hashesto make sure none of the alternate nullifiers or transparent commitments were already claimed. - 4.
Upload Serialized Witness
Request a presigned URL via
/artifact/{is_tee}(validated to share the sametee_base_url). Then the browserPUTs the serializedSP1Stdinbuffer andPOSTs/proofwith the artifact URI plus the user's Solana address for attribution. - 5.
Poll Proof Status
Once the SP1 Reserved network fulfills the proof, the server downloads it, verifies it locally, records the public
ProcessedHoldingsbytes, and exposes them via/proof/:idfor the frontend to retrieve.
Proof Service Endpoints
| Endpoint | Description |
|---|---|
GET /queue | Check SP1 backlog |
POST /hashes | Dedupe alt nullifiers |
POST /artifact/{is_tee} | Obtain presigned upload URL |
POST /proof | Enqueue SP1 request |
GET /proof/:id | Poll fulfillment |
Witness Helpers
| Method | Description |
|---|---|
ProofInput.snapshot() | Inspect selected accounts & notes |
ProofInput.processed() | Already-verified totals and hash lists |
ProofInput.stdin | (internal) Serialized stream fed to SP1 |
Usage Snippets
Need an offline sanity check? Run the same flow with the CLI instead of the browser: