# blockstream/green_qt architecture

> Architecture diagram of the GitHub repository blockstream/green_qt, 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/blockstream/green_qt
- Repository: https://github.com/blockstream/green_qt

## Overview

Blockstream Green is a non-custodial Bitcoin desktop wallet. The user-facing journey is wallet login or creation, account and network access, then sending or receiving funds; the source tree also shows Lightning, swaps, watch-only access, and hardware-wallet support. The graph separates wallet/session state, transaction capabilities, and device integrations. Several subsystem paths are identified from the tree, but their behavior was not sampled, so unsupported connections are omitted rather than inferred.

Main entry points: [`src/loginwithpincontroller.cpp`](https://github.com/blockstream/green_qt/blob/master/src/loginwithpincontroller.cpp) (Wallet login), [`src/createaccountcontroller.cpp`](https://github.com/blockstream/green_qt/blob/master/src/createaccountcontroller.cpp) (Account creation), [`src/lightning/lightningsendcontroller.cpp`](https://github.com/blockstream/green_qt/blob/master/src/lightning/lightningsendcontroller.cpp) (Lightning payments), [`src/models/walletmanager.cpp`](https://github.com/blockstream/green_qt/blob/master/src/models/walletmanager.cpp) (Wallet registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_desktop["Desktop application<br/>[application.cpp]"]
end

subgraph group_wallet["Wallet and sessions"]
  node_wallets["Wallet registry<br/>[walletmanager.cpp]"]
  node_wallet["Wallet state<br/>[wallet.h]"]
  node_login["Wallet login"]
  node_context["Wallet context<br/>[context.cpp]"]
  node_sessions["Network sessions<br/>[session.h]"]
  node_network["Network configuration<br/>[network.h]"]
  node_accounts["Wallet accounts<br/>[account.h]"]
  node_create_account["Account creation"]
end

subgraph group_transactions["Payments and transactions"]
  node_transactions_core["Transaction state<br/>[transaction.h]"]
  node_send_receive["Send and receive"]
  node_lightning["Lightning payments"]
  node_swaps["Bitcoin swaps"]
end

subgraph group_integrations["Wallet integrations"]
  node_hardware["Hardware devices<br/>[device.cpp]"]
  node_jade["Jade device support<br/>[jadedevice.h]"]
  node_ledger["Ledger support<br/>[ledgerdevice.cpp]"]
  node_amp2["AMP2 accounts"]
  node_lwk["LWK wallet engine<br/>[lwk.cpp]"]
end

node_user(("Wallet user"))

node_user -->|"uses"| node_desktop
node_desktop -.->|"manages"| node_wallets
node_login -->|"updates"| node_wallet
node_login -->|"registers"| node_wallets
node_login -->|"loads"| node_context
node_login -->|"uses"| node_sessions
node_wallets -->|"manages"| node_wallet
node_wallets -->|"uses"| node_network
node_create_account -->|"creates"| node_accounts
node_create_account -->|"uses"| node_wallet
node_create_account -->|"uses"| node_context
node_create_account -->|"uses"| node_sessions
node_lightning -->|"reads"| node_context
node_lightning -->|"uses"| node_accounts
node_lightning -->|"uses"| node_wallet
node_lightning -->|"uses"| node_sessions
node_swaps -->|"uses"| node_context
node_swaps -->|"uses"| node_lwk
node_jade -->|"implements"| node_hardware
node_amp2 -->|"uses"| node_lwk

click node_desktop "https://github.com/blockstream/green_qt/blob/master/src/application.cpp"
click node_wallets "https://github.com/blockstream/green_qt/blob/master/src/models/walletmanager.cpp"
click node_wallet "https://github.com/blockstream/green_qt/blob/master/src/models/wallet.h"
click node_login "https://github.com/blockstream/green_qt/blob/master/src/loginwithpincontroller.cpp"
click node_context "https://github.com/blockstream/green_qt/blob/master/src/models/context.cpp"
click node_sessions "https://github.com/blockstream/green_qt/blob/master/src/session.h"
click node_network "https://github.com/blockstream/green_qt/blob/master/src/network.h"
click node_accounts "https://github.com/blockstream/green_qt/blob/master/src/models/account.h"
click node_create_account "https://github.com/blockstream/green_qt/blob/master/src/createaccountcontroller.cpp"
click node_transactions_core "https://github.com/blockstream/green_qt/blob/master/src/models/transaction.h"
click node_send_receive "https://github.com/blockstream/green_qt/blob/master/src/createtransactioncontroller.cpp"
click node_lightning "https://github.com/blockstream/green_qt/blob/master/src/lightning/lightningsendcontroller.cpp"
click node_swaps "https://github.com/blockstream/green_qt/blob/master/src/submarinecontroller.cpp"
click node_hardware "https://github.com/blockstream/green_qt/blob/master/src/device.cpp"
click node_jade "https://github.com/blockstream/green_qt/blob/master/src/jade/jadedevice.h"
click node_ledger "https://github.com/blockstream/green_qt/blob/master/src/ledger/ledgerdevice.cpp"
click node_amp2 "https://github.com/blockstream/green_qt/blob/master/src/controllers/lwkamp2accountcontroller.cpp"
click node_lwk "https://github.com/blockstream/green_qt/blob/master/src/lwk/lwk.cpp"

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_desktop,node_user toneBlue
class node_wallets,node_wallet,node_login,node_context,node_sessions,node_network,node_accounts,node_create_account toneAmber
class node_transactions_core,node_send_receive,node_lightning,node_swaps toneMint
class node_hardware,node_jade,node_ledger,node_amp2,node_lwk toneRose
```

## Components

### Application

- [Desktop application](https://github.com/blockstream/green_qt/blob/master/src/application.cpp): `src/application.cpp`

### Wallet and sessions

- [Wallet registry](https://github.com/blockstream/green_qt/blob/master/src/models/walletmanager.cpp): `src/models/walletmanager.cpp`
- [Wallet state](https://github.com/blockstream/green_qt/blob/master/src/models/wallet.h): `src/models/wallet.h`
- [Wallet login](https://github.com/blockstream/green_qt/blob/master/src/loginwithpincontroller.cpp): `src/loginwithpincontroller.cpp`
- [Wallet context](https://github.com/blockstream/green_qt/blob/master/src/models/context.cpp): `src/models/context.cpp`
- [Network sessions](https://github.com/blockstream/green_qt/blob/master/src/session.h): `src/session.h`
- [Network configuration](https://github.com/blockstream/green_qt/blob/master/src/network.h): `src/network.h`
- [Wallet accounts](https://github.com/blockstream/green_qt/blob/master/src/models/account.h): `src/models/account.h`
- [Account creation](https://github.com/blockstream/green_qt/blob/master/src/createaccountcontroller.cpp): `src/createaccountcontroller.cpp`

### Payments and transactions

- [Transaction state](https://github.com/blockstream/green_qt/blob/master/src/models/transaction.h): `src/models/transaction.h`
- [Send and receive](https://github.com/blockstream/green_qt/blob/master/src/createtransactioncontroller.cpp): `src/createtransactioncontroller.cpp`
- [Lightning payments](https://github.com/blockstream/green_qt/blob/master/src/lightning/lightningsendcontroller.cpp): `src/lightning/lightningsendcontroller.cpp`
- [Bitcoin swaps](https://github.com/blockstream/green_qt/blob/master/src/submarinecontroller.cpp): `src/submarinecontroller.cpp`

### Wallet integrations

- [Hardware devices](https://github.com/blockstream/green_qt/blob/master/src/device.cpp): `src/device.cpp`
- [Jade device support](https://github.com/blockstream/green_qt/blob/master/src/jade/jadedevice.h): `src/jade/jadedevice.h`
- [Ledger support](https://github.com/blockstream/green_qt/blob/master/src/ledger/ledgerdevice.cpp): `src/ledger/ledgerdevice.cpp`
- [AMP2 accounts](https://github.com/blockstream/green_qt/blob/master/src/controllers/lwkamp2accountcontroller.cpp): `src/controllers/lwkamp2accountcontroller.cpp`
- [LWK wallet engine](https://github.com/blockstream/green_qt/blob/master/src/lwk/lwk.cpp): `src/lwk/lwk.cpp`

### Other components

- **Wallet user**

## Connections

- Wallet user → Desktop application: uses
- Desktop application → Wallet registry: manages
- Wallet login → Wallet state: updates (evidence: `src/loginwithpincontroller.cpp`)
- Wallet login → Wallet registry: registers (evidence: `src/loginwithpincontroller.cpp`)
- Wallet login → Wallet context: loads (evidence: `src/loginwithpincontroller.cpp`)
- Wallet login → Network sessions: uses (evidence: `src/loginwithpincontroller.cpp`)
- Wallet registry → Wallet state: manages (evidence: `src/models/walletmanager.cpp`)
- Wallet registry → Network configuration: uses (evidence: `src/models/walletmanager.cpp`)
- Account creation → Wallet accounts: creates (evidence: `src/createaccountcontroller.cpp`)
- Account creation → Wallet state: uses (evidence: `src/createaccountcontroller.cpp`)
- Account creation → Wallet context: uses (evidence: `src/createaccountcontroller.cpp`)
- Account creation → Network sessions: uses (evidence: `src/createaccountcontroller.cpp`)
- Lightning payments → Wallet context: reads (evidence: `src/lightning/lightningsendcontroller.cpp`)
- Lightning payments → Wallet accounts: uses (evidence: `src/lightning/lightningsendcontroller.cpp`)
- Lightning payments → Wallet state: uses (evidence: `src/lightning/lightningsendcontroller.cpp`)
- Lightning payments → Network sessions: uses
- Bitcoin swaps → Wallet context: uses (evidence: `src/submarinecontroller.cpp`)
- Bitcoin swaps → LWK wallet engine: uses (evidence: `src/submarinecontroller.cpp`)
- Jade device support → Hardware devices: implements (evidence: `src/jade/jadedevice.h`)
- AMP2 accounts → LWK wallet engine: uses
