# plb500/picowallet architecture

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

- Interactive diagram: https://gitdiagram.com/plb500/picowallet
- Repository: https://github.com/plb500/picowallet

## Overview

PicoWallet is a Raspberry Pi Pico cold-wallet firmware. Its principal workflow is to load an encrypted wallet from SD, recover from a valid BIP39 phrase, or create a wallet; the user then browses derived keys and displays public addresses or private keys as QR codes. The graph preserves the README’s documented stages and capabilities. Some implementation files were not sampled, so those relationships are cited to the README rather than presented as inspected call paths.

Main entry points: [`pico/src/wallet_app/wallet_load.c`](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_load.c) (Wallet loading), [`pico/src/wallet_app/hd_wallet.c`](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/hd_wallet.c) (HD derivation), [`pico/src/wallet_app/wallet_app.c`](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_app.c) (App controller), [`pico/src/wallet_app/wallet_browse.c`](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_browse.c) (Hierarchy browsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Wallet application"]
  node_firmware["Firmware entry<br/>[pico_wallet.c]"]
  node_appflow["App controller<br/>[wallet_app.c]"]
  node_loading["Wallet loading<br/>[wallet_load.c]"]
  node_browse["Hierarchy browsing<br/>[wallet_browse.c]"]
end

subgraph group_wallet["Wallet domain"]
  node_hd["HD derivation<br/>[hd_wallet.c]"]
  node_seed["Seed and mnemonic<br/>[seed_utils.c]"]
  node_keys["Key utilities<br/>[key_utils.c]"]
  node_keyformat["Address formatting<br/>[key_print_utils.c]"]
  node_crypto["Wallet cryptography<br/>[wallet_file.c]"]
end

subgraph group_storage["SD storage"]
  node_walletfile["Wallet file<br/>[wallet_file.c]"]
  node_filesystem["FAT filesystem<br/>[ff.c]"]
  node_sd["SD card driver<br/>[sd_card.c]"]
  node_sdcard[("SD card")]
end

subgraph group_interface["Device interface"]
  node_screens["Wallet screens<br/>[wallet_screen.c]"]
  node_mnemonicscreen["Mnemonic display"]
  node_qrscreen["QR display<br/>[qr_code_screen.c]"]
  node_qrcode["QR encoding<br/>[qrcode.c]"]
  node_lcd["LCD rendering<br/>[LCD_1in44.c]"]
end

node_user(("Wallet user"))

node_user -->|"operates"| node_firmware
node_firmware -.->|"starts"| node_appflow
node_appflow -.->|"loads wallet"| node_loading
node_loading -->|"checks and saves"| node_walletfile
node_loading -->|"recovers phrase"| node_seed
node_loading -->|"unlocks or encrypts"| node_crypto
node_walletfile -.->|"uses"| node_filesystem
node_filesystem -.->|"accesses sectors"| node_sd
node_sd -.->|"reads and writes"| node_sdcard
node_loading -->|"provides wallet"| node_hd
node_seed -.->|"seeds derivation"| node_hd
node_hd -.->|"derives keys"| node_keys
node_user -->|"selects hierarchy"| node_browse
node_browse -->|"selects derived level"| node_hd
node_browse -->|"requests key display"| node_keyformat
node_keyformat -->|"displays key as QR"| node_qrscreen
node_qrscreen -.->|"encodes QR"| node_qrcode
node_appflow -.->|"presents screens"| node_screens
node_screens -.->|"renders interface"| node_lcd
node_loading -->|"shows recovery phrase"| node_mnemonicscreen

click node_firmware "https://github.com/plb500/picowallet/blob/main/pico/src/pico_wallet.c"
click node_appflow "https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_app.c"
click node_loading "https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_load.c"
click node_browse "https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_browse.c"
click node_hd "https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/hd_wallet.c"
click node_seed "https://github.com/plb500/picowallet/blob/main/pico/src/utils/seed_utils.c"
click node_keys "https://github.com/plb500/picowallet/blob/main/pico/src/utils/key_utils.c"
click node_keyformat "https://github.com/plb500/picowallet/blob/main/pico/src/utils/key_print_utils.c"
click node_crypto "https://github.com/plb500/picowallet/blob/main/pico/src/utils/wallet_file.c"
click node_walletfile "https://github.com/plb500/picowallet/blob/main/pico/src/utils/wallet_file.c"
click node_filesystem "https://github.com/plb500/picowallet/blob/main/pico/src/3rdParty/FatFs_SPI/ff15/source/ff.c"
click node_sd "https://github.com/plb500/picowallet/blob/main/pico/src/3rdParty/FatFs_SPI/sd_driver/sd_card.c"
click node_screens "https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/screens/wallet_screen.c"
click node_mnemonicscreen "https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/screens/mnemonic_display_screen.c"
click node_qrscreen "https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/screens/qr_code_screen.c"
click node_qrcode "https://github.com/plb500/picowallet/blob/main/pico/src/3rdParty/qrcode/qrcode.c"
click node_lcd "https://github.com/plb500/picowallet/blob/main/pico/src/3rdParty/waveshare_lcd/lib/LCD/LCD_1in44.c"

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_firmware,node_appflow,node_loading,node_browse,node_user toneBlue
class node_hd,node_seed,node_keys,node_keyformat,node_crypto toneAmber
class node_walletfile,node_filesystem,node_sd,node_sdcard toneMint
class node_screens,node_mnemonicscreen,node_qrscreen,node_qrcode,node_lcd toneRose
```

## Components

### Wallet application

- [Firmware entry](https://github.com/plb500/picowallet/blob/main/pico/src/pico_wallet.c): `pico/src/pico_wallet.c`
- [App controller](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_app.c): `pico/src/wallet_app/wallet_app.c`
- [Wallet loading](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_load.c): `pico/src/wallet_app/wallet_load.c`
- [Hierarchy browsing](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/wallet_browse.c): `pico/src/wallet_app/wallet_browse.c`

### Wallet domain

- [HD derivation](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/hd_wallet.c): `pico/src/wallet_app/hd_wallet.c`
- [Seed and mnemonic](https://github.com/plb500/picowallet/blob/main/pico/src/utils/seed_utils.c): `pico/src/utils/seed_utils.c`
- [Key utilities](https://github.com/plb500/picowallet/blob/main/pico/src/utils/key_utils.c): `pico/src/utils/key_utils.c`
- [Address formatting](https://github.com/plb500/picowallet/blob/main/pico/src/utils/key_print_utils.c): `pico/src/utils/key_print_utils.c`
- [Wallet cryptography](https://github.com/plb500/picowallet/blob/main/pico/src/utils/wallet_file.c): `pico/src/utils/wallet_file.c`

### SD storage

- [Wallet file](https://github.com/plb500/picowallet/blob/main/pico/src/utils/wallet_file.c): `pico/src/utils/wallet_file.c`
- [FAT filesystem](https://github.com/plb500/picowallet/blob/main/pico/src/3rdParty/FatFs_SPI/ff15/source/ff.c): `pico/src/3rdParty/FatFs_SPI/ff15/source/ff.c`
- [SD card driver](https://github.com/plb500/picowallet/blob/main/pico/src/3rdParty/FatFs_SPI/sd_driver/sd_card.c): `pico/src/3rdParty/FatFs_SPI/sd_driver/sd_card.c`
- **SD card**

### Device interface

- [Wallet screens](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/screens/wallet_screen.c): `pico/src/wallet_app/screens/wallet_screen.c`
- [Mnemonic display](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/screens/mnemonic_display_screen.c): `pico/src/wallet_app/screens/mnemonic_display_screen.c`
- [QR display](https://github.com/plb500/picowallet/blob/main/pico/src/wallet_app/screens/qr_code_screen.c): `pico/src/wallet_app/screens/qr_code_screen.c`
- [QR encoding](https://github.com/plb500/picowallet/blob/main/pico/src/3rdParty/qrcode/qrcode.c): `pico/src/3rdParty/qrcode/qrcode.c`
- [LCD rendering](https://github.com/plb500/picowallet/blob/main/pico/src/3rdParty/waveshare_lcd/lib/LCD/LCD_1in44.c): `pico/src/3rdParty/waveshare_lcd/lib/LCD/LCD_1in44.c`

### Other components

- **Wallet user**

## Connections

- Wallet user → Firmware entry: operates (evidence: `README.md`)
- Firmware entry → App controller: starts
- App controller → Wallet loading: loads wallet
- Wallet loading → Wallet file: checks and saves (evidence: `pico/src/wallet_app/wallet_load.c`)
- Wallet loading → Seed and mnemonic: recovers phrase (evidence: `README.md`)
- Wallet loading → Wallet cryptography: unlocks or encrypts (evidence: `README.md`)
- Wallet file → FAT filesystem: uses
- FAT filesystem → SD card driver: accesses sectors
- SD card driver → SD card: reads and writes
- Wallet loading → HD derivation: provides wallet (evidence: `README.md`)
- Seed and mnemonic → HD derivation: seeds derivation
- HD derivation → Key utilities: derives keys
- Wallet user → Hierarchy browsing: selects hierarchy (evidence: `README.md`)
- Hierarchy browsing → HD derivation: selects derived level (evidence: `README.md`)
- Hierarchy browsing → Address formatting: requests key display (evidence: `README.md`)
- Address formatting → QR display: displays key as QR (evidence: `README.md`)
- QR display → QR encoding: encodes QR
- App controller → Wallet screens: presents screens
- Wallet screens → LCD rendering: renders interface
- Wallet loading → Mnemonic display: shows recovery phrase (evidence: `README.md`)
