Repository navigation
Closed
Labels
Small2-5 days
Milestone
Description
Context
The Withdraw circuit proves that an owner has sufficient confidential balance to withdraw a public amount a, computes the new spendable commitment with deterministic randomness, emits an encrypted balance scalar for owner recovery, and produces a sender-auditor ECDH ciphertext for the new balance checkpoint. See internal design doc §7.5.
Scope
Implement circuits/withdraw/ covering the constraints in design doc §7.5:
- W1–W8: owner key ownership, wrapper binding via
vk, opening knowledge, range validityv, a, v − a ∈ [0, 2^127), deterministic new-balance randomness, new commitment construction, encrypted balance scalar, nonzero ephemeral scalar (r_e ≠ 0). - W_a1–W_a4: ephemeral key for auditor ECDH, sender-auditor shared secret, sender-auditor channel sponge (single squeeze), encrypted balance checkpoint under the sender-auditor key.
Public inputs (15 fields): C_spend, C_spend', Y, wrap, K_aud_s, a, σ, b̃, R_e, b̃_aud_s.
Private witnesses: sk, vk, v, r, r_e.
Tests:
- Happy path with various
avalues. - Negative:
v < a(should fail W4), wrongvkderivation, mutatedb̃,r_e = 0(should fail W8).
Proposed Approach
- Wire in the primitives library (Noir primitives library for confidential token wrapper circuits #699) for Pedersen commit, Poseidon2-with-domain, range check, encrypted-balance helper, ECDH, key derivation.
- Write the circuit body following §7.5 constraint-by-constraint; each circuit line links to its constraint ID in a doc-comment.
- Generate fixture witness, prove, verify.
- Negative tests for each soundness-critical constraint (range, key derivation, encrypted balance consistency, nonzero
r_e).
Known References
- Internal design doc — §5.5 (encrypted balance scalar), §7.5 (Withdraw), §8 (Auditing). Link available in the tracking workspace.
Acceptance Criteria
- Implementation matches parent epic's frozen public-input ordering
- Constraints W1–W8 and W_a1–W_a4 covered by unit tests
- Negative tests reject under-funded withdrawals and tampered ciphertexts
- VK extracted and published per parent's VK pipeline
- PR links back to this issue
Metadata
Metadata
Assignees
Labels
Small2-5 days
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(confidential): Noir withdraw circuit (#727)
feat(confidential): Noir transfer circuit (#728)
feat(confidential): Noir set_operator circuit (#730)
feat(confidential): Noir operator_transfer circuit (#731)
feat(confidential): Noir revoke_operator circuit (#732)