# octra-labs/webcli architecture

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

- Interactive diagram: https://gitdiagram.com/octra-labs/webcli
- Repository: https://github.com/octra-labs/webcli

## Overview

Octra Wallet is a local-server web client for managing an Octra wallet and interacting with the network. The main workflow is browser access to the local UI, wallet creation/import and PIN protection, then wallet actions such as sending transactions or encrypting/decrypting balances through the network RPC client. The tree also shows distinct stealth, Circle, and contract/program capabilities. The excerpts establish server/UI mounting and selected RPC and PVAC interfaces; many feature links rely on README statements or remain unverified because their handlers were not sampled.

Main entry points: [`wallet.hpp`](https://github.com/octra-labs/webcli/blob/main/wallet.hpp) (Wallet operations), [`static/wallet.js`](https://github.com/octra-labs/webcli/blob/main/static/wallet.js) (Browser UI), [`rpc_client.hpp`](https://github.com/octra-labs/webcli/blob/main/rpc_client.hpp) (Octra RPC client), [`main.cpp`](https://github.com/octra-labs/webcli/blob/main/main.cpp) (Local HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client and server"]
  node_browser["Browser UI<br/>[wallet.js]"]
  node_http["Local HTTP server<br/>[main.cpp]"]
  node_session["Session protection<br/>[session_http.hpp]"]
end

subgraph group_wallet["Wallet and transactions"]
  node_wallet_store[("Wallet storage<br/>[wallet_file.hpp]")]
  node_wallet_ops["Wallet operations<br/>[wallet.hpp]"]
  node_transaction["Transaction builder<br/>[tx_builder.hpp]"]
  node_tx_journal[("Transaction journal<br/>[tx_journal.hpp]")]
  node_stealth["Stealth transfers<br/>[stealth.hpp]"]
end

subgraph group_privacy["Privacy cryptography"]
  node_crypto["Wallet cryptography<br/>[crypto_utils.hpp]"]
  node_pvac_api["PVAC C API<br/>[pvac_c_api.cpp]"]
  node_pvac_ops["Encrypted operations<br/>[encrypt.hpp]"]
  node_pvac_crypto["PVAC primitives<br/>[ristretto255.hpp]"]
end

subgraph group_network["Network capabilities"]
  node_rpc["Octra RPC client<br/>[rpc_client.hpp]"]
  node_circles["Circle features<br/>[circles.js]"]
  node_contracts["Contract and program actions"]
end

node_user(("Wallet user"))
node_octra{{"Octra network"}}

node_user -->|"uses"| node_browser
node_browser -->|"calls local API"| node_http
node_http -->|"protects routes"| node_session
node_user -->|"creates or imports"| node_wallet_ops
node_wallet_ops -->|"stores encrypted wallet"| node_wallet_store
node_user -->|"authorizes with PIN"| node_wallet_ops
node_browser -.->|"requests wallet actions"| node_wallet_ops
node_wallet_ops -.->|"builds transfers"| node_transaction
node_wallet_ops -.->|"requests network actions"| node_rpc
node_transaction -.->|"submits transactions"| node_rpc
node_wallet_ops -.->|"records transaction state"| node_tx_journal
node_rpc -->|"sends RPC requests"| node_octra
node_user -->|"sends transfers"| node_wallet_ops
node_user -->|"encrypts or decrypts balances"| node_pvac_api
node_pvac_api -->|"invokes"| node_pvac_ops
node_pvac_ops -->|"uses primitives"| node_pvac_crypto
node_wallet_ops -->|"uses key utilities"| node_crypto
node_user -->|"conducts stealth transfers"| node_stealth
node_browser -.->|"uses Circle interface"| node_circles
node_user -.->|"uses contract features"| node_contracts
node_contracts -.->|"queries or submits"| node_rpc

click node_browser "https://github.com/octra-labs/webcli/blob/main/static/wallet.js"
click node_http "https://github.com/octra-labs/webcli/blob/main/main.cpp"
click node_session "https://github.com/octra-labs/webcli/blob/main/lib/session_http.hpp"
click node_wallet_store "https://github.com/octra-labs/webcli/blob/main/lib/wallet_file.hpp"
click node_wallet_ops "https://github.com/octra-labs/webcli/blob/main/wallet.hpp"
click node_transaction "https://github.com/octra-labs/webcli/blob/main/lib/tx_builder.hpp"
click node_tx_journal "https://github.com/octra-labs/webcli/blob/main/lib/tx_journal.hpp"
click node_rpc "https://github.com/octra-labs/webcli/blob/main/rpc_client.hpp"
click node_crypto "https://github.com/octra-labs/webcli/blob/main/crypto_utils.hpp"
click node_pvac_api "https://github.com/octra-labs/webcli/blob/main/pvac/pvac_c_api.cpp"
click node_pvac_ops "https://github.com/octra-labs/webcli/blob/main/pvac/include/pvac/ops/encrypt.hpp"
click node_pvac_crypto "https://github.com/octra-labs/webcli/blob/main/pvac/include/pvac/crypto/ristretto255.hpp"
click node_stealth "https://github.com/octra-labs/webcli/blob/main/lib/stealth.hpp"
click node_circles "https://github.com/octra-labs/webcli/blob/main/static/circles.js"
click node_contracts "https://github.com/octra-labs/webcli/blob/main/lib/resource_compute_intent.hpp"

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_browser,node_http,node_session,node_user toneBlue
class node_wallet_store,node_wallet_ops,node_transaction,node_tx_journal,node_stealth toneAmber
class node_crypto,node_pvac_api,node_pvac_ops,node_pvac_crypto toneMint
class node_rpc,node_circles,node_contracts toneRose
class node_octra toneIndigo
```

## Components

### Web client and server

- [Browser UI](https://github.com/octra-labs/webcli/blob/main/static/wallet.js): `static/wallet.js`
- [Local HTTP server](https://github.com/octra-labs/webcli/blob/main/main.cpp): `main.cpp`
- [Session protection](https://github.com/octra-labs/webcli/blob/main/lib/session_http.hpp): `lib/session_http.hpp`

### Wallet and transactions

- [Wallet storage](https://github.com/octra-labs/webcli/blob/main/lib/wallet_file.hpp): `lib/wallet_file.hpp`
- [Wallet operations](https://github.com/octra-labs/webcli/blob/main/wallet.hpp): `wallet.hpp`
- [Transaction builder](https://github.com/octra-labs/webcli/blob/main/lib/tx_builder.hpp): `lib/tx_builder.hpp`
- [Transaction journal](https://github.com/octra-labs/webcli/blob/main/lib/tx_journal.hpp): `lib/tx_journal.hpp`
- [Stealth transfers](https://github.com/octra-labs/webcli/blob/main/lib/stealth.hpp): `lib/stealth.hpp`

### Privacy cryptography

- [Wallet cryptography](https://github.com/octra-labs/webcli/blob/main/crypto_utils.hpp): `crypto_utils.hpp`
- [PVAC C API](https://github.com/octra-labs/webcli/blob/main/pvac/pvac_c_api.cpp): `pvac/pvac_c_api.cpp`
- [Encrypted operations](https://github.com/octra-labs/webcli/blob/main/pvac/include/pvac/ops/encrypt.hpp): `pvac/include/pvac/ops/encrypt.hpp`
- [PVAC primitives](https://github.com/octra-labs/webcli/blob/main/pvac/include/pvac/crypto/ristretto255.hpp): `pvac/include/pvac/crypto/ristretto255.hpp`

### Network capabilities

- [Octra RPC client](https://github.com/octra-labs/webcli/blob/main/rpc_client.hpp): `rpc_client.hpp`
- [Circle features](https://github.com/octra-labs/webcli/blob/main/static/circles.js): `static/circles.js`
- [Contract and program actions](https://github.com/octra-labs/webcli/blob/main/lib/resource_compute_intent.hpp): `lib/resource_compute_intent.hpp`

### Other components

- **Wallet user**
- **Octra network**

## Connections

- Wallet user → Browser UI: uses
- Browser UI → Local HTTP server: calls local API (evidence: `main.cpp`)
- Local HTTP server → Session protection: protects routes (evidence: `lib/session_http.hpp`)
- Wallet user → Wallet operations: creates or imports
- Wallet operations → Wallet storage: stores encrypted wallet (evidence: `wallet.hpp`)
- Wallet user → Wallet operations: authorizes with PIN
- Browser UI → Wallet operations: requests wallet actions
- Wallet operations → Transaction builder: builds transfers
- Wallet operations → Octra RPC client: requests network actions
- Transaction builder → Octra RPC client: submits transactions
- Wallet operations → Transaction journal: records transaction state
- Octra RPC client → Octra network: sends RPC requests (evidence: `rpc_client.hpp`)
- Wallet user → Wallet operations: sends transfers
- Wallet user → PVAC C API: encrypts or decrypts balances
- PVAC C API → Encrypted operations: invokes (evidence: `pvac/pvac_c_api.cpp`)
- Encrypted operations → PVAC primitives: uses primitives (evidence: `pvac/include/pvac/ops/encrypt.hpp`)
- Wallet operations → Wallet cryptography: uses key utilities (evidence: `wallet.hpp`)
- Wallet user → Stealth transfers: conducts stealth transfers
- Browser UI → Circle features: uses Circle interface
- Wallet user → Contract and program actions: uses contract features
- Contract and program actions → Octra RPC client: queries or submits
