Zero-runtime-dependency ZAP1 Merkle proof verification for JavaScript and
TypeScript. The cryptographic primitive is auditable JavaScript with no native
or WASM loader.
The verifier supports current ZAP1_COUNT_BOUND_V2 proof bundles and an
explicitly gated historical legacy profile.
This package verifies Merkle-bundle consistency against a supplied root. It does not prove that an encrypted Zcash memo contains that root, and it does not prove the truth of the event represented by a leaf. A transaction ID is a recorded reference until transaction existence and memo binding are checked by separate evidence.
npm install @frontiercompute/zap1import { verifyProof, parseBundle } from "@frontiercompute/zap1";
const leafHash = "your_64_character_leaf_hash";
const res = await fetch(
`https://api.frontiercompute.cash/verify/${leafHash}/proof.json`
);
const raw = await res.json();
const bundle = parseBundle(raw);
const valid = await verifyProof(bundle);
console.log(valid ? "BUNDLE CONSISTENT" : "BUNDLE INVALID");import { computeLeafHash } from "@frontiercompute/zap1";
const hash = await computeLeafHash("PROGRAM_ENTRY", {
walletHash: "e2e_wallet_20260327",
});
// "075b00df286038a7b3f6bb70054df61343e3481fba579591354a00214e9e019b"import { nodeHash } from "@frontiercompute/zap1";
const parent = await nodeHash(leftHex, rightHex);
// BLAKE2b-256 with "NordicShield_MRK" personalization| Function | Description |
|---|---|
init() |
Compatibility no-op; retained for 0.1.x callers |
computeLeafHash(type, payload) |
Compute leaf hash for PROGRAM_ENTRY or OWNERSHIP_ATTEST |
verifyProof(bundle, options) |
Verify V2; historical legacy requires allowHistoricalLegacy: true |
nodeHash(left, right) |
Compute a Merkle node hash |
commitRoot(rawRoot, leafCount) |
Bind a raw root to its positive leaf count |
parseBundle(json) |
Parse and normalize an API proof bundle |
EVENT_TYPES |
The 18 defined protocol event types |
LEAF_HASH_TYPES |
The 2 event types with client-side typed hash formulas |
Proof-path verification is event-type agnostic. Typed leaf reconstruction is
currently available only for PROGRAM_ENTRY and OWNERSHIP_ATTEST.
ZAP1_COUNT_BOUND_V2: default and required for current bundles. The committed root bindsleaf_count.ZAP1_LEGACY_DUPLICATE_ODD: accepted only when the caller sets{ allowHistoricalLegacy: true }, the bundle labels itself legacy, and the recorded anchor height is at or below the frozen historical cutoff. A positiveleaf_countand an exact duplicate-odd proof shape are mandatory.
Missing counts, unknown schemes, malformed hashes, invalid proof positions,
and out-of-window legacy bundles fail closed.
When present, envelope metadata must use protocol: "ZAP1" and
version: "2" for either root scheme; the legacy label describes the root
construction, not an envelope-version downgrade.
| Context | Value (16 bytes) |
|---|---|
| Leaf hash | NordicShield_\x00\x00\x00 |
| Node hash | NordicShield_MRK |
| Root commitment | NordicShield_RTK |
See ONCHAIN_PROTOCOL.md for the deployed protocol description. The document distinguishes bundle verification, transaction existence, encrypted-memo binding, and event truth.
| Package | What it does |
|---|---|
| @frontiercompute/zcash-ika | Zcash + Bitcoin signing via Ika 2PC-MPC |
| @frontiercompute/zcash-mcp | MCP server for Zcash |
| @frontiercompute/openclaw-zap1 | OpenClaw skill for ZAP1 attestation |
| @frontiercompute/silo-zap1 | Silo agent attestation via ZAP1 |
MIT