# barbosaofilho/bitcoin architecture

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

- Interactive diagram: https://gitdiagram.com/barbosaofilho/bitcoin
- Repository: https://github.com/barbosaofilho/bitcoin

## Overview

Bitcoin Core is a full node for the Bitcoin network, with optional wallet and graphical interface. The documented primary workflow is peer-to-peer block and transaction download followed by full validation; wallet, RPC, mining, indexes, and cryptographic/script processing are major supporting capabilities. The README supports the high-level workflow, while source excerpts are limited; unverified internal connections are therefore dashed or omitted.

Main entry points: [`src/net_processing.cpp`](https://github.com/barbosaofilho/bitcoin/blob/master/src/net_processing.cpp) (Peer networking), [`src/node/chainstate.cpp`](https://github.com/barbosaofilho/bitcoin/blob/master/src/node/chainstate.cpp) (Chain state), [`src/consensus/tx_verify.cpp`](https://github.com/barbosaofilho/bitcoin/blob/master/src/consensus/tx_verify.cpp) (Block validation), [`src/node/block_template_manager.cpp`](https://github.com/barbosaofilho/bitcoin/blob/master/src/node/block_template_manager.cpp) (Block construction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_network["Peer networking"]
  node_p2p["Peer networking<br/>[net_processing.cpp]"]
  node_transport["Network transport<br/>[net.cpp]"]
end

subgraph group_consensus["Validation and chain"]
  node_chain_validation["Block validation<br/>[tx_verify.cpp]"]
  node_consensus_rules["Consensus rules"]
  node_chainstate["Chain state<br/>[chainstate.cpp]"]
end

subgraph group_state["Node state"]
  node_block_storage[("Block storage<br/>[blockstorage.cpp]")]
  node_utxo[("UTXO state<br/>[coins.cpp]")]
  node_indexes[("Chain indexes")]
  node_leveldb[("LevelDB engine")]
  node_mempool[("Transaction mempool")]
end

subgraph group_services["User services"]
  node_wallet[("Wallet")]
  node_gui["Graphical interface<br/>[bitcoingui.cpp]"]
  node_rpc["RPC service<br/>[server.cpp]"]
  node_miner["Block construction"]
end

subgraph group_crypto["Crypto foundations"]
  node_script["Script processing<br/>[interpreter.cpp]"]
  node_secp["secp256k1 crypto"]
  node_musig["MuSig signing<br/>[session_impl.h]"]
end

node_operator(("Node operator"))
node_peers(("Bitcoin peers"))

node_operator -->|"starts node"| node_p2p
node_peers -->|"send blocks"| node_p2p
node_p2p -->|"delivers data"| node_chain_validation
node_chain_validation -.->|"updates chain"| node_chainstate
node_chainstate -.->|"stores blocks"| node_block_storage
node_chainstate -.->|"updates outputs"| node_utxo
node_chainstate -.->|"feeds indexes"| node_indexes
node_block_storage -.->|"uses database"| node_leveldb
node_utxo -.->|"uses database"| node_leveldb
node_p2p -.->|"uses transport"| node_transport
node_p2p -.->|"handles transactions"| node_mempool
node_operator -->|"uses interface"| node_gui
node_operator -.->|"calls commands"| node_rpc
node_gui -.->|"accesses wallet"| node_wallet
node_rpc -.->|"controls wallet"| node_wallet
node_miner -.->|"selects transactions"| node_mempool
node_miner -.->|"checks block"| node_chain_validation
node_chain_validation -.->|"checks scripts"| node_script
node_script -.->|"uses signatures"| node_secp
node_musig -->|"uses primitives"| node_secp

click node_p2p "https://github.com/barbosaofilho/bitcoin/blob/master/src/net_processing.cpp"
click node_transport "https://github.com/barbosaofilho/bitcoin/blob/master/src/net.cpp"
click node_chain_validation "https://github.com/barbosaofilho/bitcoin/blob/master/src/consensus/tx_verify.cpp"
click node_consensus_rules "https://github.com/barbosaofilho/bitcoin/tree/master/src/consensus"
click node_chainstate "https://github.com/barbosaofilho/bitcoin/blob/master/src/node/chainstate.cpp"
click node_block_storage "https://github.com/barbosaofilho/bitcoin/blob/master/src/node/blockstorage.cpp"
click node_utxo "https://github.com/barbosaofilho/bitcoin/blob/master/src/coins.cpp"
click node_indexes "https://github.com/barbosaofilho/bitcoin/tree/master/src/index"
click node_leveldb "https://github.com/barbosaofilho/bitcoin/tree/master/src/leveldb"
click node_mempool "https://github.com/barbosaofilho/bitcoin/tree/master/src/kernel"
click node_wallet "https://github.com/barbosaofilho/bitcoin/tree/master/src/wallet"
click node_gui "https://github.com/barbosaofilho/bitcoin/blob/master/src/qt/bitcoingui.cpp"
click node_rpc "https://github.com/barbosaofilho/bitcoin/blob/master/src/rpc/server.cpp"
click node_miner "https://github.com/barbosaofilho/bitcoin/blob/master/src/node/block_template_manager.cpp"
click node_script "https://github.com/barbosaofilho/bitcoin/blob/master/src/script/interpreter.cpp"
click node_secp "https://github.com/barbosaofilho/bitcoin/tree/master/src/secp256k1"
click node_musig "https://github.com/barbosaofilho/bitcoin/blob/master/src/secp256k1/src/modules/musig/session_impl.h"

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_p2p,node_transport toneBlue
class node_chain_validation,node_consensus_rules,node_chainstate toneAmber
class node_block_storage,node_utxo,node_indexes,node_leveldb,node_mempool toneMint
class node_wallet,node_gui,node_rpc,node_miner toneRose
class node_script,node_secp,node_musig,node_operator,node_peers toneIndigo
```

## Components

### Peer networking

- [Peer networking](https://github.com/barbosaofilho/bitcoin/blob/master/src/net_processing.cpp): `src/net_processing.cpp`
- [Network transport](https://github.com/barbosaofilho/bitcoin/blob/master/src/net.cpp): `src/net.cpp`

### Validation and chain

- [Block validation](https://github.com/barbosaofilho/bitcoin/blob/master/src/consensus/tx_verify.cpp): `src/consensus/tx_verify.cpp`
- [Consensus rules](https://github.com/barbosaofilho/bitcoin/tree/master/src/consensus): `src/consensus`
- [Chain state](https://github.com/barbosaofilho/bitcoin/blob/master/src/node/chainstate.cpp): `src/node/chainstate.cpp`

### Node state

- [Block storage](https://github.com/barbosaofilho/bitcoin/blob/master/src/node/blockstorage.cpp): `src/node/blockstorage.cpp`
- [UTXO state](https://github.com/barbosaofilho/bitcoin/blob/master/src/coins.cpp): `src/coins.cpp`
- [Chain indexes](https://github.com/barbosaofilho/bitcoin/tree/master/src/index): `src/index`
- [LevelDB engine](https://github.com/barbosaofilho/bitcoin/tree/master/src/leveldb): `src/leveldb`
- [Transaction mempool](https://github.com/barbosaofilho/bitcoin/tree/master/src/kernel): `src/kernel`

### User services

- [Wallet](https://github.com/barbosaofilho/bitcoin/tree/master/src/wallet): `src/wallet`
- [Graphical interface](https://github.com/barbosaofilho/bitcoin/blob/master/src/qt/bitcoingui.cpp): `src/qt/bitcoingui.cpp`
- [RPC service](https://github.com/barbosaofilho/bitcoin/blob/master/src/rpc/server.cpp): `src/rpc/server.cpp`
- [Block construction](https://github.com/barbosaofilho/bitcoin/blob/master/src/node/block_template_manager.cpp): `src/node/block_template_manager.cpp`

### Crypto foundations

- [Script processing](https://github.com/barbosaofilho/bitcoin/blob/master/src/script/interpreter.cpp): `src/script/interpreter.cpp`
- [secp256k1 crypto](https://github.com/barbosaofilho/bitcoin/tree/master/src/secp256k1): `src/secp256k1`
- [MuSig signing](https://github.com/barbosaofilho/bitcoin/blob/master/src/secp256k1/src/modules/musig/session_impl.h): `src/secp256k1/src/modules/musig/session_impl.h`

### Other components

- **Node operator**
- **Bitcoin peers**

## Connections

- Node operator → Peer networking: starts node (evidence: `README.md`)
- Bitcoin peers → Peer networking: send blocks (evidence: `README.md`)
- Peer networking → Block validation: delivers data (evidence: `README.md`)
- Block validation → Chain state: updates chain
- Chain state → Block storage: stores blocks
- Chain state → UTXO state: updates outputs
- Chain state → Chain indexes: feeds indexes
- Block storage → LevelDB engine: uses database
- UTXO state → LevelDB engine: uses database
- Peer networking → Network transport: uses transport
- Peer networking → Transaction mempool: handles transactions
- Node operator → Graphical interface: uses interface (evidence: `README.md`)
- Node operator → RPC service: calls commands
- Graphical interface → Wallet: accesses wallet
- RPC service → Wallet: controls wallet
- Block construction → Transaction mempool: selects transactions
- Block construction → Block validation: checks block
- Block validation → Script processing: checks scripts
- Script processing → secp256k1 crypto: uses signatures
- MuSig signing → secp256k1 crypto: uses primitives (evidence: `src/secp256k1/src/modules/musig/session_impl.h`)
