# stellar/stellar-core architecture

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

- Interactive diagram: https://gitdiagram.com/stellar/stellar-core
- Repository: https://github.com/stellar/stellar-core

## Overview

Stellar Core is a peer-coordinated replicated state machine that processes transactions and maintains a cryptographic ledger. The principal workflow is peer communication and consensus, transaction-set formation, ledger application, and durable ledger-state maintenance; catchup and history archives restore or publish checkpointed state. The graph reflects README statements and source-index references plus the supplied excerpts; unsampled subsystem wiring is omitted where its caller is not evidenced.

Main entry points: [`src/ledger/LedgerManagerImpl.cpp`](https://github.com/stellar/stellar-core/blob/master/src/ledger/LedgerManagerImpl.cpp) (Ledger manager), [`src/main/Application.h`](https://github.com/stellar/stellar-core/blob/master/src/main/Application.h) (Application runtime), [`src/herder/Herder.h`](https://github.com/stellar/stellar-core/blob/master/src/herder/Herder.h) (Herder coordination), [`src/history/HistoryManagerImpl.cpp`](https://github.com/stellar/stellar-core/blob/master/src/history/HistoryManagerImpl.cpp) (History manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Node runtime"]
  node_application["Application runtime<br/>[Application.h]"]
  node_configuration["Node configuration<br/>[Config.h]"]
end

subgraph group_consensus["Peer consensus"]
  node_peer_network["Peer network"]
  node_herder["Herder coordination<br/>[Herder.h]"]
  node_scp["SCP consensus<br/>[SCP.cpp]"]
  node_transaction_sets["Transaction sets<br/>[TxSetFrame.h]"]
end

subgraph group_ledger["Ledger processing"]
  node_ledger_manager["Ledger manager"]
  node_transactions["Transaction processing"]
  node_ledger_txn["Ledger transactions<br/>[LedgerTxn.h]"]
  node_ledger_view["Immutable ledger view"]
end

subgraph group_persistence["State persistence"]
  node_database[("Ledger database<br/>[Database.cpp]")]
  node_buckets[("Bucket state<br/>[BucketManager.cpp]")]
  node_history_manager["History manager"]
  node_history_archive["History archives<br/>[HistoryArchive.h]"]
  node_catchup["Ledger catchup"]
end

subgraph group_support["Runtime support"]
  node_runtime_support["Runtime utilities"]
  node_operators["Invariant checks"]
end

node_operator(("Node operator"))

node_operator -->|"configures"| node_application
node_application -->|"uses"| node_configuration
node_application -->|"creates subsystem"| node_peer_network
node_application -->|"creates subsystem"| node_herder
node_application -->|"creates subsystem"| node_history_manager
node_application -->|"creates subsystem"| node_ledger_manager
node_peer_network -.->|"delivers peer messages"| node_herder
node_herder -->|"coordinates consensus"| node_scp
node_herder -->|"receives sets"| node_transaction_sets
node_ledger_manager -->|"applies agreed set"| node_transaction_sets
node_ledger_manager -->|"applies transactions"| node_transactions
node_transactions -.->|"updates ledger state"| node_ledger_txn
node_ledger_manager -->|"uses transactions"| node_ledger_txn
node_ledger_manager -->|"uses storage"| node_database
node_ledger_manager -->|"manages bucket state"| node_buckets
node_ledger_manager -->|"coordinates history"| node_history_manager
node_ledger_manager -->|"delegates catchup"| node_catchup
node_catchup -->|"applies recovered state"| node_ledger_manager
node_history_manager -->|"uses archive format"| node_history_archive
node_history_manager -->|"uses bucket state"| node_buckets
node_ledger_manager -->|"creates state snapshots"| node_ledger_view
node_database -->|"uses utilities"| node_runtime_support
node_ledger_manager -->|"checks invariants"| node_operators
node_application -.->|"uses runtime services"| node_runtime_support

click node_application "https://github.com/stellar/stellar-core/blob/master/src/main/Application.h"
click node_configuration "https://github.com/stellar/stellar-core/blob/master/src/main/Config.h"
click node_peer_network "https://github.com/stellar/stellar-core/blob/master/src/overlay/OverlayManagerImpl.cpp"
click node_herder "https://github.com/stellar/stellar-core/blob/master/src/herder/Herder.h"
click node_scp "https://github.com/stellar/stellar-core/blob/master/src/scp/SCP.cpp"
click node_transaction_sets "https://github.com/stellar/stellar-core/blob/master/src/herder/TxSetFrame.h"
click node_ledger_manager "https://github.com/stellar/stellar-core/blob/master/src/ledger/LedgerManagerImpl.cpp"
click node_transactions "https://github.com/stellar/stellar-core/blob/master/src/transactions/TransactionFrame.cpp"
click node_ledger_txn "https://github.com/stellar/stellar-core/blob/master/src/ledger/LedgerTxn.h"
click node_ledger_view "https://github.com/stellar/stellar-core/blob/master/src/ledger/ImmutableLedgerView.h"
click node_database "https://github.com/stellar/stellar-core/blob/master/src/database/Database.cpp"
click node_buckets "https://github.com/stellar/stellar-core/blob/master/src/bucket/BucketManager.cpp"
click node_history_manager "https://github.com/stellar/stellar-core/blob/master/src/history/HistoryManagerImpl.cpp"
click node_history_archive "https://github.com/stellar/stellar-core/blob/master/src/history/HistoryArchive.h"
click node_catchup "https://github.com/stellar/stellar-core/blob/master/src/catchup/LedgerApplyManagerImpl.cpp"
click node_runtime_support "https://github.com/stellar/stellar-core/tree/master/src/util"
click node_operators "https://github.com/stellar/stellar-core/blob/master/src/invariant/InvariantManagerImpl.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_application,node_configuration toneBlue
class node_peer_network,node_herder,node_scp,node_transaction_sets toneAmber
class node_ledger_manager,node_transactions,node_ledger_txn,node_ledger_view toneMint
class node_database,node_buckets,node_history_manager,node_history_archive,node_catchup toneRose
class node_runtime_support,node_operators,node_operator toneIndigo
```

## Components

### Node runtime

- [Application runtime](https://github.com/stellar/stellar-core/blob/master/src/main/Application.h): `src/main/Application.h`
- [Node configuration](https://github.com/stellar/stellar-core/blob/master/src/main/Config.h): `src/main/Config.h`

### Peer consensus

- [Peer network](https://github.com/stellar/stellar-core/blob/master/src/overlay/OverlayManagerImpl.cpp): `src/overlay/OverlayManagerImpl.cpp`
- [Herder coordination](https://github.com/stellar/stellar-core/blob/master/src/herder/Herder.h): `src/herder/Herder.h`
- [SCP consensus](https://github.com/stellar/stellar-core/blob/master/src/scp/SCP.cpp): `src/scp/SCP.cpp`
- [Transaction sets](https://github.com/stellar/stellar-core/blob/master/src/herder/TxSetFrame.h): `src/herder/TxSetFrame.h`

### Ledger processing

- [Ledger manager](https://github.com/stellar/stellar-core/blob/master/src/ledger/LedgerManagerImpl.cpp): `src/ledger/LedgerManagerImpl.cpp`
- [Transaction processing](https://github.com/stellar/stellar-core/blob/master/src/transactions/TransactionFrame.cpp): `src/transactions/TransactionFrame.cpp`
- [Ledger transactions](https://github.com/stellar/stellar-core/blob/master/src/ledger/LedgerTxn.h): `src/ledger/LedgerTxn.h`
- [Immutable ledger view](https://github.com/stellar/stellar-core/blob/master/src/ledger/ImmutableLedgerView.h): `src/ledger/ImmutableLedgerView.h`

### State persistence

- [Ledger database](https://github.com/stellar/stellar-core/blob/master/src/database/Database.cpp): `src/database/Database.cpp`
- [Bucket state](https://github.com/stellar/stellar-core/blob/master/src/bucket/BucketManager.cpp): `src/bucket/BucketManager.cpp`
- [History manager](https://github.com/stellar/stellar-core/blob/master/src/history/HistoryManagerImpl.cpp): `src/history/HistoryManagerImpl.cpp`
- [History archives](https://github.com/stellar/stellar-core/blob/master/src/history/HistoryArchive.h): `src/history/HistoryArchive.h`
- [Ledger catchup](https://github.com/stellar/stellar-core/blob/master/src/catchup/LedgerApplyManagerImpl.cpp): `src/catchup/LedgerApplyManagerImpl.cpp`

### Runtime support

- [Runtime utilities](https://github.com/stellar/stellar-core/tree/master/src/util): `src/util`
- [Invariant checks](https://github.com/stellar/stellar-core/blob/master/src/invariant/InvariantManagerImpl.cpp): `src/invariant/InvariantManagerImpl.cpp`

### Other components

- **Node operator**

## Connections

- Node operator → Application runtime: configures (evidence: `src/main/Application.h`)
- Application runtime → Node configuration: uses (evidence: `src/main/Application.h`)
- Application runtime → Peer network: creates subsystem (evidence: `src/main/Application.h`)
- Application runtime → Herder coordination: creates subsystem (evidence: `src/main/Application.h`)
- Application runtime → History manager: creates subsystem (evidence: `src/main/Application.h`)
- Application runtime → Ledger manager: creates subsystem (evidence: `src/main/Application.h`)
- Peer network → Herder coordination: delivers peer messages (evidence: `src/overlay/OverlayManagerImpl.cpp`)
- Herder coordination → SCP consensus: coordinates consensus (evidence: `src/herder/Herder.h`)
- Herder coordination → Transaction sets: receives sets (evidence: `src/herder/Herder.h`)
- Ledger manager → Transaction sets: applies agreed set (evidence: `src/ledger/LedgerManagerImpl.cpp`)
- Ledger manager → Transaction processing: applies transactions (evidence: `src/ledger/LedgerManagerImpl.cpp`)
- Transaction processing → Ledger transactions: updates ledger state
- Ledger manager → Ledger transactions: uses transactions (evidence: `src/ledger/LedgerManagerImpl.cpp`)
- Ledger manager → Ledger database: uses storage (evidence: `src/ledger/LedgerManagerImpl.cpp`)
- Ledger manager → Bucket state: manages bucket state (evidence: `src/ledger/LedgerManagerImpl.cpp`)
- Ledger manager → History manager: coordinates history (evidence: `src/ledger/LedgerManagerImpl.cpp`)
- Ledger manager → Ledger catchup: delegates catchup
- Ledger catchup → Ledger manager: applies recovered state (evidence: `src/catchup/LedgerApplyManagerImpl.cpp`)
- History manager → History archives: uses archive format (evidence: `src/history/HistoryManagerImpl.cpp`)
- History manager → Bucket state: uses bucket state (evidence: `src/history/HistoryManagerImpl.cpp`)
- Ledger manager → Immutable ledger view: creates state snapshots (evidence: `src/ledger/LedgerManagerImpl.cpp`)
- Ledger database → Runtime utilities: uses utilities (evidence: `src/database/Database.cpp`)
- Ledger manager → Invariant checks: checks invariants (evidence: `src/invariant/InvariantManagerImpl.cpp`)
- Application runtime → Runtime utilities: uses runtime services
