ZAP1 SDK

Verify Zcash attestations in 5 lines of code

Install

npm
npm install @frontiercompute/zap1
Rust
cargo add zap1-verify

Verify a proof (JavaScript)

import { verify_proof } from '@frontiercompute/zap1'; const proof = await fetch('https://pay.frontiercompute.io/verify/LEAF_HASH/proof.json') .then(r => r.json()); const result = verify_proof(proof); console.log(result.valid); // true if Merkle path checks out

Verify a proof (Rust)

use zap1_verify::verify_proof_bundle; let proof: ProofBundle = serde_json::from_str(&json)?; let result = verify_proof_bundle(&proof); assert!(result.valid);

Decode a memo

use zcash_memo_decode::decode_memo; let memo_bytes = hex::decode("5a41503...")?; match decode_memo(&memo_bytes) { MemoFormat::Zap1 { event_type, payload } => { /* structured */ } MemoFormat::Zip302Tvlv { parts } => { /* ZIP 302 */ } MemoFormat::PlainText(s) => { /* utf-8 text */ } _ => { /* binary or empty */ } }

API endpoints

GET /protocol/info # protocol metadata GET /stats # anchor + leaf counts GET /anchor/history # all anchored roots with txids GET /anchor/status # current root, unanchored leaves GET /verify/{leaf}/check # verify a leaf (server-side) GET /verify/{leaf}/proof.json # Merkle proof bundle GET /events # recent lifecycle events GET /lifecycle/{wallet} # events for a wallet POST /memo/decode # decode any Zcash memo

Try it live

Fetch protocol info from the live API: