# bob-collective/bitcoin-spv architecture

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

- Interactive diagram: https://gitdiagram.com/bob-collective/bitcoin-spv
- Repository: https://github.com/bob-collective/bitcoin-spv

## Overview

bitcoin-spv is a Solidity toolkit for EVM applications to validate Bitcoin data. Its documented capabilities include pure transaction and header validation, higher-level header-chain and transaction-inclusion-proof evaluation, and a standardized JSON proof format. The tree identifies likely implementation modules, but no source excerpts were provided, so internal calls and data flow cannot be verified; the graph shows only the README-documented external use relationship.

Main entry points: [`src`](https://github.com/bob-collective/bitcoin-spv/tree/master/src) (Bitcoin SPV toolkit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bitcoin_data["Bitcoin Data"]
  node_btc_utils["Bitcoin utilities<br/>[BTCUtils.sol]"]
  node_btc_delegate["Bitcoin utility delegate"]
  node_segwit["SegWit utilities<br/>[SegWitUtils.sol]"]
end

subgraph group_proof_validation["Proof Validation"]
  node_toolkit["Bitcoin SPV toolkit"]
  node_sig_check["Signature checks"]
  node_sig_delegate["Signature check delegate"]
  node_spv_validation["SPV validation<br/>[ValidateSPV.sol]"]
  node_spv_delegate["SPV validation delegate"]
  node_proof_format["JSON proof format"]
end

subgraph group_shared_helpers["Shared Helpers"]
  node_bytes["Byte utilities<br/>[BytesLib.sol]"]
  node_safe_math["Safe arithmetic<br/>[SafeMath.sol]"]
end

node_evm_app(("EVM application"))

node_evm_app -->|"uses"| node_toolkit

click node_toolkit "https://github.com/bob-collective/bitcoin-spv/tree/master/src"
click node_btc_utils "https://github.com/bob-collective/bitcoin-spv/blob/master/src/BTCUtils.sol"
click node_btc_delegate "https://github.com/bob-collective/bitcoin-spv/blob/master/src/BTCUtilsDelegate.sol"
click node_segwit "https://github.com/bob-collective/bitcoin-spv/blob/master/src/SegWitUtils.sol"
click node_sig_check "https://github.com/bob-collective/bitcoin-spv/blob/master/src/CheckBitcoinSigs.sol"
click node_sig_delegate "https://github.com/bob-collective/bitcoin-spv/blob/master/src/CheckBitcoinSigsDelegate.sol"
click node_spv_validation "https://github.com/bob-collective/bitcoin-spv/blob/master/src/ValidateSPV.sol"
click node_spv_delegate "https://github.com/bob-collective/bitcoin-spv/blob/master/src/ValidateSPVDelegate.sol"
click node_bytes "https://github.com/bob-collective/bitcoin-spv/blob/master/src/BytesLib.sol"
click node_safe_math "https://github.com/bob-collective/bitcoin-spv/blob/master/src/SafeMath.sol"

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_btc_utils,node_btc_delegate,node_segwit toneBlue
class node_toolkit,node_sig_check,node_sig_delegate,node_spv_validation,node_spv_delegate,node_proof_format toneAmber
class node_bytes,node_safe_math toneMint
class node_evm_app toneIndigo
```

## Components

### Bitcoin Data

- [Bitcoin utilities](https://github.com/bob-collective/bitcoin-spv/blob/master/src/BTCUtils.sol): `src/BTCUtils.sol`
- [Bitcoin utility delegate](https://github.com/bob-collective/bitcoin-spv/blob/master/src/BTCUtilsDelegate.sol): `src/BTCUtilsDelegate.sol`
- [SegWit utilities](https://github.com/bob-collective/bitcoin-spv/blob/master/src/SegWitUtils.sol): `src/SegWitUtils.sol`

### Proof Validation

- [Bitcoin SPV toolkit](https://github.com/bob-collective/bitcoin-spv/tree/master/src): `src`
- [Signature checks](https://github.com/bob-collective/bitcoin-spv/blob/master/src/CheckBitcoinSigs.sol): `src/CheckBitcoinSigs.sol`
- [Signature check delegate](https://github.com/bob-collective/bitcoin-spv/blob/master/src/CheckBitcoinSigsDelegate.sol): `src/CheckBitcoinSigsDelegate.sol`
- [SPV validation](https://github.com/bob-collective/bitcoin-spv/blob/master/src/ValidateSPV.sol): `src/ValidateSPV.sol`
- [SPV validation delegate](https://github.com/bob-collective/bitcoin-spv/blob/master/src/ValidateSPVDelegate.sol): `src/ValidateSPVDelegate.sol`
- **JSON proof format**

### Shared Helpers

- [Byte utilities](https://github.com/bob-collective/bitcoin-spv/blob/master/src/BytesLib.sol): `src/BytesLib.sol`
- [Safe arithmetic](https://github.com/bob-collective/bitcoin-spv/blob/master/src/SafeMath.sol): `src/SafeMath.sol`

### Other components

- **EVM application**

## Connections

- EVM application → Bitcoin SPV toolkit: uses (evidence: `README.md`)
