Terminology
The key words "MUST", "SHOULD", and "MAY" are to be interpreted as described in BCP 14 1 when, and only when, they appear in all capitals.
Abstract
This ZIP defines a new Transparent Zcash Extension that verifies a bounded‑size Circle STARK 2 proof. The extension has a single type and a single mode, and exposes a compact precondition/witness interface suitable for verifying validity proofs of a Starknet-style scaling solution 3 on Zcash. It specifies:
- a prefix‑free encoding of precondition and witness;
- pinned verifier parameter set via a
param_idnamespace; - strict consensus bounds on sizes and verifier parameters for DoS safety; and
- digest integration consistent with a future transaction version that supports TZEs 4.
This ZIP does not change Sapling/Orchard; it only adds a TZE that can be used to enforce state transition of a Starknet chain or other validity claims.
Motivation
Zcash's programmability is restricted by the Bitcoin script, which lacks sufficient expressiveness and implies high costs that limit throughput. A Starknet‑style scaling solution can address the issue by providing an expressive programming language (Cairo 5), a ZK friendly virtual machine, and an effective proving system (Stwo 6) that compresses large computation into a succinct proof, suitable for onchain verification. A custom transparent extension 7 is the cleanest way to introduce such verifier and enable scaling solutions on top of Zcash.
Requirements
- Define a TZE
typefor Stwo/Circle STARK verification, and fully specify how this type is to be encoded, verified, and integrated into transaction digest computation, without allowing implementation‑defined behavior. - Define a
param_idnamespace that pins the specification of the Stwo proof relation, the proof object format, field encodings, transcript/Merkle hash suite and personalization, FRI expansion and query caps, any grinding bounds, and any batch‑verification settings. - A reference implementation of the prover and verifier, and reference test vectors (valid and invalid) must be provided for each such
param_id. - Limits on proof sizes, etc. must be chosen to avoid potential denial of service, and the necessary updates to ZIP 317 fee calculation 8 must be specified.
Specification
TZE identification
tze_id: TBD (assigned by ZIP Editors).tze_mode: 0 (only one mode is defined by this ZIP). Any other value MUST be rejected.
All serialization below is inside the tze_data_payload defined by 7; lengths are compactSize.
Precondition (prefix‑free)
u16 param_id // selects a pinned Stwo verifier parameter set (see below)
u8 flags // bit 0 = bind_ctx; all other bits MUST be 0
vec pub_in // public inputs to the proved statement (len + bytes)
if (flags & 0x01) {
bytes32 ctx_digest // non-malleable transaction digest
}
param_idselects an enumerated, pinned Stwo parameter set. Unknownparam_idMUST be rejected.pub_inis an opaque byte string to consensus; it MUST be absorbed by the verifier transcript exactly as specified (byte‑for‑byte).- If
bind_ctxis set,ctx_digestMUST equal the transaction's non‑malleable digest 9. A mismatch MUST cause rejection.
Witness (prefix‑free)
vec proof // the Stwo (Circle STARK) proof object (len + bytes)
The proof MUST conform to the Stwo proof object format pinned by param_id.
Verification
bool tze_verify(0, precondition, witness, context):
- Parse
param_id; load the exact pinned parameter set. Reject if unknown. - Parse
flags; if any reserved bits set, reject. - If
bind_ctx, compute the requiredctx_digestfromcontextand compare; on mismatch, reject. ([Zcash Zips][3]) - Parse
pub_inandproof. Enforce all consensus bounds (see Bounds). - Initialize the Stwo transcript/channel, absorb
pub_inexactly, and verifyproofusing the parameters pinned byparam_id. - Return
trueiff the verifier accepts; otherwise returnfalse.
Parameter sets (param_id)
The namespace is 16‑bit (0x0001..0xFFFF). This ZIP introduces:
-
param_id = 0x0001—STWO_V1_P1- Upstream:
starkware-libs/stwo10 at tag TBD, commitTBD. - Proving system: Stwo 6 based on Circle STARK over the 31‑bit Mersenne field 2
- Proof format:
- Stwo proof structure layout (TBD)
- Binary codec and compression algorithm (TBD)
- Prover parameters:
- Stwo channel hash function (TBD)
- Stwo preprocessed AIR configuration (TBD)
- PoW difficulty target (TBD)
- FRI configuration (TBD)
- Upstream:
Normative reference material for
STWO_V1_P1(encodings, proof format, prover parameters) is included alongside this ZIP inzip-XXXX/params/STWO_V1_P1.jsonand the accompanying test vectors. These files are to be treated as normative parts of this specification.
Future parameter sets (e.g., different hash suite or query caps) MAY be proposed under new param_ids in a subsequent ZIP.
Bounds (consensus)
Let the following consensus constants be defined for this (type, mode):
PUBIN_MAX_BYTES = TBD(discussion range: ≤ 4096).PROOF_MAX_BYTES = TBD(discussion range: 64–192 KiB; finalize from measurements on realistic proof instances).
Nodes MUST reject if any bound is exceeded, and MUST NOT allow denial of service via memory exhaustion due to allocating memory before bounds are checked.
Fee model
Follows ZIP-317 8.
TODO: introduce an adapted fee model with discounted price per byte (rationale: large proof size does not reflect the cost of the verification)
TODO: introduce a rate limiting policy that prevents crowding out non-TZE transactions
Rationale
- TZE over opcodes: Zcash's extensibility surface for new consensus checks is TZE 7. It avoids entangling with shielded circuit changes and keeps the change set minimal and auditable.
- Single system first: Limiting to Stwo keeps the ZIP focused and uses a Rust verifier that integrates cleanly with Zebra and (via FFI) with zcashd. We can consider additional systems (or new Stwo parameter sets) later via new
param_ids or a newtype. - Optional context binding: Allowing
bind_ctxcovers common safe usage (proof binds to the transaction's non‑malleable digest) while still permitting protocols that bind to application‑level commitments insidepub_in.
Privacy Implications
No changes to Sapling/Orchard. Protocols built on top MUST document their own privacy model (e.g., DA choices, metadata leakage). This ZIP's verifier only checks validity of a statement over public inputs; it does not guarantee zero‑knowledge unless the prover uses a ZK proof generation mode.
Backward Compatibility
Nodes that do not implement this TZE will reject transactions that use it after activation. Because TZE uses a distinct TZE unspent set and separate fields (tze_inputs/tze_outputs), existing transparent and shielded logic is unaffected.
Deployment
- Network upgrade: Activate in a future NU alongside 9 and 4.
- Activation gating: Require published test vectors and an external review of the Stwo binding.
Security Considerations
- DoS safety: Strict size caps; streaming, fail‑fast parsing; bounded allocations; early rejection on malformed encodings.
- Determinism & non‑malleability: Encodings are prefix‑free; any malleation of
preconditionMUST cause rejection;tze_verifyis deterministic per 7. - Hash assumptions: Security reduces primarily to collision/preimage resistance of the pinned hash suite plus IOP soundness. No EC‑based hash is assumed; the specifics are pinned by
param_id. - Implementation risk: Treat the Rust verifier as consensus‑critical code; pin commit/tag and compiler settings; include cross‑checks against test vectors.
Reference Implementation
TBD
Test Vectors
TBD