You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: zips/draft-stark-verify-nu.md
+46-23Lines changed: 46 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
ZIP: XXX
2
2
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>
4
5
Status: Draft
5
6
Category: Consensus
6
7
Created: 2025-10-14
@@ -13,23 +14,23 @@ The key words "MUST", "SHOULD", and "MAY" are to be interpreted as described in
13
14
14
15
## Abstract
15
16
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:
17
18
18
19
- a prefix‑free encoding of precondition and witness;
19
20
- pinned verifier parameter set via a `param_id` namespace;
20
21
- strict consensus bounds on sizes and verifier parameters for DoS safety; and
21
22
- digest integration consistent with a future transaction version that supports TZEs [^zip-0245].
22
23
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.
24
25
25
26
## Motivation
26
27
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.
28
29
29
30
## Requirements
30
31
31
32
* 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.
33
34
* A reference implementation of the prover and verifier, and reference test vectors (valid and invalid) must be provided for each such `param_id`.
34
35
* 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.
35
36
@@ -53,7 +54,7 @@ if (flags & 0x01) {
53
54
}
54
55
```
55
56
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.
57
58
-`pub_in` is an opaque byte string to consensus; it MUST be absorbed by the verifier transcript exactly as specified (byte‑for‑byte).
58
59
- If `bind_ctx` is set, `ctx_digest` MUST equal the transaction's non‑malleable digest [^zip-0244]. A mismatch MUST cause rejection.
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`.
67
68
68
69
### Verification
69
70
@@ -82,14 +83,18 @@ The namespace is 16‑bit (0x0001..0xFFFF). This ZIP introduces:
82
83
83
84
-`param_id = 0x0001` — `STWO_V1_P1`
84
85
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)
91
96
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.
93
98
94
99
Future parameter sets (e.g., different hash suite or query caps) **MAY** be proposed under new `param_id`s in a subsequent ZIP.
95
100
@@ -100,11 +105,15 @@ Let the following consensus constants be defined for this `(type, mode)`:
-`PROOF_MAX_BYTES = TBD` (discussion range: 64–192 KiB; finalize from measurements on realistic proof instances).
102
107
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.
104
109
105
110
### Fee model
106
111
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
108
117
109
118
## Rationale
110
119
@@ -114,7 +123,7 @@ Fees follow standard byte‑based rules. This ZIP does not introduce an addition
114
123
115
124
## Privacy Implications
116
125
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.
118
127
119
128
## Backward Compatibility
120
129
@@ -142,9 +151,23 @@ Nodes that do not implement this TZE will reject transactions that use it after
[^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)
0 commit comments