# urriki1502/wam-privacy architecture

> Architecture diagram of the GitHub repository urriki1502/wam-privacy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/urriki1502/wam-privacy
- Repository: https://github.com/urriki1502/wam-privacy

## Overview

WAM Privacy is a research and prototype repository, not a production wallet or mainnet integration. Its clearest user-to-result workflow is an in-memory authorization harness: bind a wallet coin-selection result to a normalized PayJoin transaction, validate the proposal, pass it through signer policy, and validate a network plan. Separate prototypes cover WAM adapters and shielded-note construction, proof context, serialization, wallet state, and Core-facing verification. The README documents these capabilities and review stages; edges between many shielded stages are omitted where sampled code does not establish runtime calls.

Main entry points: [`prototypes/privacy_stack/contract.py`](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/privacy_stack/contract.py) (Stack authorization), [`prototypes/zk_balance_halo2/src/note_action.rs`](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/note_action.rs) (Note action), [`prototypes/zk_balance_halo2/src/bundle_action.rs`](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/bundle_action.rs) (Bundle action), [`prototypes/zk_balance_halo2/src/hardened_bundle.rs`](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/hardened_bundle.rs) (Hardened bundle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wallet_flow["Wallet authorization"]
  node_integration_contract["Stack authorization<br/>[contract.py]"]
  node_signer_gate["Signer gate<br/>[provider.py]"]
end

subgraph group_privacy_policies["Privacy policies"]
  node_coin_selection["Coin selection<br/>[policy.py]"]
  node_payjoin_validation["PayJoin validation<br/>[validator.py]"]
  node_network_policy["Network policy<br/>[policy.py]"]
end

subgraph group_shielded["Shielded prototype"]
  node_shielded_model["Shielded state model<br/>[model.py]"]
  node_balance_circuit["Balance circuit<br/>[lib.rs]"]
  node_note_action["Note action<br/>[note_action.rs]"]
  node_bundle_action["Bundle action<br/>[bundle_action.rs]"]
  node_hardened_bundle["Hardened bundle<br/>[hardened_bundle.rs]"]
  node_proof_context["Proof context<br/>[context.rs]"]
  node_serialization_v2["Serialization v2"]
  node_note_encryption["Note encryption<br/>[note_encryption.rs]"]
  node_transfer_action["Transfer action<br/>[transfer_action.rs]"]
  node_anchor["Anchored state<br/>[anchor.rs]"]
  node_core_state["Core state<br/>[core_state.rs]"]
  node_wallet_state["Shielded wallet state<br/>[wallet_state.rs]"]
end

subgraph group_core_adoption["Core adapters"]
  node_wam_adapter["WAM adapter<br/>[wam.py]"]
  node_core_verifier["Core verifier"]
end

node_wallet_user(("Wallet user"))

node_wallet_user -->|"requests authorization"| node_integration_contract
node_integration_contract -->|"binds selection"| node_coin_selection
node_integration_contract -.->|"validates proposal"| node_payjoin_validation
node_integration_contract -.->|"authorizes signing"| node_signer_gate
node_integration_contract -.->|"checks route plan"| node_network_policy
node_note_encryption -->|"uses note fields"| node_note_action
node_bundle_action -->|"uses note action"| node_note_action
node_hardened_bundle -->|"uses note action"| node_note_action
node_serialization_v2 -->|"binds context"| node_proof_context

click node_integration_contract "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/privacy_stack/contract.py"
click node_coin_selection "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/wallet_privacy/policy.py"
click node_payjoin_validation "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/payjoin_safety/validator.py"
click node_signer_gate "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/signer_abstraction/provider.py"
click node_network_policy "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/network_privacy/policy.py"
click node_wam_adapter "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/real_adapters/wam.py"
click node_shielded_model "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/shielded_model/model.py"
click node_balance_circuit "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/lib.rs"
click node_note_action "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/note_action.rs"
click node_bundle_action "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/bundle_action.rs"
click node_hardened_bundle "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/hardened_bundle.rs"
click node_proof_context "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/context.rs"
click node_serialization_v2 "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/serialization_v2.rs"
click node_note_encryption "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/note_encryption.rs"
click node_transfer_action "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/transfer_action.rs"
click node_anchor "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/anchor.rs"
click node_core_state "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/core_state.rs"
click node_wallet_state "https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/wallet_state.rs"
click node_core_verifier "https://github.com/urriki1502/wam-privacy/blob/main/integration/core/phase13b/privacy_verifier.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_integration_contract,node_signer_gate,node_wallet_user toneBlue
class node_coin_selection,node_payjoin_validation,node_network_policy toneAmber
class node_shielded_model,node_balance_circuit,node_note_action,node_bundle_action,node_hardened_bundle,node_proof_context,node_serialization_v2,node_note_encryption,node_transfer_action,node_anchor,node_core_state,node_wallet_state toneMint
class node_wam_adapter,node_core_verifier toneRose
```

## Components

### Wallet authorization

- [Stack authorization](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/privacy_stack/contract.py): `prototypes/privacy_stack/contract.py`
- [Signer gate](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/signer_abstraction/provider.py): `prototypes/signer_abstraction/provider.py`

### Privacy policies

- [Coin selection](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/wallet_privacy/policy.py): `prototypes/wallet_privacy/policy.py`
- [PayJoin validation](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/payjoin_safety/validator.py): `prototypes/payjoin_safety/validator.py`
- [Network policy](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/network_privacy/policy.py): `prototypes/network_privacy/policy.py`

### Shielded prototype

- [Shielded state model](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/shielded_model/model.py): `prototypes/shielded_model/model.py`
- [Balance circuit](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/lib.rs): `prototypes/zk_balance_halo2/src/lib.rs`
- [Note action](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/note_action.rs): `prototypes/zk_balance_halo2/src/note_action.rs`
- [Bundle action](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/bundle_action.rs): `prototypes/zk_balance_halo2/src/bundle_action.rs`
- [Hardened bundle](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/hardened_bundle.rs): `prototypes/zk_balance_halo2/src/hardened_bundle.rs`
- [Proof context](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/context.rs): `prototypes/zk_balance_halo2/src/context.rs`
- [Serialization v2](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/serialization_v2.rs): `prototypes/zk_balance_halo2/src/serialization_v2.rs`
- [Note encryption](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/note_encryption.rs): `prototypes/zk_balance_halo2/src/note_encryption.rs`
- [Transfer action](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/transfer_action.rs): `prototypes/zk_balance_halo2/src/transfer_action.rs`
- [Anchored state](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/anchor.rs): `prototypes/zk_balance_halo2/src/anchor.rs`
- [Core state](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/core_state.rs): `prototypes/zk_balance_halo2/src/core_state.rs`
- [Shielded wallet state](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/zk_balance_halo2/src/wallet_state.rs): `prototypes/zk_balance_halo2/src/wallet_state.rs`

### Core adapters

- [WAM adapter](https://github.com/urriki1502/wam-privacy/blob/main/prototypes/real_adapters/wam.py): `prototypes/real_adapters/wam.py`
- [Core verifier](https://github.com/urriki1502/wam-privacy/blob/main/integration/core/phase13b/privacy_verifier.cpp): `integration/core/phase13b/privacy_verifier.cpp`

### Other components

- **Wallet user**

## Connections

- Wallet user → Stack authorization: requests authorization (evidence: `prototypes/privacy_stack/contract.py`)
- Stack authorization → Coin selection: binds selection (evidence: `prototypes/privacy_stack/contract.py`)
- Stack authorization → PayJoin validation: validates proposal
- Stack authorization → Signer gate: authorizes signing
- Stack authorization → Network policy: checks route plan
- Note encryption → Note action: uses note fields (evidence: `prototypes/zk_balance_halo2/src/note_encryption.rs`)
- Bundle action → Note action: uses note action (evidence: `prototypes/zk_balance_halo2/src/bundle_action.rs`)
- Hardened bundle → Note action: uses note action (evidence: `prototypes/zk_balance_halo2/src/hardened_bundle.rs`)
- Serialization v2 → Proof context: binds context (evidence: `prototypes/zk_balance_halo2/src/serialization_v2.rs`)
