# horizontalsystems/unstoppable-wallet-android architecture

> Architecture diagram of the GitHub repository horizontalsystems/unstoppable-wallet-android, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/horizontalsystems/unstoppable-wallet-android
- Repository: https://github.com/horizontalsystems/unstoppable-wallet-android

## Overview

##### Project type and purpose
- This is a multi-module Android application (“Unstoppable Wallet”) written in Kotlin.
- It’s a non-custodial crypto wallet supporting multiple blockchains with on-chain swaps, analytics, privacy (Tor), local storage, and in-app subscriptions.

##### File structure
- Top-level modules:
- app – the Android application module (Activities, Fragments, Compose UIs, feature “modules”, ViewModels).
- core – shared application-wide logic (encryption, background manager, common helpers).
- subscriptions-* modules – in-app billing integration variants and core subscription logic.
- build & deployment: Gradle scripts, Docker, Fastlane, GitHub Actions workflows.

- Within app/src/main/java/io/horizontalsystems/bankwallet:
- core (App initialization, logging, base classes)
- adapters (blockchain adapters for Bitcoin, EVM chains, Solana, Tron, Zcash, NFT)
- managers (account, network, token, market-data, Tor, etc.)
- providers (RPC services, price feeds, NFT providers)
- storage (Room database, DAOs, migrations)
- modules/… – feature-oriented MVVM blocks (Fragment, Module, Service, ViewModel, UI)
- ui/compose – Jetpack Compose component library
- tor – Tor control and utilities

##### Insights from README
- Emphasis on “user is in control”, “non-custodial”, “decentralized swaps”, “institutional-grade analytics”.
- Targets Android 8.1+; MIT licensed; CI for pull requests and releases.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        ComposeUI["Jetpack Compose UIs"]:::presentation
        Activities["Activities & Fragments"]:::presentation
        BalanceVM["BalanceViewModel"]:::presentation
        TorModule["TorConnectionModule"]:::presentation
        TorVM["TorConnectionViewModel"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain / Business Logic"
        direction TB
        AccountMgr["AccountManager"]:::domain
        BalanceSvc["BalanceService"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        EvmAdapter["EvmAdapter"]:::data
        FeeProvider["FeeRateProvider"]:::data
        AppDB["AppDatabase"]:::data
        AccountsDao["AccountsDao"]:::data
        TorCore["Tor"]:::data
    end

    %% Shared Libraries
    subgraph "Shared Libraries"
        direction TB
        ChartLib["Chart Components"]:::shared
        IconLib["Icon Set"]:::shared
        SubCore["subscriptions-core"]:::shared
        SubPlay["SubscriptionServiceGooglePlay"]:::shared
        SubFDroid["SubscriptionServiceFDroid"]:::shared
        SubDev["SubscriptionServiceDev"]:::shared
    end

    %% External Systems
    subgraph "External Services"
        direction TB
        BlockchainRPC["Blockchain RPC Nodes"]:::external
        MarketAPI["Market Data APIs"]:::external
        TorNet["Tor Network"]:::external
        PlayStore["Google Play / F-Droid"]:::external
        InAppBilling["In-App Billing"]:::external
    end

    %% Build & CI
    subgraph "Build & CI Pipeline"
        direction TB
        GHActions["GitHub Actions"]:::external
        DockerBuild["Docker Build Scripts"]:::external
        Fastlane["Fastlane Deployment"]:::external
    end

    %% Connections Presentation -> Domain -> Data -> External
    ComposeUI -->|"uses"| BalanceVM
    Activities -->|"uses"| BalanceVM
    BalanceVM -->|"calls"| BalanceSvc
    TorModule -->|"binds"| TorVM

    BalanceSvc -->|"uses"| AccountMgr
    BalanceSvc -->|"calls"| EvmAdapter
    BalanceSvc -->|"calls"| FeeProvider
    BalanceSvc -->|"reads/writes"| AppDB

    EvmAdapter -->|"requests via"| TorCore
    TorCore -->|"connects to"| TorNet
    TorCore -->|"forwards RPC to"| BlockchainRPC

    FeeProvider -->|"fetches from"| MarketAPI

    AppDB -->|"exposed DAOs"| AccountsDao
    AccountsDao -->|"CRUD ops"| AppDB

    %% Shared Libraries imported by app
    ComposeUI --> ChartLib
    ComposeUI --> IconLib
    BalanceSvc --> SubCore
    BalanceSvc --> SubPlay
    BalanceSvc --> SubFDroid
    BalanceSvc --> SubDev

    %% CI Pipeline
    GHActions --> DockerBuild
    DockerBuild --> Fastlane
    Fastlane --> PlayStore
    Fastlane --> InAppBilling

    %% Click Events
    click ComposeUI "https://github.com/horizontalsystems/unstoppable-wallet-android/tree/master/app/src/main/java/io/horizontalsystems/bankwallet/ui/compose"
    click Activities "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainActivity.kt"
    click BalanceVM "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/BalanceViewModel.kt"
    click AccountMgr "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/AccountManager.kt"
    click BalanceSvc "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/BalanceService.kt"
    click EvmAdapter "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/core/adapters/EvmAdapter.kt"
    click FeeProvider "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/core/providers/FeeRateProvider.kt"
    click AppDB "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/core/storage/AppDatabase.kt"
    click AccountsDao "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/core/storage/AccountsDao.kt"
    click TorCore "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/core/tor/Tor.kt"
    click TorModule "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/modules/tor/TorConnectionModule.kt"
    click TorVM "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/app/src/main/java/io/horizontalsystems/bankwallet/modules/tor/TorConnectionViewModel.kt"
    click ChartLib "https://github.com/horizontalsystems/unstoppable-wallet-android/tree/master/components/chartview"
    click IconLib "https://github.com/horizontalsystems/unstoppable-wallet-android/tree/master/components/icons"
    click SubCore "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/subscriptions-core/src/main/java/io/horizontalsystems/subscriptions/core/SubscriptionService.kt"
    click SubCore "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/subscriptions-core/src/main/java/io/horizontalsystems/subscriptions/core/UserSubscriptionManager.kt"
    click SubPlay "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/subscriptions-google-play/src/main/java/io/horizontalsystems/subscriptions/googleplay/SubscriptionServiceGooglePlay.kt"
    click SubFDroid "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/subscriptions-fdroid/src/main/java/io/horizontalsystems/subscriptions/fdroid/SubscriptionServiceFDroid.kt"
    click SubDev "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/subscriptions-dev/src/main/java/io/horizontalsystems/subscriptions/dev/SubscriptionServiceDev.kt"
    click GHActions "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/.github/workflows/ci-pull-request.yml"
    click DockerBuild "https://github.com/horizontalsystems/unstoppable-wallet-android/blob/master/docker/build-apk.sh"
    click Fastlane "https://github.com/horizontalsystems/unstoppable-wallet-android/tree/master/fastlane/Fastfile"

    %% Styles
    classDef presentation fill:#D0E7FF,stroke:#000
    classDef domain fill:#D0F0D0,stroke:#000
    classDef data fill:#FFE4B3,stroke:#000
    classDef shared fill:#E0E0E0,stroke:#000
    classDef external fill:#FFD0D0,stroke:#000
```
