# Bitcoin Network Configuration Reference ## Network Configurations ### Mainnet (Production) - **RPC Port**: 8332 - **Default Port**: 8333 - **Magic Bytes**: f9beb4d9 - **Address Prefix**: 00 (P2PKH), 05 (P2SH) - **Seed Nodes**: seed.bitcoin.sipa.be, dnsseed.bluematt.me - **Address Formats**: 1..., 3..., bc1... ### Testnet (Testing) - **RPC Port**: 18332 - **Default Port**: 18333 - **Magic Bytes**: 0b110907 - **Address Prefix**: 6f (P2PKH), c4 (P2SH) - **Seed Nodes**: testnet-seed.bitcoin.jonasschnelli.ch - **Address Formats**: m..., n..., 2..., tb1... ### Regtest (Local Development) - **RPC Port**: 18443 - **Default Port**: 18444 - **Magic Bytes**: fabfb5da - **Address Prefix**: 6f (P2PKH), c4 (P2SH) - **Seed Nodes**: None (local only) - **Address Formats**: m..., n..., 2..., bcrt1... ## Security Validation Rules ### Port Security - Avoid privileged ports (< 1024) - Use different ports for RPC and peer connections - Avoid commonly targeted ports (22, 80, 443, etc.) ### Magic Byte Validation - Must be 8-character hex string - No conflicts between networks - Follow Bitcoin protocol specifications ### Address Format Validation - Legacy addresses: Base58Check encoding - Bech32 addresses: bc1..., tb1..., bcrt1... - Network-specific prefixes enforced ### Private Key Security - WIF format validation - Entropy calculation (> 3.0 for security) - Known compromised pattern detection - Context-aware security recommendations ### RPC Credentials - Username: minimum 8 characters - Password: minimum 16 characters - Strength requirements: uppercase, lowercase, digits, special chars - Avoid common password patterns ## Security Scoring System ### Configuration Security Score (0-100) - **Port conflicts**: -20 points - **Magic byte conflicts**: -30 points - **Privileged ports**: -5 points - **Same ports**: -2 points - **Targeted ports**: -10 points - **No seed nodes**: -8 points - **Insufficient seed nodes**: -4 points ### Passphrase Strength Score (0-100) - **Length < 12 chars**: Invalid - **Character variety**: 25 points each (upper, lower, digit, special) - **Common passwords**: 0 points - **Repeating patterns**: -50 points - **Crypto-related words**: -15 points ### Security Levels - **CRITICAL** (0-30): Immediate action required - **LOW** (31-60): Security improvements needed - **MEDIUM** (61-80): Generally acceptable - **HIGH** (81-100): Secure configuration ## Error Codes and Messages ### Connection Errors - `INVALID_RPC_CREDENTIALS`: Username/password too weak - `INVALID_NETWORK_CONFIG`: Network configuration issues - `ALREADY_CONNECTED`: Cannot switch while connected ### Wallet Creation Errors - `INVALID_WALLET_NAME`: Empty, too long, or invalid characters - `WEAK_PASSPHRASE`: Passphrase too short or weak - `NOT_CONNECTED`: Must be connected to create wallet ### Private Key Errors - `INVALID_WIF_FORMAT`: Not valid WIF format - `COMPROMISED_KEY`: Known compromised pattern - `LOW_ENTROPY`: Insufficient randomness - `NOT_CONNECTED`: Must be connected to import ## Integration Guidelines ### Production Deployment 1. Use mainnet with secure RPC credentials 2. Encrypt all wallets with strong passphrases 3. Enable security auditing 4. Monitor security scores 5. Regular security reviews ### Development Environment 1. Use regtest for local development 2. Test security validation thoroughly 3. Validate error handling 4. Mock network operations 5. Security testing in isolated environment ### Testing Environment 1. Use testnet for integration testing 2. Test all network switching scenarios 3. Validate security scoring 4. Test edge cases and error conditions 5. Performance testing with multiple operations