bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 73쪽 중 28쪽
ead of time. That is exactly what open notes are for: the proof creates a placeholder, and the helper fills it with the real amount.
### Interface sketch (Cairo)
The following excerpt shows the **shape** of an invoke helper for reference. **Most users will interact through existing deployed helpers** (like the Vesu lending helper above), not write their own. Teams building new DeFi integrations can use this as a starting point—for working helper integrations (Vesu lending, swaps, escrow), see the [DeFi helper examples in STRK20 by Example](https://strk20-by-example.org/helpers/vesu-lending-helper):
```cairo theme={null}
pub enum LendingOperation { Deposit, Withdraw }
#[starknet::interface]
pub trait IVToken<T> {
fn deposit(ref self: T, assets: u256, receiver: ContractAddress) -> u256;
fn withdraw(
ref self: T, assets: u256, receiver: ContractAddress, owner: ContractAddress,
) -> u256;
}
#[starknet::interface]
pub trait IVesuLendingHelper<T> {
/// Called by the privacy pool via the protocol invoke path.
fn privacy_invoke(
ref self: T,
operation: LendingOperation,
in_token: ContractAddress,
out_token: ContractAddress,
assets: u256,
note_id: felt252,
) -> Span<OpenNoteDeposit>;
}
```
The live contract also performs the approve / call / balance-delta / approve-pool sequence described above.
## Swaps vs lending
* **Swap flow:** withdraw to helper → invoke AMM (or router) → measure output → return open-note deposit(s).
* **Lending flow (Vesu example):** same orchestration, but the external protocol is **mint/burn of vTokens** and movement of **underlying**, still ending in a measured **output amount** credited to an open note.
# System architecture
Source: https://docs.starknet.io/build/starknet-privacy/architecture
Pool contract, proof verifier path, client-side proving, and compliance
The design has three pillars (paper §3):
1. **Privacy pool state contract**
2. **Proof verification path**
3. **Client-side proving + compliance data model**
## Pool and verifier
The privacy pool contract handles state transitions (note creation, nullifier publishing, deposits, withdrawals). Proof verification happens at the **sequencer level**, not in a separate smart contract—the Starknet sequencer verifies the ZK proof before executing the transaction. The mainnet pool contract is deployed at [`0x0403…812a`](https://voyager.online/contract/0x040337b1af3c663e86e333bab5a4b28da8d4652a15a69beee2b677776ffe812a) and its source is readable on Voyager.
## Client-side proving
A transaction requires a ZK proof. The proof shows that it was generated in a virtual Starknet execution environment (SNOS) anchored to a recent block. In the current phase, **designated operators generate proofs on behalf of users**. Proofs can also be created client-side using Stwo locally; they typically take ±30 seconds on a strong laptop.
## Compliance model
Each user registers a public viewing key and an auditor-encrypted private viewing key, enabling selective traceability under lawful requests.
Next: [Notes and nullifiers](/build/starknet-privacy/notes-and-nullifiers).
# Compliance framework
Source: https://docs.starknet.io/build/starknet-privacy/compliance
Auditing entity, viewing key escrow, and forward/backward tracing
Privacy without accountability is hard to deploy in regulated contexts. The protocol bakes in **selective disclosure** to a designated **auditing entity**: only the user under a lawful request is traceable; everyone else remains private.
## Registration
Users encrypt their **private viewing key** to the auditor’s **public key** and store it on-chain. The auditor can decrypt **only** subjects of a lawful request.
## What the auditor can do
With a user’s viewing key, the auditor can:
* Scan **incoming channels** (who sent to this user).
* Scan **outgoing channels** (where this user sent).
* Decrypt **note amounts** along those graphs and follow **nullifiers** / **withdrawals** to trace funds.
Other users’ keys are not decrypted.
## On-chain transparency hooks
The proof enforces emission of events useful for tracing, for example:
* **Registration** — encrypted viewing key (+ event).
* **Deposit** — depositor address in clear.
* **Withdraw** — encryption of user address to auditor.
* **UseNote** — nullifier published.
Together with balance conservation and sequential discovery, this supports **forward tracing** (from deposit to current notes or withdrawals) and **backward tracing** (from withdrawal toward deposits). See Theorem 3 in [IACR 2026/474](https://eprint.iacr.org/2026/474.pdf) §9.
## Threshold auditing
The paper notes **threshold encryption** for the auditor key so no single party can decrypt arbitrary users’ keys.
# Channels, subchannels, and note discovery
Source: https://docs.starknet.io/build/starknet-privacy/discovery
Location-indexed discovery and directional channels
Starknet Privacy uses **location-indexed discovery**: recipients know where to read encrypted notes, instead of trial-decrypting all pool activity.
## Channels are directional
A channel is directional: **sender -> recipient**.
* Channel key derivation uses sender private viewing key + recipient public viewing key.
* This directionality is intentional.
* If Alice and Bob both send privately to each other, there are two channels: Alice->Bob and Bob->Alice.
## Subchannels
Within each channel, notes are organized into **subchannels** by token type. A subchannel is opened the first time a sender sends a particular token to a particular recipient through that channel.
* Subchannel ID: derived from the channel key and a sequential index.
* Each subchannel holds an encrypted token identifier and a dense list of notes for that token.
* This structure lets the recipient discover notes per-token without scanning unrelated assets.
So the hierarchy is: **channel** (sender → recipient) → **subchannel** (one per token) → **notes** (sequential within subchannel).
## Why this matters
Directional channels simplify sender authorization and preserve deterministic recipient discovery.
## Sequential indices
Outgoing channels, subchannels, and notes are dense sequential lists. This prevents hidden gaps and enables complete scanning until first empty slot.
## Discovery algorithm (recipient)
1. Scan channel entries for recipient.
2. For each channel, scan subchannels.
3. For each (channel, token), scan notes and check spent status via nullifier set.
Complexity is proportional to recipient activity, not global pool volume.
# Encryption and viewing keys
Source: https://docs.starknet.io/build/starknet-privacy/encryption-and-keys
Symmetric note encryption, ECDH channel encryption, and compliance key escrow
The protocol uses **domain-separated hashes** (H\_0, H\_1, …) for distinct purposes.
## Viewing keys
Each user has a **viewing key pair**:
* **Private viewing key** (k) — decrypt notes and channel data; needed for nullifier computation when spending.
* **Public viewing key** (K) — others encrypt to you (STARK curve; public key encoded from k·G).
Viewing keys are **registered once** and treated as **immutable** for simplicity.
## Symmetric encryption (notes, subchannels)
* **Note amounts** — hash-and-add style: salt plus a masked value (H\_9(c, token, i, salt) + v) mod 2^128 packed in a felt (see paper §6.1.1).
* **Subchannel token** — similar masking with channel key and subchannel index.
Without the **channel key**, ciphertexts are pseudorandom to outsiders.
## Asymmetric encryption (channels, compliance)
**Channel open** uses **ECDH** on the STARK curve: ephemeral r, shared secret from r·lift(K\_recipient), then mask channel key and sender address with H\_10, H\_11 of the shared secret.
**Compliance:** at registration, the user encrypts **private viewing key** (k) to the auditor’s public key (K\_audit) (same ECDH pattern, Definition 8 in the paper).
## Open notes (DeFi)
**Open notes** fix the note salt to the protocol’s reserved value so the packed storage cell is **not** masked like a confidential note. In the paper’s packing, that corresponds to **plaintext amount** in the lower part of the felt (upper bits carry the reserved salt), which is why observers can read the filled amount on-chain.
That design lets a proof commit to **creating** a note **before** an external step (for example an AMM) knows the exact output quantity; the helper fills the note afterward.
More context: [Notes and nullifiers — Open notes](/build/starknet-privacy/notes-and-nullifiers#open-notes) · [Anonymous DeFi](/build/starknet-privacy/anonymous-defi) · paper [§6.1.1](https://eprint.iacr.org/2026/474.pdf).
# Glossary
Source: https://docs.starknet.io/build/starknet-privacy/glossary
Terms used across Starknet Privacy documentation
| Term | Meaning |
| - | - |
| **Privacy pool** | Smart contract holding pooled ERC-20s and enforcing proofs + write-once state. |
| **Note** | Immutable record of ownership of an amount of a token; spent via **nullifier**. |
| **Nullifier** | One-time value revealed when spending a note; prevents double-spend; unlinkable without viewing key. |
| **Channel** | Unidirectional link sender → recipient; first send opens it and shares **channel key** (encrypted to recipient). |
| **Channel key** | Shared secret derived from sender/recipient viewing material; indexes note locations. |
| **Subchannel** | Per-channel, per-token lane for notes (avoids extra channel opens per asset). |
| **Viewing key** | Key pair: private (k) for decrypt/trace/nullifier; public (K) for encrypt-to-user. |
| **Client-side action** | High-level user intent (open channel, use note, withdraw, …). |
| **Server-side action** | Primitive the contract runs (WriteOnce, append channel, ERC-20 transfer). |
| **WriteOnce** | Storage write only if cell is zero—immutability. |
| **Open note** | Note whose encoding uses a reserved salt so the filled amount is **plaintext** on-chain; used when an external contract must set the amount after the proof (e.g. AMM output). |
| **Paymaster** | Relayer that submits txs and is reimbursed from the pool. |
| **Auditing entity** | Holder of k\_audit; decrypts escrowed viewing keys under compliance process. |
| **Stwo** | STARK prover used for client-side Cairo proofs. |
# Notes and nullifiers
Source: https://docs.starknet.io/build/starknet-privacy/notes-and-nullifiers
UTXO-style notes, note identifiers, and double-spend prevention on Starknet Privacy
Starknet Privacy uses a **note** model related to Zerocash/Zcash: each note is an immutable record of ownership of a token amount.
## Note structure
A note encodes:
* **Owner** — Starknet address authorized to spend (via account signature + viewing key knowledge).
* **Token** — ERC-20 contract address.
* **Amount** — 128-bit value; on-chain storage often holds only **encrypted** amount data.
Notes are **immutable**. To “transfer part” of a note, the owner **spends** the full note and **creates** new notes (change + outputs)—like Bitcoin UTXOs.
## Open notes
Most notes hide the **amount** (and use encryption keyed to the channel) so observers learn little from ciphertext alone. **Open notes** are a deliberate exception for flows where the **output amount is not fixed at proof time**—for example, an AMM swap where the execution price is determined on-chain **after** the privacy proof is built.
Conceptually:
* **Same note object** — still an owner, token, and amount slot in pool storage; still spent with a **nullifier** like any other note.
* **Reserved encoding** — the protocol uses a fixed **salt** value (see paper §6.1.1) so the stored payload is **not** ciphertext in the usual sense. After the note is **filled**, the **amount** (and related fields the spec exposes for this mode, such as token and depositor where applicable) appear **in plaintext** on-chain—anyone can read them.
* **Lifecycle** — you typically **create** an open note in an “empty” or partial state inside a transaction whose proof already authorizes the shape of the flow, then an **external contract** (for example via **Invoke**) completes the swap and **writes** the final amount into that note.
**Privacy tradeoff:** open notes protect **who** is interacting with DeFi and how notes chain through the pool, but they **do not** hide the filled amount on that leg. Use them only where the protocol needs an on-chain fill after proving. For ordinary transfers, use confidential notes.
See [Anonymous DeFi and open notes](/build/starknet-privacy/anonymous-defi) for the high-level swap pattern and [Encryption and viewing keys](/build/starknet-privacy/encryption-and-keys) for how encoding differs from standard note encryption.
## Note identifier and storage
The **note id** determines where the encrypted note is stored. It is derived from a **channel key** (c), **token**, and a **sequential index** (i) inside that channel’s subchannel for that token. Only parties who know the channel layout can locate and decrypt notes efficiently.
## Nullifiers
Spending reveals a **nullifier** computed from the note parameters and the **owner’s private viewing key**. Properties:
* **Deterministic** — one valid nullifier per note.
* **Unique** — prevents double-spend when the contract records used nullifiers.
* **Unlinkable** — observers cannot map a nullifier back to a specific note without the viewing key.
The **sender** of a note cannot compute the nullifier (they don’t know the recipient’s private viewing key when the note is for someone else), so they can’t see when the note is spent.
See also: [Discovery](/build/starknet-privacy/discovery) (sequential indices), [Encryption](/build/starknet-privacy/encryption-and-keys).
# Overview
Source: https://docs.starknet.io/build/starknet-privacy/overview
Private transfers on Starknet with compliant privacy—notes, ZK proofs, and efficient discovery
**Starknet Privacy** is a protocol for private asset transfers on Starknet: sender, receiver, and amounts are hidden from outside observers, while validity is enforced with client-side zero-knowledge proofs (Stwo / Cairo). A compliance layer allows an auditing entity to trace activity when legally required, without exposing unrelated users.
## What these docs are for
These docs describe the **protocol**—notes, channels, discovery, compliance,
transaction ordering, and security considerations—so developers, partners,
and enterprises can understand how Starknet Privacy works.
* **Live on mainnet:** the privacy pool contract is deployed at
[`0x0403…812a`](https://voyager.online/contract/0x040337b1af3c663e86e333bab5a4b28da8d4652a15a69beee2b677776ffe812a).
The contract source is readable on Voyager.
* **SDK now open source:** the TypeScript SDK and proving stack are available in the
[starknet-privacy repo](https://github.com/starkware-libs/starknet-privacy).
For hands-on integration guides (install, quickstart, end-to-end flows), see
[STRK20 by Example](https://strk20-by-example.org/).
## Why Starknet Privacy?
If you care about private transfers, you have probably seen mixers (fixed amounts, one-time use) or privacy chains that require a separate ecosystem. Starknet Privacy takes a different path:
* **Stay on Starknet** — no new chain; access existing Starknet DeFi and accounts.
* **Arbitrary amounts, reusable notes** — no fixed denominations.
* **Discovery that scales with you** — recipients discover notes in time proportional to their own activity.
* **Compliance by design** — selective disclosure for lawful requests, without exposing unrelated users.
* **One account for everything** — existing Starknet account signs spends.
## Comparison
For the latest maintained cross-protocol comparison grid, use [privacygrid.dev](https://privacygrid.dev/).
> Note: this page keeps the protocol summary concise and defers detailed protocol-to-protocol scoring to the dedicated grid.
## Resources
<CardGroup>
<Card title="Paper" icon="file-pdf" href="https://eprint.iacr.org/2026/474">
*Scalable Compliant Privacy on Starknet* (IACR ePrint 2026/474)
</Card>
<Card title="Protocol deep-dives" icon="book" href="/build/starknet-privacy/architecture">
Architecture, flows, and cryptography in these docs
</Card>
<Card title="STRK20 by Example" icon="code" href="https://strk20-by-example.org/">
Hands-on integration hub: runnable SDK examples, DeFi helpers, and wallet integration guides
</Card>
<Card title="SDK source" icon="github" href="https://github.com/starkware-libs/starknet-privacy">
TypeScript SDK and proving stack in the starknet-privacy repo
</Card>
</CardGroup>
## What you get
| Property | Summary |
| - | - |
| **Private transfers** | Sender, receiver, and amount hidden from observers; transacting parties and authorized auditors can see details. |
| **Compliance** | Designated auditor can selectively trace history under legitimate regulatory request. |
| **Efficient discovery** | Recipients find notes in time scaling with *their* activity, not total pool activity. |
| **Multi-asset** | One pool supports multiple token types. |
| **DeFi** | Anonymous interaction with existing Starknet DeFi via open notes and atomic flows. |
| **Account abstraction** | Spend authority uses your Starknet account (multisig, smart wallet, etc.). |
## Next steps
<CardGroup>
<Card title="Architecture" icon="diagram-project" href="/build/starknet-privacy/architecture">Pool, verifier, and high-level design</Card>
<Card title="Transaction flow" icon="arrow-progress" href="/build/starknet-privacy/transaction-flow">Client actions and ordering</Card>
</CardGroup>
# Paymasters and transaction submission
Source: https://docs.starknet.io/build/starknet-privacy/paymasters
Hiding the user as on-chain sender and reimbursing fees from the pool
Private transfers aim to hide **who** is transacting. On Starknet, the **transaction sender** is visible—so users often submit through a **paymaster** service.
## Flow
1. User builds proof + server-side actions and sends them to the **paymaster**.
2. Paymaster **broadcasts** the transaction from **its** account and pays **fee** in ETH/strk.
3. User includes a **Withdraw** (or similar) in the same transaction to send **fee reimbursement** from the pool to the paymaster’s **public** address.
On-chain, observers see the paymaster as sender; they do not see the user’s Starknet address as the transaction origin.
## Trust model
* Paymaster learns **IP** and whatever the client sends; it should not learn more than necessary if the payload is minimal.
* Choose paymasters with clear **privacy** and **retention** policies.
Related: [Security](/build/starknet-privacy/security), [Transaction flow](/build/starknet-privacy/transaction-flow).
# Proof generation
Source: https://docs.starknet.io/build/starknet-privacy/proving
Virtual execution, Stwo proving, and how this differs from live Starknet
Proofs are generated by executing Cairo in a **virtual Starknet environment** anchored to a recent block, then proving that execution with Stwo.
## How integrators run the prover (today)
**Operational docs are intentionally not duplicated here** while the reference implementation, SDK, and proving stack are still **private**. When that code is open sourced (planned for a later phase of the rollout), install and end-to-end “generate proof → submit actions” guides will live next to the repository—not as placeholders on this site.
Until then, this page is **conceptual**: it explains what is being proved and why the model looks the way it does.
## Simulated vs real execution
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 **virtual Starknet OS dedicated to the privacy pool's implementation** are available (a subset of what the Starknet sequencer supports),
* unsupported features fail at proving time (not at post-submit execution).
**Supported bu프로젝트로 돌아가기