# veil-project/veil architecture

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

- Interactive diagram: https://gitdiagram.com/veil-project/veil
- Repository: https://github.com/veil-project/veil

## Overview

Veil is a privacy-focused cryptocurrency node and wallet. Its principal user workflow is creating or managing a private transaction through the wallet, then propagating and validating it as part of the network’s ledger; the README identifies Zerocoin and RingCT as privacy mechanisms and Bulletproofs as a transaction-size improvement. It also documents hybrid PoW/PoS, three PoW algorithms, and network-encoded budgeting. The source index supports some internal library relationships, but most runtime orchestration was not sampled, so those links are shown as unverified dashed edges.

Main entry points: [`src/wallet/wallet.cpp`](https://github.com/veil-project/veil/blob/master/src/wallet/wallet.cpp) (Wallet engine), [`src/pow.cpp`](https://github.com/veil-project/veil/blob/master/src/pow.cpp) (Proof of work), [`src/miner.cpp`](https://github.com/veil-project/veil/blob/master/src/miner.cpp) (Mining), [`src/crypto/randomx/program.hpp`](https://github.com/veil-project/veil/blob/master/src/crypto/randomx/program.hpp) (RandomX program)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_user["Wallet access"]
  node_wallet_ui["Veil wallet UI<br/>[mainwindow.cpp]"]
  node_wallet_rpc["Wallet RPC<br/>[rpcwallet.cpp]"]
  node_wallet_engine["Wallet engine<br/>[wallet.cpp]"]
end

subgraph group_privacy["Privacy transactions"]
  node_anon_wallet["RingCT wallet<br/>[anonwallet.cpp]"]
  node_zerocoin_wallet["Zerocoin wallet<br/>[zwallet.cpp]"]
  node_zerocoin_protocol["Zerocoin protocol<br/>[CoinSpend.cpp]"]
  node_transaction["Transactions<br/>[transaction.cpp]"]
  node_zerocoin_math["Zerocoin arithmetic<br/>[bignum.h]"]
end

subgraph group_ledger["Network and ledger"]
  node_network["Peer networking<br/>[net.cpp]"]
  node_message_processing["Peer message processing<br/>[net_processing.cpp]"]
  node_validation["Transaction validation<br/>[tx_verify.cpp]"]
  node_chain_state["Chain state<br/>[chain.cpp]"]
end

subgraph group_consensus["Consensus and rewards"]
  node_mining["Mining<br/>[miner.cpp]"]
  node_proof_of_work["Proof of work<br/>[pow.cpp]"]
  node_randomx["RandomX<br/>[randomx.h]"]
  node_progpow["ProgPoW<br/>[progpow.cpp]"]
  node_budgeting["Network budgeting<br/>[mining.cpp]"]
  node_randomx_program["RandomX program<br/>[program.hpp]"]
  node_randomx_common["RandomX configuration<br/>[common.hpp]"]
  node_randomx_endian["RandomX endian helpers<br/>[endian.h]"]
end

subgraph group_storage["Core storage and crypto"]
  node_leveldb[("LevelDB versions<br/>[version_set.cc]")]
  node_leveldb_env["LevelDB environment<br/>[env.h]"]
  node_serialization["Core serialization<br/>[serialize.h]"]
  node_uint_arithmetic["256-bit arithmetic<br/>[arith_uint256.h]"]
  node_secp_api["secp256k1 API<br/>[secp256k1.h]"]
  node_secp_group["Elliptic-curve group<br/>[group_impl.h]"]
  node_secp_field["Field arithmetic<br/>[field_impl.h]"]
  node_secp_scalar["Scalar arithmetic<br/>[scalar_impl.h]"]
end

node_wallet_user(("Wallet user"))

node_wallet_user -.->|"uses"| node_wallet_ui
node_wallet_ui -.->|"accesses"| node_wallet_engine
node_wallet_rpc -.->|"accesses"| node_wallet_engine
node_wallet_engine -.->|"creates private transactions"| node_anon_wallet
node_wallet_engine -.->|"creates private transactions"| node_zerocoin_wallet
node_anon_wallet -.->|"constructs"| node_transaction
node_zerocoin_wallet -.->|"uses"| node_zerocoin_protocol
node_zerocoin_protocol -.->|"uses"| node_zerocoin_math
node_transaction -.->|"propagates"| node_network
node_network -.->|"dispatches"| node_message_processing
node_message_processing -.->|"validates"| node_validation
node_validation -.->|"updates"| node_chain_state
node_mining -.->|"requests work"| node_proof_of_work
node_proof_of_work -.->|"supports algorithm"| node_randomx
node_proof_of_work -.->|"supports algorithm"| node_progpow
node_mining -.->|"supports rewards"| node_budgeting
node_leveldb -->|"uses environment"| node_leveldb_env
node_randomx_program -->|"includes"| node_randomx_common
node_randomx_program -->|"loads data"| node_randomx_endian
node_randomx_common -->|"includes"| node_randomx_endian
node_secp_scalar -->|"uses group types"| node_secp_group
node_secp_group -->|"uses field operations"| node_secp_field

click node_wallet_ui "https://github.com/veil-project/veil/blob/master/src/qt/veil/mainwindow.cpp"
click node_wallet_rpc "https://github.com/veil-project/veil/blob/master/src/wallet/rpcwallet.cpp"
click node_wallet_engine "https://github.com/veil-project/veil/blob/master/src/wallet/wallet.cpp"
click node_anon_wallet "https://github.com/veil-project/veil/blob/master/src/veil/ringct/anonwallet.cpp"
click node_zerocoin_wallet "https://github.com/veil-project/veil/blob/master/src/veil/zerocoin/zwallet.cpp"
click node_zerocoin_protocol "https://github.com/veil-project/veil/blob/master/src/libzerocoin/CoinSpend.cpp"
click node_transaction "https://github.com/veil-project/veil/blob/master/src/primitives/transaction.cpp"
click node_network "https://github.com/veil-project/veil/blob/master/src/net.cpp"
click node_message_processing "https://github.com/veil-project/veil/blob/master/src/net_processing.cpp"
click node_validation "https://github.com/veil-project/veil/blob/master/src/consensus/tx_verify.cpp"
click node_chain_state "https://github.com/veil-project/veil/blob/master/src/chain.cpp"
click node_mining "https://github.com/veil-project/veil/blob/master/src/miner.cpp"
click node_proof_of_work "https://github.com/veil-project/veil/blob/master/src/pow.cpp"
click node_randomx "https://github.com/veil-project/veil/blob/master/src/crypto/randomx/randomx.h"
click node_progpow "https://github.com/veil-project/veil/blob/master/src/crypto/ethash/lib/ethash/progpow.cpp"
click node_budgeting "https://github.com/veil-project/veil/blob/master/src/rpc/mining.cpp"
click node_zerocoin_math "https://github.com/veil-project/veil/blob/master/src/libzerocoin/bignum.h"
click node_leveldb "https://github.com/veil-project/veil/blob/master/src/leveldb/db/version_set.cc"
click node_leveldb_env "https://github.com/veil-project/veil/blob/master/src/leveldb/include/leveldb/env.h"
click node_serialization "https://github.com/veil-project/veil/blob/master/src/serialize.h"
click node_uint_arithmetic "https://github.com/veil-project/veil/blob/master/src/arith_uint256.h"
click node_secp_api "https://github.com/veil-project/veil/blob/master/src/secp256k1/include/secp256k1.h"
click node_secp_group "https://github.com/veil-project/veil/blob/master/src/secp256k1/src/group_impl.h"
click node_secp_field "https://github.com/veil-project/veil/blob/master/src/secp256k1/src/field_impl.h"
click node_secp_scalar "https://github.com/veil-project/veil/blob/master/src/secp256k1/src/scalar_impl.h"
click node_randomx_program "https://github.com/veil-project/veil/blob/master/src/crypto/randomx/program.hpp"
click node_randomx_common "https://github.com/veil-project/veil/blob/master/src/crypto/randomx/common.hpp"
click node_randomx_endian "https://github.com/veil-project/veil/blob/master/src/crypto/randomx/blake2/endian.h"

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_wallet_ui,node_wallet_rpc,node_wallet_engine,node_wallet_user toneBlue
class node_anon_wallet,node_zerocoin_wallet,node_zerocoin_protocol,node_transaction,node_zerocoin_math toneAmber
class node_network,node_message_processing,node_validation,node_chain_state toneMint
class node_mining,node_proof_of_work,node_randomx,node_progpow,node_budgeting,node_randomx_program,node_randomx_common,node_randomx_endian toneRose
class node_leveldb,node_leveldb_env,node_serialization,node_uint_arithmetic,node_secp_api,node_secp_group,node_secp_field,node_secp_scalar toneIndigo
```

## Components

### Wallet access

- [Veil wallet UI](https://github.com/veil-project/veil/blob/master/src/qt/veil/mainwindow.cpp): `src/qt/veil/mainwindow.cpp`
- [Wallet RPC](https://github.com/veil-project/veil/blob/master/src/wallet/rpcwallet.cpp): `src/wallet/rpcwallet.cpp`
- [Wallet engine](https://github.com/veil-project/veil/blob/master/src/wallet/wallet.cpp): `src/wallet/wallet.cpp`

### Privacy transactions

- [RingCT wallet](https://github.com/veil-project/veil/blob/master/src/veil/ringct/anonwallet.cpp): `src/veil/ringct/anonwallet.cpp`
- [Zerocoin wallet](https://github.com/veil-project/veil/blob/master/src/veil/zerocoin/zwallet.cpp): `src/veil/zerocoin/zwallet.cpp`
- [Zerocoin protocol](https://github.com/veil-project/veil/blob/master/src/libzerocoin/CoinSpend.cpp): `src/libzerocoin/CoinSpend.cpp`
- [Transactions](https://github.com/veil-project/veil/blob/master/src/primitives/transaction.cpp): `src/primitives/transaction.cpp`
- [Zerocoin arithmetic](https://github.com/veil-project/veil/blob/master/src/libzerocoin/bignum.h): `src/libzerocoin/bignum.h`

### Network and ledger

- [Peer networking](https://github.com/veil-project/veil/blob/master/src/net.cpp): `src/net.cpp`
- [Peer message processing](https://github.com/veil-project/veil/blob/master/src/net_processing.cpp): `src/net_processing.cpp`
- [Transaction validation](https://github.com/veil-project/veil/blob/master/src/consensus/tx_verify.cpp): `src/consensus/tx_verify.cpp`
- [Chain state](https://github.com/veil-project/veil/blob/master/src/chain.cpp): `src/chain.cpp`

### Consensus and rewards

- [Mining](https://github.com/veil-project/veil/blob/master/src/miner.cpp): `src/miner.cpp`
- [Proof of work](https://github.com/veil-project/veil/blob/master/src/pow.cpp): `src/pow.cpp`
- [RandomX](https://github.com/veil-project/veil/blob/master/src/crypto/randomx/randomx.h): `src/crypto/randomx/randomx.h`
- [ProgPoW](https://github.com/veil-project/veil/blob/master/src/crypto/ethash/lib/ethash/progpow.cpp): `src/crypto/ethash/lib/ethash/progpow.cpp`
- [Network budgeting](https://github.com/veil-project/veil/blob/master/src/rpc/mining.cpp): `src/rpc/mining.cpp`
- [RandomX program](https://github.com/veil-project/veil/blob/master/src/crypto/randomx/program.hpp): `src/crypto/randomx/program.hpp`
- [RandomX configuration](https://github.com/veil-project/veil/blob/master/src/crypto/randomx/common.hpp): `src/crypto/randomx/common.hpp`
- [RandomX endian helpers](https://github.com/veil-project/veil/blob/master/src/crypto/randomx/blake2/endian.h): `src/crypto/randomx/blake2/endian.h`

### Core storage and crypto

- [LevelDB versions](https://github.com/veil-project/veil/blob/master/src/leveldb/db/version_set.cc): `src/leveldb/db/version_set.cc`
- [LevelDB environment](https://github.com/veil-project/veil/blob/master/src/leveldb/include/leveldb/env.h): `src/leveldb/include/leveldb/env.h`
- [Core serialization](https://github.com/veil-project/veil/blob/master/src/serialize.h): `src/serialize.h`
- [256-bit arithmetic](https://github.com/veil-project/veil/blob/master/src/arith_uint256.h): `src/arith_uint256.h`
- [secp256k1 API](https://github.com/veil-project/veil/blob/master/src/secp256k1/include/secp256k1.h): `src/secp256k1/include/secp256k1.h`
- [Elliptic-curve group](https://github.com/veil-project/veil/blob/master/src/secp256k1/src/group_impl.h): `src/secp256k1/src/group_impl.h`
- [Field arithmetic](https://github.com/veil-project/veil/blob/master/src/secp256k1/src/field_impl.h): `src/secp256k1/src/field_impl.h`
- [Scalar arithmetic](https://github.com/veil-project/veil/blob/master/src/secp256k1/src/scalar_impl.h): `src/secp256k1/src/scalar_impl.h`

### Other components

- **Wallet user**

## Connections

- Wallet user → Veil wallet UI: uses
- Veil wallet UI → Wallet engine: accesses
- Wallet RPC → Wallet engine: accesses
- Wallet engine → RingCT wallet: creates private transactions
- Wallet engine → Zerocoin wallet: creates private transactions
- RingCT wallet → Transactions: constructs
- Zerocoin wallet → Zerocoin protocol: uses
- Zerocoin protocol → Zerocoin arithmetic: uses
- Transactions → Peer networking: propagates
- Peer networking → Peer message processing: dispatches
- Peer message processing → Transaction validation: validates
- Transaction validation → Chain state: updates
- Mining → Proof of work: requests work
- Proof of work → RandomX: supports algorithm
- Proof of work → ProgPoW: supports algorithm
- Mining → Network budgeting: supports rewards
- LevelDB versions → LevelDB environment: uses environment (evidence: `src/leveldb/db/version_set.cc`)
- RandomX program → RandomX configuration: includes (evidence: `src/crypto/randomx/program.hpp`)
- RandomX program → RandomX endian helpers: loads data (evidence: `src/crypto/randomx/program.hpp`)
- RandomX configuration → RandomX endian helpers: includes (evidence: `src/crypto/randomx/common.hpp`)
- Scalar arithmetic → Elliptic-curve group: uses group types (evidence: `src/secp256k1/src/scalar_impl.h`)
- Elliptic-curve group → Field arithmetic: uses field operations (evidence: `src/secp256k1/src/group_impl.h`)
