# cloakproject/cloakcoin architecture

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

- Interactive diagram: https://gitdiagram.com/cloakproject/cloakcoin
- Repository: https://github.com/cloakproject/cloakcoin

## Overview

CloakCoin is a proof-of-stake cryptocurrency client with a Qt wallet. Its principal user workflow is to use the wallet GUI to inspect client and chain status and manage wallet activity, while the core maintains blockchain state and communicates with peers; the README identifies the GUI wallet and proof-of-stake consensus. The repository also contains Enigma cloaking and a substantial Tor networking subsystem. The index and excerpts establish several core dependencies, but do not show the complete GUI action paths or Tor integration, so those links are omitted or marked unverified.

Main entry points: [`src/main.cpp`](https://github.com/cloakproject/cloakcoin/blob/master/src/main.cpp) (Chain processing), [`src/qt/bitcoingui.cpp`](https://github.com/cloakproject/cloakcoin/blob/master/src/qt/bitcoingui.cpp) (Qt wallet), [`src/enigma/enigma.cpp`](https://github.com/cloakproject/cloakcoin/blob/master/src/enigma/enigma.cpp) (Enigma protocol), [`src/enigma/cloakingrequest.cpp`](https://github.com/cloakproject/cloakcoin/blob/master/src/enigma/cloakingrequest.cpp) (Cloaking requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gui["Wallet GUI"]
  node_qtgui["Qt wallet<br/>[bitcoingui.cpp]"]
  node_clientmodel["Client status<br/>[clientmodel.cpp]"]
  node_walletmodel["Wallet model<br/>[walletmodel.cpp]"]
  node_sendui["Send coins"]
end

subgraph group_core["Coin Core"]
  node_core["Chain processing<br/>[main.cpp]"]
  node_network["Peer networking<br/>[net.cpp]"]
  node_wallet["Wallet state<br/>[wallet.cpp]"]
  node_init["Node startup<br/>[init.cpp]"]
  node_rpc["RPC interface<br/>[bitcoinrpc.cpp]"]
end

subgraph group_cloak["Enigma Cloaking"]
  node_enigma["Enigma protocol<br/>[enigma.cpp]"]
  node_cloakrequest["Cloaking requests"]
  node_cloakshield["Cloaking shield<br/>[cloakshield.cpp]"]
end

subgraph group_tor["Tor Networking"]
  node_tor["Tor runtime<br/>[or.h]"]
  node_torrouter["Router directory<br/>[routerlist.c]"]
  node_torparse["Descriptor parsing<br/>[routerparse.c]"]
end

subgraph group_storage["Persistence"]
  node_txdb[("Transaction database<br/>[txdb-leveldb.cpp]")]
  node_leveldb[("LevelDB engine<br/>[version_set.cc]")]
end

node_user(("Wallet user"))

node_user -->|"uses"| node_qtgui
node_qtgui -.->|"shows status"| node_clientmodel
node_qtgui -.->|"manages wallet"| node_walletmodel
node_qtgui -.->|"initiates send"| node_sendui
node_clientmodel -->|"reads chain state"| node_core
node_core -->|"uses peers"| node_network
node_core -->|"uses wallet"| node_wallet
node_core -->|"uses startup"| node_init
node_core -->|"uses database"| node_txdb
node_core -->|"uses cloaking"| node_enigma
node_core -.->|"exposes RPC"| node_rpc
node_cloakrequest -->|"updates wallet"| node_wallet
node_cloakrequest -->|"fetches inputs"| node_txdb
node_enigma -.->|"coordinates requests"| node_cloakrequest
node_enigma -.->|"uses shield"| node_cloakshield
node_torrouter -.->|"parses descriptors"| node_torparse
node_txdb -.->|"stores records"| node_leveldb

click node_qtgui "https://github.com/cloakproject/cloakcoin/blob/master/src/qt/bitcoingui.cpp"
click node_clientmodel "https://github.com/cloakproject/cloakcoin/blob/master/src/qt/clientmodel.cpp"
click node_walletmodel "https://github.com/cloakproject/cloakcoin/blob/master/src/qt/walletmodel.cpp"
click node_sendui "https://github.com/cloakproject/cloakcoin/blob/master/src/qt/sendcoinsdialog.cpp"
click node_core "https://github.com/cloakproject/cloakcoin/blob/master/src/main.cpp"
click node_network "https://github.com/cloakproject/cloakcoin/blob/master/src/net.cpp"
click node_wallet "https://github.com/cloakproject/cloakcoin/blob/master/src/wallet.cpp"
click node_init "https://github.com/cloakproject/cloakcoin/blob/master/src/init.cpp"
click node_rpc "https://github.com/cloakproject/cloakcoin/blob/master/src/bitcoinrpc.cpp"
click node_enigma "https://github.com/cloakproject/cloakcoin/blob/master/src/enigma/enigma.cpp"
click node_cloakrequest "https://github.com/cloakproject/cloakcoin/blob/master/src/enigma/cloakingrequest.cpp"
click node_cloakshield "https://github.com/cloakproject/cloakcoin/blob/master/src/enigma/cloakshield.cpp"
click node_tor "https://github.com/cloakproject/cloakcoin/blob/master/src/tor/or.h"
click node_torrouter "https://github.com/cloakproject/cloakcoin/blob/master/src/tor/routerlist.c"
click node_torparse "https://github.com/cloakproject/cloakcoin/blob/master/src/tor/routerparse.c"
click node_txdb "https://github.com/cloakproject/cloakcoin/blob/master/src/txdb-leveldb.cpp"
click node_leveldb "https://github.com/cloakproject/cloakcoin/blob/master/src/leveldb/db/version_set.cc"

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_qtgui,node_clientmodel,node_walletmodel,node_sendui,node_user toneBlue
class node_core,node_network,node_wallet,node_init,node_rpc toneAmber
class node_enigma,node_cloakrequest,node_cloakshield toneMint
class node_tor,node_torrouter,node_torparse toneRose
class node_txdb,node_leveldb toneIndigo
```

## Components

### Wallet GUI

- [Qt wallet](https://github.com/cloakproject/cloakcoin/blob/master/src/qt/bitcoingui.cpp): `src/qt/bitcoingui.cpp`
- [Client status](https://github.com/cloakproject/cloakcoin/blob/master/src/qt/clientmodel.cpp): `src/qt/clientmodel.cpp`
- [Wallet model](https://github.com/cloakproject/cloakcoin/blob/master/src/qt/walletmodel.cpp): `src/qt/walletmodel.cpp`
- [Send coins](https://github.com/cloakproject/cloakcoin/blob/master/src/qt/sendcoinsdialog.cpp): `src/qt/sendcoinsdialog.cpp`

### Coin Core

- [Chain processing](https://github.com/cloakproject/cloakcoin/blob/master/src/main.cpp): `src/main.cpp`
- [Peer networking](https://github.com/cloakproject/cloakcoin/blob/master/src/net.cpp): `src/net.cpp`
- [Wallet state](https://github.com/cloakproject/cloakcoin/blob/master/src/wallet.cpp): `src/wallet.cpp`
- [Node startup](https://github.com/cloakproject/cloakcoin/blob/master/src/init.cpp): `src/init.cpp`
- [RPC interface](https://github.com/cloakproject/cloakcoin/blob/master/src/bitcoinrpc.cpp): `src/bitcoinrpc.cpp`

### Enigma Cloaking

- [Enigma protocol](https://github.com/cloakproject/cloakcoin/blob/master/src/enigma/enigma.cpp): `src/enigma/enigma.cpp`
- [Cloaking requests](https://github.com/cloakproject/cloakcoin/blob/master/src/enigma/cloakingrequest.cpp): `src/enigma/cloakingrequest.cpp`
- [Cloaking shield](https://github.com/cloakproject/cloakcoin/blob/master/src/enigma/cloakshield.cpp): `src/enigma/cloakshield.cpp`

### Tor Networking

- [Tor runtime](https://github.com/cloakproject/cloakcoin/blob/master/src/tor/or.h): `src/tor/or.h`
- [Router directory](https://github.com/cloakproject/cloakcoin/blob/master/src/tor/routerlist.c): `src/tor/routerlist.c`
- [Descriptor parsing](https://github.com/cloakproject/cloakcoin/blob/master/src/tor/routerparse.c): `src/tor/routerparse.c`

### Persistence

- [Transaction database](https://github.com/cloakproject/cloakcoin/blob/master/src/txdb-leveldb.cpp): `src/txdb-leveldb.cpp`
- [LevelDB engine](https://github.com/cloakproject/cloakcoin/blob/master/src/leveldb/db/version_set.cc): `src/leveldb/db/version_set.cc`

### Other components

- **Wallet user**

## Connections

- Wallet user → Qt wallet: uses (evidence: `README`)
- Qt wallet → Client status: shows status
- Qt wallet → Wallet model: manages wallet
- Qt wallet → Send coins: initiates send
- Client status → Chain processing: reads chain state (evidence: `src/qt/clientmodel.cpp`)
- Chain processing → Peer networking: uses peers (evidence: `src/main.cpp`)
- Chain processing → Wallet state: uses wallet (evidence: `src/main.cpp`)
- Chain processing → Node startup: uses startup (evidence: `src/main.cpp`)
- Chain processing → Transaction database: uses database (evidence: `src/main.cpp`)
- Chain processing → Enigma protocol: uses cloaking (evidence: `src/main.cpp`)
- Chain processing → RPC interface: exposes RPC
- Cloaking requests → Wallet state: updates wallet (evidence: `src/enigma/cloakingrequest.cpp`)
- Cloaking requests → Transaction database: fetches inputs (evidence: `src/enigma/cloakingrequest.cpp`)
- Enigma protocol → Cloaking requests: coordinates requests
- Enigma protocol → Cloaking shield: uses shield
- Router directory → Descriptor parsing: parses descriptors
- Transaction database → LevelDB engine: stores records
