|
| 1 | +# Lightning Wallet Configuration System |
| 2 | + |
| 3 | +This app now supports user-configurable node settings with persistent storage. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### 🔐 **User-Generated Mnemonics** |
| 8 | +- Users can generate their own secure mnemonics |
| 9 | +- Mnemonics are stored securely using SharedPreferences |
| 10 | +- Option to generate new mnemonics (creates new wallet) |
| 11 | + |
| 12 | +### 🏷️ **Custom Node Names** |
| 13 | +- Users can set their own node name |
| 14 | +- Node name is displayed in the app title |
| 15 | +- Stored persistently for future sessions |
| 16 | + |
| 17 | +### 🔌 **Configurable Ports** |
| 18 | +- Users can choose from available ports (9735-9740) |
| 19 | +- Prevents port conflicts when running multiple emulators |
| 20 | +- Port selection is stored and remembered |
| 21 | + |
| 22 | +### 💾 **Persistent Storage** |
| 23 | +- All settings are saved using SharedPreferences |
| 24 | +- Settings persist across app restarts |
| 25 | +- No hardcoded values for production use |
| 26 | + |
| 27 | +## First Run Experience |
| 28 | + |
| 29 | +When users first launch the app, they'll see a beautiful onboarding flow: |
| 30 | + |
| 31 | +1. **Step 1: Generate Mnemonic** |
| 32 | + - Tap "Generate Mnemonic" to create a new wallet |
| 33 | + - Copy the mnemonic to clipboard |
| 34 | + - Warning about keeping it safe |
| 35 | + |
| 36 | +2. **Step 2: Set Node Name** |
| 37 | + - Enter a custom node name |
| 38 | + - This will be visible to other Lightning Network participants |
| 39 | + |
| 40 | +3. **Step 3: Choose Port** |
| 41 | + - Select from available ports (9735-9740) |
| 42 | + - Different ports allow multiple emulators on same machine |
| 43 | + |
| 44 | +## Settings Management |
| 45 | + |
| 46 | +Users can access settings via the settings icon in the app bar: |
| 47 | + |
| 48 | +- **View Current Settings**: See current mnemonic, node name, and port |
| 49 | +- **Update Settings**: Change node name or port |
| 50 | +- **Generate New Mnemonic**: Create a new wallet (warning about data loss) |
| 51 | +- **Copy Mnemonic**: Copy current mnemonic to clipboard |
| 52 | + |
| 53 | +## Multiple Emulator Support |
| 54 | + |
| 55 | +To run multiple emulators on the same machine: |
| 56 | + |
| 57 | +1. **First Emulator**: Use default settings (port 9735) |
| 58 | +2. **Second Emulator**: Go to Settings → Change Port to 9736 |
| 59 | +3. **Additional Emulators**: Use ports 9737, 9738, etc. |
| 60 | + |
| 61 | +Each emulator will have its own: |
| 62 | +- Unique port |
| 63 | +- Separate storage directory |
| 64 | +- Independent wallet |
| 65 | + |
| 66 | +## Technical Implementation |
| 67 | + |
| 68 | +### Files Created/Modified: |
| 69 | + |
| 70 | +- `lib/services/settings_service.dart` - Persistent storage service |
| 71 | +- `lib/screens/onboarding_screen.dart` - First-run setup flow |
| 72 | +- `lib/screens/settings_screen.dart` - Settings management UI |
| 73 | +- `lib/config/node_config.dart` - Updated to use user settings |
| 74 | +- `lib/main.dart` - Added startup flow and routing |
| 75 | +- `lib/screens/dashboard_screen.dart` - Added settings button |
| 76 | + |
| 77 | +### Dependencies: |
| 78 | +- `shared_preferences: ^2.2.3` - For persistent storage |
| 79 | +- `google_fonts: ^6.2.1` - For beautiful typography |
| 80 | +- `qr_flutter: ^4.1.0` - For QR code display |
| 81 | + |
| 82 | +## Security Notes |
| 83 | + |
| 84 | +- Mnemonics are stored in SharedPreferences (device storage) |
| 85 | +- Consider implementing encryption for production use |
| 86 | +- Users are warned about keeping mnemonics safe |
| 87 | +- Option to generate new mnemonics creates completely new wallets |
| 88 | + |
| 89 | +## Testing Multiple Emulators |
| 90 | + |
| 91 | +1. Start first emulator with default settings |
| 92 | +2. Start second emulator and go through onboarding |
| 93 | +3. Choose different port (e.g., 9736) |
| 94 | +4. Both emulators can run simultaneously without conflicts |
| 95 | +5. Each has its own wallet and can connect to each other |
| 96 | + |
| 97 | +## Future Enhancements |
| 98 | + |
| 99 | +- [ ] Encrypt stored mnemonics |
| 100 | +- [ ] Add mnemonic validation |
| 101 | +- [ ] Support for custom port ranges |
| 102 | +- [ ] Backup/restore settings |
| 103 | +- [ ] Import existing mnemonics |
0 commit comments