Expand description
§zync-core
Trust-minimized Zcash light client primitives. Remaining trust assumptions: the hardcoded activation block hash, the cryptographic proof systems (ligerito, NOMT, Halo 2), and your key material.
§Trust model
A zync-powered light client verifies every claim the server makes:
-
Header chain. ligerito polynomial commitment proofs over block headers. The prover encodes headers into a trace polynomial and commits to the evaluation; the verifier checks the commitment in O(log n) without seeing any headers. Public outputs (block hashes, state roots, commitments) are transcript-bound but NOT evaluation-proven — the ligerito proximity test does not constrain which values the polynomial contains. Soundness relies on the honest-prover assumption; cross-verification (item 4) detects a malicious prover. Proven roots anchor subsequent steps.
-
State proofs. NOMT sparse merkle proofs for note commitments and nullifiers. Each proof binds to the tree root proven by the header chain. Commitment proofs verify that received notes exist in the global tree. Nullifier proofs verify spent/unspent status without trusting the server.
-
Actions integrity. A running Blake2b commitment chain over per-block orchard action merkle roots. Verified against the header-proven value to detect block action tampering (inserted, removed, or reordered actions).
-
Cross-verification. BFT majority consensus against independent lightwalletd nodes. Tip and activation block hashes are compared with
2/3 agreement required. Prevents single-server eclipse attacks.
-
Trial decryption. Orchard note scanning with cmx recomputation. After decryption, the note commitment is recomputed from the decrypted fields and compared against the server-provided cmx. A malicious server cannot craft ciphertexts that decrypt to fake notes with arbitrary values.
§Modules
verifier: ligerito header chain proof verification (epoch + tip, parallel)nomt: NOMT sparse merkle proof verification (commitments + nullifiers)actions: actions merkle root computation and running commitment chainscanner: orchard note trial decryption (native + WASM parallel)sync: sync verification primitives (proof validation, cross-verify, memo extraction)prover: ligerito proof generation from header chain tracestrace: header chain trace encoding (headers to polynomial)client: gRPC clients for zidecar and lightwalletd (feature-gated)
§Platform support
Default features (client, parallel) build a native library with gRPC
clients and rayon-based parallel scanning. For WASM, disable defaults and
enable wasm or wasm-parallel:
zync-core = { version = "0.4", default-features = false, features = ["wasm-parallel"] }WASM parallel scanning requires SharedArrayBuffer (COOP/COEP headers)
and builds with:
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
cargo build --target wasm32-unknown-unknown§Minimal sync loop
use zync_core::{sync, verifier, Scanner, OrchardFvk};
// 1. fetch header proof from zidecar
let (proof_bytes, _, _) = client.get_header_proof().await?;
// 2. verify and extract proven NOMT roots
let proven = sync::verify_header_proof(&proof_bytes, tip, true)?;
// 3. scan compact blocks for owned notes
let scanner = Scanner::from_fvk(&fvk);
let notes = scanner.scan(&actions);
// 4. verify commitment proofs for received notes
sync::verify_commitment_proofs(&proofs, &cmxs, &proven, &server_root)?;
// 5. verify nullifier proofs for unspent notes
let spent = sync::verify_nullifier_proofs(&nf_proofs, &nullifiers, &proven, &nf_root)?;
// 6. verify actions commitment chain
sync::verify_actions_commitment(&running, &proven.actions_commitment, true)?;Re-exports§
pub use error::Result;pub use error::ZyncError;pub use scanner::BatchScanner;pub use scanner::DecryptedNote;pub use scanner::ScanAction;pub use scanner::Scanner;pub use client::LightwalletdClient;pub use client::ZidecarClient;
Modules§
- actions
- Actions merkle root computation and running commitment chain.
- client
- gRPC clients for Zcash light wallet services
- endpoints
- Public lightwalletd endpoints for cross-verification.
- error
- error types for zync
- nomt
- NOMT proof verification primitives shared between zcli and zidecar.
- prover
- Ligerito proof generation for header chain traces.
- scanner
- WASM-compatible parallel note scanner for Orchard
- sync
- Sync verification primitives for Zcash light clients.
- trace
- Header chain trace encoding for ligerito polynomial commitment proofs.
- verifier
- ligerito proof verification with continuity checking
Structs§
- Incoming
Viewing Key - A key that provides the capability to detect and decrypt incoming notes from the block chain, without being able to spend the notes or detect when they are spent.
- Orchard
Fvk - A key that provides the capability to view incoming and outgoing transactions.
- Spending
Key - A spending key, from which all key material is derived.
Enums§
- Scope
- The scope of a viewing key or address.
Constants§
- ACTIVATION_
HASH_ MAINNET - orchard activation block hash (mainnet, LE internal order)
- DOMAIN_
EPOCH_ PROOF - domain separator for epoch proof hash
- DOMAIN_
IVK_ COMMIT - domain separator for ivk commitment
- DOMAIN_
WALLET_ STATE - domain separator for wallet state commitment
- EMPTY_
SMT_ ROOT - empty sparse merkle tree root
- EPOCH_
PROOF_ TRACE_ LOG_ SIZE - polynomial size exponent for epoch proofs (2^26 config)
- EPOCH_
SIZE - blocks per epoch (~21 hours at 75s/block)
- FIELDS_
PER_ ACTION - fields encoded per action in trace polynomial
- FIELDS_
PER_ HEADER - fields encoded per block header in trace polynomial
- GENESIS_
EPOCH_ HASH - genesis epoch hash (all zeros)
- MAX_
ACTIONS_ PER_ BLOCK - max orchard actions per block
- ORCHARD_
ACTIVATION_ HEIGHT - orchard activation height (mainnet)
- ORCHARD_
ACTIVATION_ HEIGHT_ TESTNET - orchard activation height (testnet)
- SECURITY_
BITS - security parameter (bits)
- TIP_
SENTINEL_ SIZE - sentinel row size appended after all headers in trace
- TIP_
TRACE_ LOG_ SIZE - polynomial size exponent for tip proofs (2^20 config, max ~32K headers)
Functions§
- epoch_
end - helper: get end height of epoch (inclusive)
- epoch_
for_ height - helper: calculate epoch number from block height
- epoch_
proof_ prover_ config - ligerito prover config for epoch proofs (2^26)
- epoch_
start - helper: get start height of epoch
- prover_
config_ for_ size - select the appropriate prover config for a given trace size
- tip_
prover_ config - ligerito prover config for tip proofs (2^20)
- verifier_
config_ for_ log_ size - select the appropriate verifier config for a given log size