Skip to content

Starknet privacy docs#1747

Merged
ob1337 merged 6 commits into
mainfrom
starknet-privacy-docs
Apr 27, 2026
Merged

Starknet privacy docs#1747
ob1337 merged 6 commits into
mainfrom
starknet-privacy-docs

Conversation

@maya-starkware

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread build/starknet-privacy/overview.mdx Outdated
Comment thread build/starknet-privacy/installation.mdx Outdated

Use the **Scarb / Cairo versions required by the repo** (see `Scarb.toml` and the README)—if the project pins an older or newer Scarb, switch with `asdf` per the [appendix](/build/quickstart/appendix) or the README.

## 3. Rust (client prover)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't say how to install a client prover, its merely rust. There is not even reference to which repo the prover sits at. Addition required.

Comment thread build/starknet-privacy/installation.mdx Outdated
cargo build --release
```

## 4. Build Cairo packages

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sections 4-6 are redundant. For 4 and 5 - I'm not following which packages requires building/testing and why. Seems like this refers to general abilities of scrab and snforge. Better to send the reader to these tools (if needed) and explain where in the flow they would come at (Are they relevant for proofs generation?)

Section 6 is just "if you want to also have another tool" - why its here?

Comment thread build/starknet-privacy/quickstart.mdx Outdated

## Prerequisites

Complete [Install and build](/build/starknet-privacy/installation) (Scarb, Foundry, Devnet, and Rust if the prover is in-repo).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installation doesn't explicitly say how to install devnet, though (i believe starkup indeed installs it but worth to mention this tool there so the reader won't be confused)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also - Starknet devnet is not a node. Its a local simulation tool. You want them to install devnet or to install a node? Very different things

Comment thread build/starknet-privacy/quickstart.mdx Outdated
2. Builds client-side actions and generates a **ZK proof**.
3. Submits the transaction (directly or via paymaster flow).

Follow the README’s **first transaction** or **e2e** example.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which readme??


## Action ordering

Fixed order reduces attack surface:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which attack? On what?


## Per-token balance

Within one transaction, a **temporary balance** per token tracks: deposits and spent notes **increase** it; new notes and withdrawals **decrease** it. It must never go negative and must end at **zero** so all tokens are accounted for.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYM by must end with 0?

Comment thread build/starknet-privacy/proving.mdx Outdated
icon: microchip
---

Proofs are generated by **executing Cairo in a simulated Starknet environment** tied to a recent block, then proving that execution with **Stwo**—the same prover family used for Starknet block proving.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add details on the differences between the simulated Starknet environment and a real Starknet block, builtins we support/don't support etc.

Comment thread build/starknet-privacy/proving.mdx

## Open notes

An **open note** reserves **salt = 1**, stores **amount 0** initially, and keeps **token** and **depositor address** in dedicated storage. The user’s proof **creates** the empty open note; a **trusted helper contract** (invoked in the same transaction) performs the swap and calls the pool to **fill** the open note **without** a new ZK proof for that fill.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any link to an example of such a contract? I think it will help understand the flow

@maya-starkware

Copy link
Copy Markdown
Collaborator Author

Addressed all review comments for #1747 in latest push.

What was updated

overview.mdx: replaced large comparison table with link to privacygrid.dev, tightened “why Starknet privacy” framing.
installation.mdx: removed redundant generic sections; added concrete file checklist (README.md, Scarb.toml, snfoundry.toml, rust-toolchain.toml, Cargo.toml, workflows).
quickstart.mdx: clarified Devnet is a simulation tool (not full node), added explicit --url usage to avoid sncast network ambiguity, tightened reproducible flow.
architecture.mdx: clarified pool vs verifier roles.
discovery.mdx: explicitly documented directional channels (sender -> recipient) and why.
transaction-flow.mdx: clarified ordering rationale and “temporary balance must end at 0”.
proving.mdx: added practical “how to generate proof” direction and “simulated vs real execution” distinctions.
anonymous-defi.mdx: added section for helper-contract/example references.
Please re-check and I can apply any remaining wording tweaks quickly.

Comment thread build/starknet-privacy/overview.mdx Outdated
This section sets expectations so readers are not asked to follow steps that assume unpublished code.

- **In scope here:** the **protocol** as specified in the research paper—notes, channels, discovery, compliance, transaction ordering, security considerations—so curious readers, partners, and enterprises can understand how Starknet Privacy works **before** touching an implementation.
- **Not in this first wave of docs:** install scripts, devnet quickstarts, repository layout, SDK usage, or proving-service operations. Those belong with the **reference implementation** when it is **open sourced**, which is planned for a **later phase** of the Starknet Privacy rollout (not expected before mainnet).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph is horrible. Why go into the specifics on things that are not in scope? And how a sentence like "not expected before mainnet" is understandable to a potential reader 2 months from now?

Comment thread build/starknet-privacy/overview.mdx Outdated

- **In scope here:** the **protocol** as specified in the research paper—notes, channels, discovery, compliance, transaction ordering, security considerations—so curious readers, partners, and enterprises can understand how Starknet Privacy works **before** touching an implementation.
- **Not in this first wave of docs:** install scripts, devnet quickstarts, repository layout, SDK usage, or proving-service operations. Those belong with the **reference implementation** when it is **open sourced**, which is planned for a **later phase** of the Starknet Privacy rollout (not expected before mainnet).
- **Proving in practice:** generating proofs is **required** for normal private transfers; this site explains *why* and *how it fits the protocol*. Exact commands, crates, and integration paths will ship alongside the public repo and SDK.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"public repo" - which repo? (I know, but the reader won't). - The starknet privacy repo is published and referenced from multiple places, so this is very confusing. Also, again, too many details

Comment thread build/starknet-privacy/architecture.mdx Outdated

## Pool and verifier

In many deployments, the privacy pool entrypoint and proof verification logic are composed as separate contracts/modules (for upgradeability and audit boundaries), even when docs describe them as one protocol surface. So conceptually: **the pool enforces state transitions, and proof verification gates those transitions**.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess things are different in our deployment? Why not mention it explicitly if so?

Comment thread build/starknet-privacy/architecture.mdx Outdated

## Client-side proving

Users build client actions and generate a proof in a virtual Starknet execution environment anchored to a recent block.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first phase its mostly distinguished operators that do it on behalf of the users, this sounds like generate proof is openly available

Comment thread build/starknet-privacy/proving.mdx Outdated
The virtual environment is chain-anchored but not a full sequencer runtime. In practice:

- storage and contract calls are evaluated against an anchored state snapshot,
- only the syscalls and builtins implemented by the project runtime are available,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYM by "project runtime"?


## Example reference shape: Vesu lending helper

[Vesu](https://vesu.xyz) is a permissionless lending protocol on Starknet built around **tokenized vaults** (ERC-4626 / SNIP-22 style): depositing **underlying** mints **share** tokens (vTokens); withdrawing **burns** shares and returns underlying. A **Vesu lending helper** illustrates the same **open-note + Invoke** pattern as a swap helper, but the external calls are **`deposit`** / **`withdraw`** on the vToken contract instead of a swap.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This... isn't related to privacy at all, is it?

If we can't share a reference contract, better to just omit it and that's it


After executing the lending call, the helper compares **output token balance before and after** to obtain **`out_amount`**, asserts it is non-zero, **approves the privacy pool** (the **caller**) to transfer that amount, and returns a span of **`OpenNoteDeposit { note_id, token: out_token, amount: out_amount }`** so the pool can **fill** the previously created open note.

Typical **preconditions** (enforced with explicit errors) include: non-zero tokens and amount; `in_token != out_token`; on deposit, `out_token` must be a vToken; on withdraw, `in_token` must be a vToken; the helper must hold enough input balance for the requested `assets`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's wrong with in_token=out_token? If someone wants a DeFi operation for Arbitrage that starts and ends with USDC, why we ban it?


Typical **preconditions** (enforced with explicit errors) include: non-zero tokens and amount; `in_token != out_token`; on deposit, `out_token` must be a vToken; on withdraw, `in_token` must be a vToken; the helper must hold enough input balance for the requested `assets`.

### Interface sketch (Cairo)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect people to write their own adapter-contracts? If so, providing ABI of three function is not enough. IF not, this entire section is redundant IMO

title: Channels, subchannels, and note discovery
description: Location-indexed discovery and directional channels
icon: magnifying-glass
---

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Subchannel" is never explained in this page, only referenced. (This page was actually much better in the previous iteration where there were many more details)

@ob1337 ob1337 merged commit 9dc4a3b into main Apr 27, 2026
2 of 3 checks passed
@ob1337 ob1337 deleted the starknet-privacy-docs branch April 27, 2026 14:53
ob1337 added a commit that referenced this pull request May 10, 2026
* Add Starknet Privacy documentation section

* Move Starknet Privacy to Learn; update nav and homepage

* Starknet Privacy docs: under Learn, overview comparison grid, privacy-enthusiast copy

* Address PR #1747 privacy docs review comments

* Starknet Privacy: protocol-only docs, open notes + anonymous DeFi helpers

* Address Apr 6 review comments on PR #1747

* rebranded helper contract to anonymizing contract

---------

Co-authored-by: Maya Dotan <maya@MAC-MAYADO.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants