Overview of bitcoind

The following diagram gives a brief overview of how some of the major components in bitcoind are related.

This diagram is not exhaustive and includes simplifications.
dashed lines indicate optional components
bitcoind overview
Figure 1. bitcoind overview
Table 1. Brief description of components in bitcoind overview
Component Simplified description

AddrMan

Manage peers' network addresses

CConnman

Manage network connections to peers

Interfaces::Chain

Give clients access to chain state, fee rate estimates, notifications and allow tx submission

ChainstateManager

An interface for interacting with 1 or 2 chainstates (1. IBD-verified, 2. optional snapshot)

NetGroupManager

Manage net groups. Ensure we don’t connect to multiple nodes in the same ASN bucket

CTxMemPool

Validate and store (valid) transactions which may be included in the next block

PeerManager

Manage peer state and interaction e.g. processing messages, fetching blocks & removing for misbehaviour

BlockManager

Maintains a tree of blocks on disk (via LevelDB) to determine most-work tip

ScriptPubKeyMan

Manages scriptPubKeys in a wallet. Can give out new scriptPubKeys as well as call into a SigningProvider to sign transactions

bitcoin-cli overview

The following diagram gives a brief overview of the major components in bitcoin-cli.

This diagram is not exhaustive and includes simplifications.
bitcoin cli overview
Figure 2. bitcoin-cli overview

Wallet structure

The following diagram gives a brief overview of how the wallet is structured.

This diagram is not exhaustive and includes simplifications.
dashed lines indicate optional components
bitcoin wallet overview
Figure 3. Wallet structure overview
Table 2. Brief description of components
Component Simplified description

WalletDatabase

Represents a single wallet. Handles reads and writes to disk

ScriptPubKeyMan

Base class for the below SPKM classes to override before being used by CWallet

DescriptorScriptPubKeyMan

A SPKM for descriptor-based wallets

LegacyScriptPubKeyMan

A SPKM for legacy wallets

SigningProvider

An interface for a KeyStore to sign transactions from

Interfaces::Chain

Give clients access to chain state, fee rate estimates, notifications and allow tx submission

cs_wallet

The primary wallet lock, held for atomic wallet operations