# firecash/zkas-rusty architecture

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

- Interactive diagram: https://gitdiagram.com/firecash/zkas-rusty
- Repository: https://github.com/firecash/zkas-rusty

## Overview

ZKas is a privacy-focused Kaspa-derived BlockDAG node and tooling suite. The main workflow is node operation: peers exchange blocks, consensus validates and updates shielded state, and RPC serves wallets and miners. Wallet users sync shielded history and make payments through walletd; miners fetch templates, search proof-of-work, and submit blocks. The repository also includes an explorer API and a Stratum bridge. Edges use README statements or shown source references; unsampled implementation details are represented only at paths supported by the tree.

Main entry points: [`consensus/src/consensus`](https://github.com/firecash/zkas-rusty/tree/main/consensus/src/consensus) (Consensus engine), [`kaspad/src/daemon.rs`](https://github.com/firecash/zkas-rusty/blob/main/kaspad/src/daemon.rs) (Node runtime), [`miner/src/main.rs`](https://github.com/firecash/zkas-rusty/blob/main/miner/src/main.rs) (CPU miner), [`zkas-walletd/src/main.rs`](https://github.com/firecash/zkas-rusty/blob/main/zkas-walletd/src/main.rs) (Wallet daemon)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_node["Node and consensus"]
  node_kaspad["Node runtime<br/>[daemon.rs]"]
  node_p2p["Peer networking<br/>[router.rs]"]
  node_consensus["Consensus engine"]
  node_block_pipeline["Block processing<br/>[deps_manager.rs]"]
  node_consensus_storage[("Consensus storage<br/>[storage.rs]")]
  node_rpc["RPC service<br/>[service.rs]"]
end

subgraph group_privacy["Shielded transactions"]
  node_shielded_state["Shielded state<br/>[shielded.rs]"]
  node_orchard_core["Shielded primitives<br/>[lib.rs]"]
  node_script_engine["Script engine context<br/>[engine_context.rs]"]
end

subgraph group_wallet["Wallet and services"]
  node_walletd["Wallet daemon<br/>[main.rs]"]
  node_wallet_sdk["Wallet sync SDK<br/>[engine.rs]"]
  node_wallet_storage[("Wallet file storage<br/>[storage.rs]")]
  node_explorer_api["Explorer API<br/>[main.rs]"]
end

subgraph group_mining["Mining"]
  node_mining_manager["Mining manager<br/>[manager.rs]"]
  node_template_builder["Block template builder<br/>[builder.rs]"]
  node_mining_rules["Mining eligibility<br/>[rule_engine.rs]"]
  node_pow_aux["AuxPoW validation<br/>[auxpow.rs]"]
  node_cpu_miner["CPU miner<br/>[main.rs]"]
  node_miner_solver["Nonce search<br/>[solver.rs]"]
end

subgraph group_operations["Operations and tooling"]
  node_stratum_bridge["Stratum bridge<br/>[main.rs]"]
  node_bridge_shares["Share handling<br/>[share_handler.rs]"]
  node_wallet_cli["Shielded CLI wallet<br/>[main.rs]"]
end

node_operator(("Node operator"))
node_peers(("Network peers"))
node_wallet_user(("Wallet user"))
node_miner_operator(("Miner operator"))

node_operator -->|"runs"| node_kaspad
node_kaspad -->|"gossips blocks"| node_peers
node_peers -->|"exchange blocks"| node_p2p
node_kaspad -->|"serves RPC"| node_rpc
node_wallet_user -->|"uses REST"| node_walletd
node_walletd -->|"connects RPC"| node_rpc
node_walletd -.->|"syncs wallet"| node_wallet_sdk
node_wallet_sdk -.->|"persists state"| node_wallet_storage
node_kaspad -->|"validates blocks"| node_consensus
node_consensus -.->|"processes blocks"| node_block_pipeline
node_consensus -.->|"stores state"| node_consensus_storage
node_consensus -->|"maintains shielded state"| node_shielded_state
node_shielded_state -.->|"uses Orchard"| node_orchard_core
node_wallet_user -->|"queries explorer"| node_explorer_api
node_miner_operator -->|"runs"| node_cpu_miner
node_cpu_miner -->|"fetches templates and submits"| node_rpc
node_cpu_miner -->|"searches nonce"| node_miner_solver
node_cpu_miner -->|"supports merged mining"| node_pow_aux
node_consensus -->|"accepts AuxPoW"| node_pow_aux
node_mining_manager -.->|"builds templates"| node_template_builder
node_mining_manager -.->|"checks eligibility"| node_mining_rules
node_wallet_user -->|"makes payments"| node_wallet_cli

click node_kaspad "https://github.com/firecash/zkas-rusty/blob/main/kaspad/src/daemon.rs"
click node_p2p "https://github.com/firecash/zkas-rusty/blob/main/protocol/p2p/src/core/router.rs"
click node_consensus "https://github.com/firecash/zkas-rusty/tree/main/consensus/src/consensus"
click node_block_pipeline "https://github.com/firecash/zkas-rusty/blob/main/consensus/src/pipeline/deps_manager.rs"
click node_consensus_storage "https://github.com/firecash/zkas-rusty/blob/main/consensus/src/consensus/storage.rs"
click node_rpc "https://github.com/firecash/zkas-rusty/blob/main/rpc/service/src/service.rs"
click node_shielded_state "https://github.com/firecash/zkas-rusty/blob/main/consensus/src/processes/shielded.rs"
click node_orchard_core "https://github.com/firecash/zkas-rusty/blob/main/shielded-core/src/lib.rs"
click node_script_engine "https://github.com/firecash/zkas-rusty/blob/main/crypto/txscript/src/engine_context.rs"
click node_walletd "https://github.com/firecash/zkas-rusty/blob/main/zkas-walletd/src/main.rs"
click node_wallet_sdk "https://github.com/firecash/zkas-rusty/blob/main/sdk/core/src/engine.rs"
click node_wallet_storage "https://github.com/firecash/zkas-rusty/blob/main/wallet/core/src/storage/local/storage.rs"
click node_explorer_api "https://github.com/firecash/zkas-rusty/blob/main/zkas-api/src/main.rs"
click node_mining_manager "https://github.com/firecash/zkas-rusty/blob/main/mining/src/manager.rs"
click node_template_builder "https://github.com/firecash/zkas-rusty/blob/main/mining/src/block_template/builder.rs"
click node_mining_rules "https://github.com/firecash/zkas-rusty/blob/main/protocol/mining/src/rule_engine.rs"
click node_pow_aux "https://github.com/firecash/zkas-rusty/blob/main/consensus/core/src/auxpow.rs"
click node_cpu_miner "https://github.com/firecash/zkas-rusty/blob/main/miner/src/main.rs"
click node_miner_solver "https://github.com/firecash/zkas-rusty/blob/main/miner/src/solver.rs"
click node_stratum_bridge "https://github.com/firecash/zkas-rusty/blob/main/bridge/src/main.rs"
click node_bridge_shares "https://github.com/firecash/zkas-rusty/blob/main/bridge/src/share_handler.rs"
click node_wallet_cli "https://github.com/firecash/zkas-rusty/blob/main/shielded-pay/src/main.rs"

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_kaspad,node_p2p,node_consensus,node_block_pipeline,node_consensus_storage,node_rpc,node_wallet_user toneBlue
class node_shielded_state,node_orchard_core,node_script_engine toneAmber
class node_walletd,node_wallet_sdk,node_wallet_storage,node_explorer_api toneMint
class node_mining_manager,node_template_builder,node_mining_rules,node_pow_aux,node_cpu_miner,node_miner_solver toneRose
class node_stratum_bridge,node_bridge_shares,node_wallet_cli,node_operator,node_peers,node_miner_operator toneIndigo
```

## Components

### Node and consensus

- [Node runtime](https://github.com/firecash/zkas-rusty/blob/main/kaspad/src/daemon.rs): `kaspad/src/daemon.rs`
- [Peer networking](https://github.com/firecash/zkas-rusty/blob/main/protocol/p2p/src/core/router.rs): `protocol/p2p/src/core/router.rs`
- [Consensus engine](https://github.com/firecash/zkas-rusty/tree/main/consensus/src/consensus): `consensus/src/consensus`
- [Block processing](https://github.com/firecash/zkas-rusty/blob/main/consensus/src/pipeline/deps_manager.rs): `consensus/src/pipeline/deps_manager.rs`
- [Consensus storage](https://github.com/firecash/zkas-rusty/blob/main/consensus/src/consensus/storage.rs): `consensus/src/consensus/storage.rs`
- [RPC service](https://github.com/firecash/zkas-rusty/blob/main/rpc/service/src/service.rs): `rpc/service/src/service.rs`

### Shielded transactions

- [Shielded state](https://github.com/firecash/zkas-rusty/blob/main/consensus/src/processes/shielded.rs): `consensus/src/processes/shielded.rs`
- [Shielded primitives](https://github.com/firecash/zkas-rusty/blob/main/shielded-core/src/lib.rs): `shielded-core/src/lib.rs`
- [Script engine context](https://github.com/firecash/zkas-rusty/blob/main/crypto/txscript/src/engine_context.rs): `crypto/txscript/src/engine_context.rs`

### Wallet and services

- [Wallet daemon](https://github.com/firecash/zkas-rusty/blob/main/zkas-walletd/src/main.rs): `zkas-walletd/src/main.rs`
- [Wallet sync SDK](https://github.com/firecash/zkas-rusty/blob/main/sdk/core/src/engine.rs): `sdk/core/src/engine.rs`
- [Wallet file storage](https://github.com/firecash/zkas-rusty/blob/main/wallet/core/src/storage/local/storage.rs): `wallet/core/src/storage/local/storage.rs`
- [Explorer API](https://github.com/firecash/zkas-rusty/blob/main/zkas-api/src/main.rs): `zkas-api/src/main.rs`

### Mining

- [Mining manager](https://github.com/firecash/zkas-rusty/blob/main/mining/src/manager.rs): `mining/src/manager.rs`
- [Block template builder](https://github.com/firecash/zkas-rusty/blob/main/mining/src/block_template/builder.rs): `mining/src/block_template/builder.rs`
- [Mining eligibility](https://github.com/firecash/zkas-rusty/blob/main/protocol/mining/src/rule_engine.rs): `protocol/mining/src/rule_engine.rs`
- [AuxPoW validation](https://github.com/firecash/zkas-rusty/blob/main/consensus/core/src/auxpow.rs): `consensus/core/src/auxpow.rs`
- [CPU miner](https://github.com/firecash/zkas-rusty/blob/main/miner/src/main.rs): `miner/src/main.rs`
- [Nonce search](https://github.com/firecash/zkas-rusty/blob/main/miner/src/solver.rs): `miner/src/solver.rs`

### Operations and tooling

- [Stratum bridge](https://github.com/firecash/zkas-rusty/blob/main/bridge/src/main.rs): `bridge/src/main.rs`
- [Share handling](https://github.com/firecash/zkas-rusty/blob/main/bridge/src/share_handler.rs): `bridge/src/share_handler.rs`
- [Shielded CLI wallet](https://github.com/firecash/zkas-rusty/blob/main/shielded-pay/src/main.rs): `shielded-pay/src/main.rs`

### Other components

- **Node operator**
- **Network peers**
- **Wallet user**
- **Miner operator**

## Connections

- Node operator → Node runtime: runs (evidence: `README.md`)
- Node runtime → Network peers: gossips blocks (evidence: `README.md`)
- Network peers → Peer networking: exchange blocks (evidence: `README.md`)
- Node runtime → RPC service: serves RPC (evidence: `README.md`)
- Wallet user → Wallet daemon: uses REST (evidence: `README.md`)
- Wallet daemon → RPC service: connects RPC (evidence: `README.md`)
- Wallet daemon → Wallet sync SDK: syncs wallet
- Wallet sync SDK → Wallet file storage: persists state
- Node runtime → Consensus engine: validates blocks (evidence: `README.md`)
- Consensus engine → Block processing: processes blocks
- Consensus engine → Consensus storage: stores state (evidence: `consensus/src/consensus/storage.rs`)
- Consensus engine → Shielded state: maintains shielded state (evidence: `README.md`)
- Shielded state → Shielded primitives: uses Orchard
- Wallet user → Explorer API: queries explorer (evidence: `README.md`)
- Miner operator → CPU miner: runs (evidence: `README.md`)
- CPU miner → RPC service: fetches templates and submits (evidence: `README.md`)
- CPU miner → Nonce search: searches nonce (evidence: `miner/src/main.rs`)
- CPU miner → AuxPoW validation: supports merged mining (evidence: `README.md`)
- Consensus engine → AuxPoW validation: accepts AuxPoW (evidence: `README.md`)
- Mining manager → Block template builder: builds templates
- Mining manager → Mining eligibility: checks eligibility
- Wallet user → Shielded CLI wallet: makes payments (evidence: `README.md`)
