Learning objectives
- 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:- Creates a directory at ~/.bitcoin/regtest/wallets/user_wallet
- Initializes a keypool and metadata
- Loads the wallet into memory automatically
Wallets must be loaded to interact with them (e.g. send, getbalance, generate addresses).
Generating new addresses
Once a wallet is loaded, generate a new address:Address formats: Bech32 vs legacy
In production, always prefer Bech32 unless interacting with legacy systems.
Watching vs active wallets
Active wallets:- Contain private keys
- Can sign and spend
- Only store addresses (public keys)
- Cannot spend, used for audit or monitoring
Using labels for addresses
Labels help you track usage or assign context to addresses.- Payment types (e.g. salary, invoice)
- 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.