Module 3: Wallets and Addresses in Bitcoin Core
Learning Objectives
By the end of this module, you will:
Create and load Bitcoin Core wallets via the CLI
Generate Bech32 and legacy-style addresses
Understand the difference between active and watch-only wallets
Use labels to track address purposes or user flows
Creating and Loading Wallets
Bitcoin Core supports multiple wallets.
Create a new wallet:
This:
Creates a directory at ~/.bitcoin/regtest/wallets/user_wallet
Initializes a keypool and metadata
Loads the wallet into memory automatically
List currently loaded wallets:
Load an existing wallet manually:
Generating New Addresses
Once a wallet is loaded, generate a new address:
To specify a label (more on this below):
To choose an address format:
Address Formats: Bech32 vs Legacy
Format | CLI String | Looks Like | Pros |
---|---|---|---|
Bech32 | bech32 | bc1... | Lower fees, native SegWit, modern |
P2SH | p2sh-segwit | 3... | SegWit wrapped in P2SH |
Legacy | legacy | 1... | High fees, no SegWit support |
In production, always prefer Bech32 unless interacting with legacy systems.
Watching vs Active Wallets
Active wallets:
Contain private keys
Can sign and spend
Watch-only wallets:
Only store addresses (public keys)
Cannot spend โ used for audit or monitoring
Add a watch-only address:
Use listunspent or getbalance to see funds received to that address.
Using Labels for Addresses
Labels help you track usage or assign context to addresses.
Now you can query:
Labels are stored per-wallet. Use them to track:
Payment types (e.g. salary, invoice)
Customer IDs
Customer IDs Internal routing (e.g. swap_funding)
Activity
Run the following:
Create a wallet: demo_wallet
Load it if needed: loadwallet demo_wallet
Generate one Bech32 and one legacy address.
Add a watch-only address for a friendโs wallet (replace <friends_address> with an actual address).
Label two addresses: one for merchant, one for salary.
Bonus: