Skip to content

Commit 21d4fa0

Browse files
authored
Merge pull request #2 from m-kus/main
Review fixups
2 parents 1c6e9a8 + aa5c3b5 commit 21d4fa0

File tree

1 file changed

+46
-23
lines changed

1 file changed

+46
-23
lines changed

zips/draft-stark-verify-nu.md

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ZIP: XXX
22
Title: Circle STARK Verification as a Transparent Zcash Extension
3-
Owners: Abdel <abdel.dev.bitcoin@proton.me>, Michael Zaikin <michael.z@starkware.co>
3+
Owners: Abdel <abdel.dev.bitcoin@proton.me>
4+
Michael Zaikin <michael.z@starkware.co>
45
Status: Draft
56
Category: Consensus
67
Created: 2025-10-14
@@ -13,23 +14,23 @@ The key words "MUST", "SHOULD", and "MAY" are to be interpreted as described in
1314

1415
## Abstract
1516

16-
This ZIP defines a new Transparent Zcash Extension that verifies a bounded‑size Circle STARK proof (Stwo). The extension has a single `type` and a single mode, and exposes a compact precondition/witness interface suitable for verifying L2 validity proofs on Zcash L1. It specifies:
17+
This ZIP defines a new Transparent Zcash Extension that verifies a bounded‑size Circle STARK [^circle-stark-paper] 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 [^sn-stack] on Zcash. It specifies:
1718

1819
- a prefix‑free encoding of precondition and witness;
1920
- pinned verifier parameter set via a `param_id` namespace;
2021
- strict consensus bounds on sizes and verifier parameters for DoS safety; and
2122
- digest integration consistent with a future transaction version that supports TZEs [^zip-0245].
2223

23-
This ZIP does not change Sapling/Orchard; it only adds a TZE that can be used to enforce L2 state transitions or other validity claims.
24+
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.
2425

2526
## Motivation
2627

27-
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), a ZK friendly virtual machine, and an effective proving system (Circle STARK/Stwo) that compresses large computation into a succinct proof, suitable for onchain verification. A custom transparent extension [^zip-0222] is the cleanest way to introduce such verifier and enable layer-2 solutions on top of Zcash.
28+
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 [^cairo-paper]), a ZK friendly virtual machine, and an effective proving system (Stwo [^stwo]) that compresses large computation into a succinct proof, suitable for onchain verification. A custom transparent extension [^zip-0222] is the cleanest way to introduce such verifier and enable scaling solutions on top of Zcash.
2829

2930
## Requirements
3031

3132
* Define a TZE `type` for 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.
32-
* Define a `param_id` namespace that pins the specification of the Stwo proof relation, the proof object wire format, field encodings, transcript/Merkle hash suite and personalization, FRI expansion and query caps, any grinding bounds, and any batch‑verification settings.
33+
* Define a `param_id` namespace 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.
3334
* A reference implementation of the prover and verifier, and reference test vectors (valid and invalid) must be provided for each such `param_id`.
3435
* Limits on proof sizes, etc. must be chosen to avoid potential denial of service, and the necessary updates to ZIP 317 fee calculation [^zip-0317] must be specified.
3536

@@ -53,7 +54,7 @@ if (flags & 0x01) {
5354
}
5455
```
5556

56-
- `param_id` selects an enumerated, pinned Stwo parameter set (field & hash suite, FRI/query caps, wire format version, endianness, personalization, etc.). Unknown `param_id` MUST be rejected.
57+
- `param_id` selects an enumerated, pinned Stwo parameter set. Unknown `param_id` MUST be rejected.
5758
- `pub_in` is an opaque byte string to consensus; it MUST be absorbed by the verifier transcript exactly as specified (byte‑for‑byte).
5859
- If `bind_ctx` is set, `ctx_digest` MUST equal the transaction's non‑malleable digest [^zip-0244]. A mismatch MUST cause rejection.
5960

@@ -63,7 +64,7 @@ if (flags & 0x01) {
6364
vec proof // the Stwo (Circle STARK) proof object (len + bytes)
6465
```
6566

66-
The `proof` MUST conform to the Stwo wire format pinned by `param_id`.
67+
The `proof` MUST conform to the Stwo proof object format pinned by `param_id`.
6768

6869
### Verification
6970

@@ -82,14 +83,18 @@ The namespace is 16‑bit (0x0001..0xFFFF). This ZIP introduces:
8283

8384
- `param_id = 0x0001``STWO_V1_P1`
8485

85-
- Upstream: `starkware-libs/stwo` at tag TBD, commit `TBD`.
86-
- Wire format: Stwo proof object at v1.0.0 (exact byte layout pinned in this ZIP's test‑vector directory).
87-
- Arithmetic & domains: per Stwo v1.0.0 (Circle STARK over the 31‑bit Mersenne field; exact domain and padding rules pinned by the vector files).
88-
- Hash suite: as used by the v1.0.0 verifier for transcript/Merkle commitments (parameters and personalization strings pinned by vector files).
89-
- FRI/query caps: exact maximums pinned by vector files.
90-
- Grinding/nonce: if present in the format, upper bounds are pinned by vector files.
86+
- Upstream: `starkware-libs/stwo` [^stwo-repo] at tag TBD, commit `TBD`.
87+
- Proving system: Stwo [^stwo] based on Circle STARK over the 31‑bit Mersenne field [^circle-stark-paper]
88+
- Proof format:
89+
- Stwo proof structure layout (TBD)
90+
- Binary codec and compression algorithm (TBD)
91+
- Prover parameters:
92+
- Stwo channel hash function (TBD)
93+
- Stwo preprocessed AIR configuration (TBD)
94+
- PoW difficulty target (TBD)
95+
- FRI configuration (TBD)
9196

92-
> Normative reference material for `STWO_V1_P1` (field encodings, wire format, hash personalization, FRI expansions, max queries) is included alongside this ZIP in `zip-XXXX/params/STWO_V1_P1.json` and the accompanying test vectors. Implementations MUST treat those files as normative parts of this ZIP.
97+
> Normative reference material for `STWO_V1_P1` (encodings, proof format, prover parameters) is included alongside this ZIP in `zip-XXXX/params/STWO_V1_P1.json` and the accompanying test vectors. These files are to be treated as normative parts of this specification.
9398
9499
Future parameter sets (e.g., different hash suite or query caps) **MAY** be proposed under new `param_id`s in a subsequent ZIP.
95100

@@ -100,11 +105,15 @@ Let the following consensus constants be defined for this `(type, mode)`:
100105
- `PUBIN_MAX_BYTES = TBD` (discussion range: ≤ 4096).
101106
- `PROOF_MAX_BYTES = TBD` (discussion range: 64–192 KiB; finalize from measurements on realistic proof instances).
102107

103-
Nodes MUST reject if any bound is exceeded. Bounds MUST be enforced before allocation to prevent DoS.
108+
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.
104109

105110
### Fee model
106111

107-
Fees follow standard byte‑based rules. This ZIP does not introduce an additional "op‑count" or sigop‑like budget. Implementations SHOULD enforce conservative policy limits initially (e.g., at most one `STARK_VERIFY` TZE input per transaction; local size caps stricter than consensus).
112+
Follows ZIP-317 [^zip-0317].
113+
114+
TODO: introduce an adapted fee model with discounted price per byte (rationale: large proof size does not reflect the cost of the verification)
115+
116+
TODO: introduce a rate limiting policy that prevents crowding out non-TZE transactions
108117

109118
## Rationale
110119

@@ -114,7 +123,7 @@ Fees follow standard byte‑based rules. This ZIP does not introduce an addition
114123

115124
## Privacy Implications
116125

117-
No changes to Sapling/Orchard. Protocols built on top (e.g., an L2) 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.
126+
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.
118127

119128
## Backward Compatibility
120129

@@ -142,9 +151,23 @@ Nodes that do not implement this TZE will reject transactions that use it after
142151
143152
## References
144153

145-
- [ZIP‑222: Transparent Zcash Extensions (TZE)](https://zips.z.cash/zip-0222)
146-
- [ZIP-244: Transaction Identifier Non-Malleability](https://zips.z.cash/zip-0244)
147-
- [ZIP-245: Transaction Identifier Digests & Signature Validation for Transparent Zcash Extensions](https://zips.z.cash/zip-0245)
148-
- [STARK paper](https://eprint.iacr.org/2018/046)
149-
- [Circle STARKs paper](https://eprint.iacr.org/2024/278)
150-
- [Stwo prover/verifier](https://github.com/starkware-libs/stwo)
154+
[^BCP14]: [Information on BCP 14 — "RFC 2119: Key words for use in RFCs to Indicate Requirement Levels" and "RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"](https://www.rfc-editor.org/info/bcp14)
155+
156+
[^zip-0222]: [ZIP‑222: Transparent Zcash Extensions (TZE)](https://zips.z.cash/zip-0222)
157+
158+
159+
[^zip-0244]: [ZIP-244: Transaction Identifier Non-Malleability](https://zips.z.cash/zip-0244)
160+
161+
[^zip-0245]: [ZIP-245: Transaction Identifier Digests & Signature Validation for Transparent Zcash Extensions](https://zips.z.cash/zip-0245)
162+
163+
[^zip-0317]: [ZIP-317: Proportional Transfer Fee Mechanism](https://zips.z.cash/zip-0317)
164+
165+
[^circle-stark-paper]: [Circle STARKs paper](https://eprint.iacr.org/2024/278)
166+
167+
[^sn-stack]: [Starknet stack](https://www.starknet.io/sn-stack/)
168+
169+
[^cairo-paper]: [Cairo – a Turing-complete STARK-friendly CPU architecture](https://eprint.iacr.org/2021/1063.pdf)
170+
171+
[^stwo]: [Stwo proving system](https://starkware.co/blog/s-two-prover/)
172+
173+
[^stwo-repo]: [Stwo prover and verifier implementation](https://github.com/starkware-libs/stwo)

0 commit comments

Comments
 (0)