# darkrenaissance/darkfi architecture

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

- Interactive diagram: https://gitdiagram.com/darkrenaissance/darkfi
- Repository: https://github.com/darkrenaissance/darkfi

## Overview

DarkFi is an anonymous Layer 1 blockchain and application ecosystem. The main user workflow is a wallet constructing or managing a transaction, submitting it to a full node, and having the node validate and persist blockchain state; the README documents these roles, while the precise wallet-to-node RPC wiring is not shown in the sampled source. The repository also includes P2P networking, private contracts and ZK execution, event-graph services, an IRC daemon, and a graphical app. Unsampled subsystems are included where README or the source index establishes their importance; unverified links are dashed.

Main entry points: [`bin/darkfid/src/main.rs`](https://github.com/darkrenaissance/darkfi/blob/master/bin/darkfid/src/main.rs) (Full node), [`bin/drk/src/main.rs`](https://github.com/darkrenaissance/darkfi/blob/master/bin/drk/src/main.rs) (CLI wallet), [`src/net/mod.rs`](https://github.com/darkrenaissance/darkfi/blob/master/src/net/mod.rs) (P2P networking), [`bin/app/src/main.rs`](https://github.com/darkrenaissance/darkfi/blob/master/bin/app/src/main.rs) (Graphical app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wallet["Wallet and app"]
  node_walletcli["CLI wallet<br/>[main.rs]"]
  node_gui["Graphical app<br/>[main.rs]"]
  node_appnode["App node integration<br/>[node.rs]"]
  node_gfx["Graphics and favicon<br/>[favico.rs]"]
end

subgraph group_node["Node and chain"]
  node_fullnode["Full node<br/>[main.rs]"]
  node_rpc["JSON-RPC server<br/>[server.rs]"]
  node_validator["Transaction validation<br/>[verification.rs]"]
  node_consensus["Consensus and PoW<br/>[consensus.rs]"]
  node_pow["Mining PoW<br/>[pow.rs]"]
  node_chain[("Blockchain storage<br/>[mod.rs]")]
end

subgraph group_privacy["Privacy and contracts"]
  node_walletcontracts["Wallet contract APIs"]
  node_money["Money contract<br/>[entrypoint.rs]"]
  node_dao["DAO contract"]
  node_zkvm["ZK virtual machine<br/>[vm.rs]"]
  node_events[("Event graph<br/>[mod.rs]")]
  node_eventproto["Event protocols<br/>[proto.rs]"]
  node_eventrln["RLN privacy<br/>[rln.rs]"]
end

subgraph group_network["Network and services"]
  node_p2p["P2P networking<br/>[mod.rs]"]
  node_channel["Network channels<br/>[channel.rs]"]
  node_hosts["Peer hosts<br/>[hosts.rs]"]
  node_dht["DHT service<br/>[mod.rs]"]
  node_darkirc["P2P IRC daemon<br/>[main.rs]"]
  node_geode[("Geode storage<br/>[file_sequence.rs]")]
  node_tau["Tau service RPC<br/>[jsonrpc.rs]"]
end

node_user(("Wallet user"))

node_user -->|"uses"| node_walletcli
node_walletcli -.->|"submits transactions"| node_fullnode
node_walletcli -->|"scans balances"| node_chain
node_walletcli -->|"uses contract APIs"| node_walletcontracts
node_fullnode -->|"validates transactions"| node_validator
node_fullnode -->|"connects to network"| node_p2p
node_fullnode -->|"mines blocks"| node_pow
node_validator -.->|"checks consensus"| node_consensus
node_validator -->|"reads and writes"| node_chain
node_consensus -.->|"uses PoW"| node_pow
node_fullnode -.->|"serves RPC"| node_rpc
node_walletcontracts -.->|"builds transactions"| node_money
node_walletcontracts -.->|"builds transactions"| node_dao
node_money -.->|"executes privately"| node_zkvm
node_dao -.->|"executes privately"| node_zkvm
node_events -->|"uses protocols"| node_eventproto
node_events -->|"uses RLN"| node_eventrln
node_p2p -->|"dispatches messages"| node_channel
node_p2p -->|"tracks peers"| node_hosts
node_p2p -.->|"supports discovery"| node_dht
node_user -.->|"uses"| node_gui
node_gui -->|"integrates node"| node_appnode
node_gui -.->|"renders interface"| node_gfx

click node_walletcli "https://github.com/darkrenaissance/darkfi/blob/master/bin/drk/src/main.rs"
click node_gui "https://github.com/darkrenaissance/darkfi/blob/master/bin/app/src/main.rs"
click node_appnode "https://github.com/darkrenaissance/darkfi/blob/master/bin/app/src/app/node.rs"
click node_gfx "https://github.com/darkrenaissance/darkfi/blob/master/bin/app/src/gfx/favico.rs"
click node_fullnode "https://github.com/darkrenaissance/darkfi/blob/master/bin/darkfid/src/main.rs"
click node_rpc "https://github.com/darkrenaissance/darkfi/blob/master/src/rpc/server.rs"
click node_validator "https://github.com/darkrenaissance/darkfi/blob/master/src/validator/verification.rs"
click node_consensus "https://github.com/darkrenaissance/darkfi/blob/master/src/validator/consensus.rs"
click node_pow "https://github.com/darkrenaissance/darkfi/blob/master/src/validator/pow.rs"
click node_chain "https://github.com/darkrenaissance/darkfi/blob/master/src/blockchain/mod.rs"
click node_walletcontracts "https://github.com/darkrenaissance/darkfi/tree/master/src/sdk/python/src/contract"
click node_money "https://github.com/darkrenaissance/darkfi/blob/master/src/contract/money/src/entrypoint.rs"
click node_dao "https://github.com/darkrenaissance/darkfi/tree/master/src/contract/dao/src/entrypoint"
click node_zkvm "https://github.com/darkrenaissance/darkfi/blob/master/src/zk/vm.rs"
click node_events "https://github.com/darkrenaissance/darkfi/blob/master/src/event_graph/mod.rs"
click node_eventproto "https://github.com/darkrenaissance/darkfi/blob/master/src/event_graph/proto.rs"
click node_eventrln "https://github.com/darkrenaissance/darkfi/blob/master/src/event_graph/rln.rs"
click node_p2p "https://github.com/darkrenaissance/darkfi/blob/master/src/net/mod.rs"
click node_channel "https://github.com/darkrenaissance/darkfi/blob/master/src/net/channel.rs"
click node_hosts "https://github.com/darkrenaissance/darkfi/blob/master/src/net/hosts.rs"
click node_dht "https://github.com/darkrenaissance/darkfi/blob/master/src/dht/mod.rs"
click node_darkirc "https://github.com/darkrenaissance/darkfi/blob/master/bin/darkirc/src/main.rs"
click node_geode "https://github.com/darkrenaissance/darkfi/blob/master/src/geode/file_sequence.rs"
click node_tau "https://github.com/darkrenaissance/darkfi/blob/master/bin/tau/taud/src/jsonrpc.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_walletcli,node_gui,node_appnode,node_gfx,node_user toneBlue
class node_fullnode,node_rpc,node_validator,node_consensus,node_pow,node_chain toneAmber
class node_walletcontracts,node_money,node_dao,node_zkvm,node_events,node_eventproto,node_eventrln toneMint
class node_p2p,node_channel,node_hosts,node_dht,node_darkirc,node_geode,node_tau toneRose
```

## Components

### Wallet and app

- [CLI wallet](https://github.com/darkrenaissance/darkfi/blob/master/bin/drk/src/main.rs): `bin/drk/src/main.rs`
- [Graphical app](https://github.com/darkrenaissance/darkfi/blob/master/bin/app/src/main.rs): `bin/app/src/main.rs`
- [App node integration](https://github.com/darkrenaissance/darkfi/blob/master/bin/app/src/app/node.rs): `bin/app/src/app/node.rs`
- [Graphics and favicon](https://github.com/darkrenaissance/darkfi/blob/master/bin/app/src/gfx/favico.rs): `bin/app/src/gfx/favico.rs`

### Node and chain

- [Full node](https://github.com/darkrenaissance/darkfi/blob/master/bin/darkfid/src/main.rs): `bin/darkfid/src/main.rs`
- [JSON-RPC server](https://github.com/darkrenaissance/darkfi/blob/master/src/rpc/server.rs): `src/rpc/server.rs`
- [Transaction validation](https://github.com/darkrenaissance/darkfi/blob/master/src/validator/verification.rs): `src/validator/verification.rs`
- [Consensus and PoW](https://github.com/darkrenaissance/darkfi/blob/master/src/validator/consensus.rs): `src/validator/consensus.rs`
- [Mining PoW](https://github.com/darkrenaissance/darkfi/blob/master/src/validator/pow.rs): `src/validator/pow.rs`
- [Blockchain storage](https://github.com/darkrenaissance/darkfi/blob/master/src/blockchain/mod.rs): `src/blockchain/mod.rs`

### Privacy and contracts

- [Wallet contract APIs](https://github.com/darkrenaissance/darkfi/tree/master/src/sdk/python/src/contract): `src/sdk/python/src/contract`
- [Money contract](https://github.com/darkrenaissance/darkfi/blob/master/src/contract/money/src/entrypoint.rs): `src/contract/money/src/entrypoint.rs`
- [DAO contract](https://github.com/darkrenaissance/darkfi/tree/master/src/contract/dao/src/entrypoint): `src/contract/dao/src/entrypoint`
- [ZK virtual machine](https://github.com/darkrenaissance/darkfi/blob/master/src/zk/vm.rs): `src/zk/vm.rs`
- [Event graph](https://github.com/darkrenaissance/darkfi/blob/master/src/event_graph/mod.rs): `src/event_graph/mod.rs`
- [Event protocols](https://github.com/darkrenaissance/darkfi/blob/master/src/event_graph/proto.rs): `src/event_graph/proto.rs`
- [RLN privacy](https://github.com/darkrenaissance/darkfi/blob/master/src/event_graph/rln.rs): `src/event_graph/rln.rs`

### Network and services

- [P2P networking](https://github.com/darkrenaissance/darkfi/blob/master/src/net/mod.rs): `src/net/mod.rs`
- [Network channels](https://github.com/darkrenaissance/darkfi/blob/master/src/net/channel.rs): `src/net/channel.rs`
- [Peer hosts](https://github.com/darkrenaissance/darkfi/blob/master/src/net/hosts.rs): `src/net/hosts.rs`
- [DHT service](https://github.com/darkrenaissance/darkfi/blob/master/src/dht/mod.rs): `src/dht/mod.rs`
- [P2P IRC daemon](https://github.com/darkrenaissance/darkfi/blob/master/bin/darkirc/src/main.rs): `bin/darkirc/src/main.rs`
- [Geode storage](https://github.com/darkrenaissance/darkfi/blob/master/src/geode/file_sequence.rs): `src/geode/file_sequence.rs`
- [Tau service RPC](https://github.com/darkrenaissance/darkfi/blob/master/bin/tau/taud/src/jsonrpc.rs): `bin/tau/taud/src/jsonrpc.rs`

### Other components

- **Wallet user**

## Connections

- Wallet user → CLI wallet: uses (evidence: `README.md`)
- CLI wallet → Full node: submits transactions
- CLI wallet → Blockchain storage: scans balances (evidence: `README.md`)
- CLI wallet → Wallet contract APIs: uses contract APIs (evidence: `README.md`)
- Full node → Transaction validation: validates transactions (evidence: `README.md`)
- Full node → P2P networking: connects to network (evidence: `README.md`)
- Full node → Mining PoW: mines blocks (evidence: `README.md`)
- Transaction validation → Consensus and PoW: checks consensus
- Transaction validation → Blockchain storage: reads and writes
- Consensus and PoW → Mining PoW: uses PoW
- Full node → JSON-RPC server: serves RPC
- Wallet contract APIs → Money contract: builds transactions
- Wallet contract APIs → DAO contract: builds transactions
- Money contract → ZK virtual machine: executes privately
- DAO contract → ZK virtual machine: executes privately
- Event graph → Event protocols: uses protocols (evidence: `src/event_graph/mod.rs`)
- Event graph → RLN privacy: uses RLN (evidence: `src/event_graph/mod.rs`)
- P2P networking → Network channels: dispatches messages (evidence: `src/net/mod.rs`)
- P2P networking → Peer hosts: tracks peers (evidence: `src/net/mod.rs`)
- P2P networking → DHT service: supports discovery
- Wallet user → Graphical app: uses
- Graphical app → App node integration: integrates node (evidence: `bin/app/src/main.rs`)
- Graphical app → Graphics and favicon: renders interface
