Your First Wallet
Overview
Learning Objectives
What is a Wallet?
Backend vs Frontend Wallet Paradigm
Backend Wallet (Custodial/Server-Side)
Frontend Wallet (Non-Custodial)
Backend Wallet Implementation
Understanding Wallet Types
1. Simple Wallet
2. HD Wallet (Hierarchical Deterministic)
Creating a Simple Wallet
Step 1: Generate a Private Key
Step 2: Derive Public Key and Address
Step 3: Create a Basic Wallet Class
Creating an HD Wallet with BRC-42
Understanding BRC-42 Key Derivation
Step 1: Generate Mnemonic Seed Phrase
Step 2: Derive Master Private Key
Step 3: Implement HD Wallet with BRC-42
Advanced: Using KeyDeriver for Complex Hierarchies
UTXO Management and Balance Tracking
How UTXO Tracking Works
Transaction Creation (Basic Pattern)
Secure Key Storage Best Practices
1. Never Hard-Code Keys
2. Environment Variables (Development Only)
3. Production Key Storage
Option A: Hardware Security Modules (HSM)
Option B: Encrypted Database Storage
Option C: Secret Management Services
4. Security Checklist
5. Key Rotation Example
Complete Production Wallet Example
Frontend Wallet Alternative: WalletClient
When to Use WalletClient
WalletClient Quick Example
Testing Your Wallet
Unit Tests Example
Integration Testing on Testnet
Practice Exercises
Summary
Related Components
Related Code Features
Next Steps
Security Reminders
Last updated
