Module 2: Bitcoin Core Architecture
Learning Objectives
By the end of this module, you will:
Understand what it means to run a full Bitcoin node
Know the difference between bitcoind and bitcoin-cli
Identify where Bitcoin Core stores data (blocks, wallets, mempool)
Understand how RPC access works and how to secure it
Lesson Outline
What Is a Full Node?
A full node:
Validates every block and transaction
Stores a full copy of the blockchain
Participates in network consensus rules
Enforces transaction policy (fees, size, etc.)
When you run bitcoind with default settings (mainnet), it:
Connects to the peer-to-peer Bitcoin network
Downloads and verifies all ~800GB of block data
Stores this in a dedicated data directory
In regtest or testnet, it simulates this behavior on a smaller scale.
bitcoind vs bitcoin-cli
bitcoind: the daemon that runs the full Bitcoin node.
bitcoin-cli: the command-line client used to send RPC commands to bitcoind.
In regtest or testnet, it simulates this behavior on a smaller scale.
bitcoind -regtest -daemon
bitcoin-cli -regtest getblockchaininfo
bitcoin-cli is just a frontend — it doesn’t do any validation. All the logic lives in the running bitcoind instance.
Example interaction:
bitcoin-cli is just a frontend — it doesn’t do any validation. All the logic lives in the running bitcoind instance.
Think of bitcoind as the server, and bitcoin-cli as your terminal-based admin tool.
Bitcoin Core Data Directory Structure
By default:
Linux: ~/.bitcoin/
Regtest: ~/.bitcoin/regtest/
Testnet: ~/.bitcoin/testnet3/
Key folders & files:
File/Dir | Purpose |
---|---|
blocks/ | Raw block data (.dat files) |
chainstate/ | Fast-access database of current UTXO set |
wallets/ | Wallet database files |
mempool.dat | Unconfirmed transactions |
debug.log | Node logs and errors |
bitcoin.conf | Configuration file |
Understanding the Mempool
The mempool is Bitcoin Core’s memory-based pool of unconfirmed transactions.
It grows when blocks are full or fee pressure is high.
Use getrawmempool to view TXs in the pool:
In regtest, the mempool clears instantly when you mine blocks — useful for testing.
Wallets in Bitcoin Core
Bitcoin Core now supports multi-wallet mode:
Each wallet has its own balance, address pool, and UTXOs.
Wallets are stored in: ~/.bitcoin/wallets/
You can create or load a wallet like this:
Permissioning and RPC Ports Default RPC Port:
Mainnet : 8332
Testnet : 18332
Regtest : 18443
Authentication:
By default, Bitcoin Core uses .cookie file auth (preferred for security).
Or you can manually set rpcuser and rpcpassword in bitcoin.conf.
Example bitcoin.conf:
Security Best Practices:
Never expose RPC to the public internet
Always use HTTPS if accessing over a network
For Docker or remote CLI use: restrict to localhost or use SSH port forwarding
Activity
Inspect your Bitcoin data directory:
Navigate to ~/.bitcoin/regtest/
List and describe what’s in blocks/, chainstate/, and wallets/
Run: