# brichard19/bitcrack architecture

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

- Interactive diagram: https://gitdiagram.com/brichard19/bitcrack
- Repository: https://github.com/brichard19/bitcrack

## Overview

BitCrack is a command-line Bitcoin private-key search tool, with CUDA and experimental OpenCL backends. The principal workflow accepts target addresses and search options, selects a device, scans a key range for matching addresses, and reports matches and progress; the README also documents input/output files, keyspace sharing, strides, and resumable checkpoints. AddrGen is a separate key/address generation utility. The graph follows documented behavior and shown references; some backend internals and configuration-file wiring were not sampled, so uncertain links are omitted or marked unverified.

Main entry points: [`KeyFinder/main.cpp`](https://github.com/brichard19/bitcrack/blob/master/KeyFinder/main.cpp) (Search CLI), [`AddressUtil/hash.cpp`](https://github.com/brichard19/bitcrack/blob/master/AddressUtil/hash.cpp) (Bitcoin addresses), [`AddrGen/main.cpp`](https://github.com/brichard19/bitcrack/blob/master/AddrGen/main.cpp) (Address generator), [`KeyFinderLib/KeyFinder.cpp`](https://github.com/brichard19/bitcrack/blob/master/KeyFinderLib/KeyFinder.cpp) (Search engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command-line workflows"]
  node_finder_cli["Search CLI<br/>[main.cpp]"]
  node_arg_parser["Option parser<br/>[CmdParse.cpp]"]
  node_config["Config files<br/>[ConfigFile.cpp]"]
  node_address_generator["Address generator<br/>[main.cpp]"]
  node_checkpoint["Checkpoint state<br/>[main.cpp]"]
end

subgraph group_search["Search orchestration"]
  node_search_engine["Search engine<br/>[KeyFinder.cpp]"]
  node_search_types["Search targets<br/>[KeySearchTypes.h]"]
  node_device_interface["Device interface<br/>[KeySearchDevice.h]"]
  node_logger["Logging<br/>[Logger.cpp]"]
end

subgraph group_compute["Device compute"]
  node_device_manager["Device discovery<br/>[DeviceManager.cpp]"]
  node_cuda_backend["CUDA search"]
  node_cuda_runtime["CUDA utilities<br/>[cudaUtil.cpp]"]
  node_opencl_backend["OpenCL search"]
  node_opencl_runtime["OpenCL context<br/>[clContext.cpp]"]
end

subgraph group_crypto["Key and address cryptography"]
  node_curve["secp256k1<br/>[secp256k1.cpp]"]
  node_address["Bitcoin addresses<br/>[hash.cpp]"]
  node_base58["Base58 encoding<br/>[Base58.cpp]"]
  node_crypto_hash["Hash primitives<br/>[sha256.cpp]"]
end

node_operator(("Operator"))

node_operator -->|"configures search"| node_finder_cli
node_finder_cli -->|"parses options"| node_arg_parser
node_finder_cli -->|"verifies targets"| node_address
node_finder_cli -->|"lists devices"| node_device_manager
node_finder_cli -->|"runs search"| node_search_engine
node_finder_cli -->|"creates backend"| node_cuda_backend
node_finder_cli -->|"creates backend"| node_opencl_backend
node_search_engine -.->|"dispatches search"| node_device_interface
node_device_manager -->|"queries devices"| node_cuda_runtime
node_device_manager -->|"queries devices"| node_opencl_runtime
node_cuda_backend -->|"uses runtime"| node_cuda_runtime
node_opencl_backend -->|"uses context"| node_opencl_runtime
node_cuda_backend -->|"computes keys"| node_curve
node_opencl_backend -->|"checks targets"| node_address
node_finder_cli -->|"saves progress"| node_checkpoint
node_operator -->|"requests addresses"| node_address_generator
node_address_generator -->|"derives public key"| node_curve
node_address_generator -->|"encodes address"| node_address
node_address -->|"uses encoding"| node_base58
node_address -->|"hashes keys"| node_crypto_hash
node_finder_cli -->|"reports status"| node_logger
node_search_engine -->|"reports progress"| node_logger

click node_finder_cli "https://github.com/brichard19/bitcrack/blob/master/KeyFinder/main.cpp"
click node_arg_parser "https://github.com/brichard19/bitcrack/blob/master/CmdParse/CmdParse.cpp"
click node_config "https://github.com/brichard19/bitcrack/blob/master/KeyFinder/ConfigFile.cpp"
click node_address_generator "https://github.com/brichard19/bitcrack/blob/master/AddrGen/main.cpp"
click node_search_engine "https://github.com/brichard19/bitcrack/blob/master/KeyFinderLib/KeyFinder.cpp"
click node_search_types "https://github.com/brichard19/bitcrack/blob/master/KeyFinderLib/KeySearchTypes.h"
click node_device_interface "https://github.com/brichard19/bitcrack/blob/master/KeyFinderLib/KeySearchDevice.h"
click node_device_manager "https://github.com/brichard19/bitcrack/blob/master/KeyFinder/DeviceManager.cpp"
click node_cuda_backend "https://github.com/brichard19/bitcrack/blob/master/CudaKeySearchDevice/CudaKeySearchDevice.cpp"
click node_cuda_runtime "https://github.com/brichard19/bitcrack/blob/master/cudaUtil/cudaUtil.cpp"
click node_opencl_backend "https://github.com/brichard19/bitcrack/blob/master/CLKeySearchDevice/CLKeySearchDevice.cpp"
click node_opencl_runtime "https://github.com/brichard19/bitcrack/blob/master/clUtil/clContext.cpp"
click node_curve "https://github.com/brichard19/bitcrack/blob/master/secp256k1lib/secp256k1.cpp"
click node_address "https://github.com/brichard19/bitcrack/blob/master/AddressUtil/hash.cpp"
click node_base58 "https://github.com/brichard19/bitcrack/blob/master/AddressUtil/Base58.cpp"
click node_crypto_hash "https://github.com/brichard19/bitcrack/blob/master/CryptoUtil/sha256.cpp"
click node_logger "https://github.com/brichard19/bitcrack/blob/master/Logger/Logger.cpp"
click node_checkpoint "https://github.com/brichard19/bitcrack/blob/master/KeyFinder/main.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_finder_cli,node_arg_parser,node_config,node_address_generator,node_checkpoint toneBlue
class node_search_engine,node_search_types,node_device_interface,node_logger toneAmber
class node_device_manager,node_cuda_backend,node_cuda_runtime,node_opencl_backend,node_opencl_runtime toneMint
class node_curve,node_address,node_base58,node_crypto_hash toneRose
class node_operator toneIndigo
```

## Components

### Command-line workflows

- [Search CLI](https://github.com/brichard19/bitcrack/blob/master/KeyFinder/main.cpp): `KeyFinder/main.cpp`
- [Option parser](https://github.com/brichard19/bitcrack/blob/master/CmdParse/CmdParse.cpp): `CmdParse/CmdParse.cpp`
- [Config files](https://github.com/brichard19/bitcrack/blob/master/KeyFinder/ConfigFile.cpp): `KeyFinder/ConfigFile.cpp`
- [Address generator](https://github.com/brichard19/bitcrack/blob/master/AddrGen/main.cpp): `AddrGen/main.cpp`
- [Checkpoint state](https://github.com/brichard19/bitcrack/blob/master/KeyFinder/main.cpp): `KeyFinder/main.cpp`

### Search orchestration

- [Search engine](https://github.com/brichard19/bitcrack/blob/master/KeyFinderLib/KeyFinder.cpp): `KeyFinderLib/KeyFinder.cpp`
- [Search targets](https://github.com/brichard19/bitcrack/blob/master/KeyFinderLib/KeySearchTypes.h): `KeyFinderLib/KeySearchTypes.h`
- [Device interface](https://github.com/brichard19/bitcrack/blob/master/KeyFinderLib/KeySearchDevice.h): `KeyFinderLib/KeySearchDevice.h`
- [Logging](https://github.com/brichard19/bitcrack/blob/master/Logger/Logger.cpp): `Logger/Logger.cpp`

### Device compute

- [Device discovery](https://github.com/brichard19/bitcrack/blob/master/KeyFinder/DeviceManager.cpp): `KeyFinder/DeviceManager.cpp`
- [CUDA search](https://github.com/brichard19/bitcrack/blob/master/CudaKeySearchDevice/CudaKeySearchDevice.cpp): `CudaKeySearchDevice/CudaKeySearchDevice.cpp`
- [CUDA utilities](https://github.com/brichard19/bitcrack/blob/master/cudaUtil/cudaUtil.cpp): `cudaUtil/cudaUtil.cpp`
- [OpenCL search](https://github.com/brichard19/bitcrack/blob/master/CLKeySearchDevice/CLKeySearchDevice.cpp): `CLKeySearchDevice/CLKeySearchDevice.cpp`
- [OpenCL context](https://github.com/brichard19/bitcrack/blob/master/clUtil/clContext.cpp): `clUtil/clContext.cpp`

### Key and address cryptography

- [secp256k1](https://github.com/brichard19/bitcrack/blob/master/secp256k1lib/secp256k1.cpp): `secp256k1lib/secp256k1.cpp`
- [Bitcoin addresses](https://github.com/brichard19/bitcrack/blob/master/AddressUtil/hash.cpp): `AddressUtil/hash.cpp`
- [Base58 encoding](https://github.com/brichard19/bitcrack/blob/master/AddressUtil/Base58.cpp): `AddressUtil/Base58.cpp`
- [Hash primitives](https://github.com/brichard19/bitcrack/blob/master/CryptoUtil/sha256.cpp): `CryptoUtil/sha256.cpp`

### Other components

- **Operator**

## Connections

- Operator → Search CLI: configures search (evidence: `README.md`)
- Search CLI → Option parser: parses options (evidence: `KeyFinder/main.cpp`)
- Search CLI → Bitcoin addresses: verifies targets (evidence: `KeyFinder/main.cpp`)
- Search CLI → Device discovery: lists devices (evidence: `KeyFinder/main.cpp`)
- Search CLI → Search engine: runs search (evidence: `KeyFinder/main.cpp`)
- Search CLI → CUDA search: creates backend (evidence: `KeyFinder/main.cpp`)
- Search CLI → OpenCL search: creates backend (evidence: `KeyFinder/main.cpp`)
- Search engine → Device interface: dispatches search
- Device discovery → CUDA utilities: queries devices (evidence: `KeyFinder/DeviceManager.cpp`)
- Device discovery → OpenCL context: queries devices (evidence: `KeyFinder/DeviceManager.cpp`)
- CUDA search → CUDA utilities: uses runtime
- OpenCL search → OpenCL context: uses context
- CUDA search → secp256k1: computes keys
- OpenCL search → Bitcoin addresses: checks targets (evidence: `CLKeySearchDevice/CLKeySearchDevice.cpp`)
- Search CLI → Checkpoint state: saves progress (evidence: `KeyFinder/main.cpp`)
- Operator → Address generator: requests addresses (evidence: `AddrGen/main.cpp`)
- Address generator → secp256k1: derives public key (evidence: `AddrGen/main.cpp`)
- Address generator → Bitcoin addresses: encodes address (evidence: `AddrGen/main.cpp`)
- Bitcoin addresses → Base58 encoding: uses encoding (evidence: `AddressUtil/Base58.cpp`)
- Bitcoin addresses → Hash primitives: hashes keys (evidence: `AddressUtil/hash.cpp`)
- Search CLI → Logging: reports status (evidence: `KeyFinder/main.cpp`)
- Search engine → Logging: reports progress (evidence: `KeyFinderLib/KeyFinder.cpp`)
