Skip to content

Latest commit

 

History

History
333 lines (244 loc) · 7.72 KB

File metadata and controls

333 lines (244 loc) · 7.72 KB

1-Tap Node App - iOS & Android

A minimal, production-ready federated learning node app for iOS and Android. Join the Sovereign Map network with a single tap.

Features

1-Tap Join - One button to start federated learning ✅ Real-time Metrics - Live accuracy, loss, and round tracking ✅ Offline-Capable - Train locally, sync when online ✅ Lightweight - <50MB download ✅ Byzantine Support - Test network fault tolerance ✅ Cross-Platform - Native iOS (SwiftUI) & Android (Kotlin Compose)

Download & Install

iOS

Option 1: TestFlight (Easy)

1. Visit: https://testflight.apple.com/join/sovereignmap
2. Tap "Install"
3. Launch and tap "Join Network"

Option 2: App Store (Coming Soon)

Search "Sovereign Node" in App Store

Option 3: Build from Source

cd mobile-apps/ios-node-app
xcode SovereignNodeApp.xcodeproj
# Select target, then Run (⌘R)

Android

Option 1: Google Play (Coming Soon)

Search "Sovereign Node" in Google Play Store

Option 2: Build from Source

cd mobile-apps/android-node-app
./gradlew build
./gradlew installDebug
# Or use Android Studio: File > Open > android-node-app

Option 3: APK Direct Download

Download: https://releases.sovereignmap.io/node-app-latest.apk
Tap to install

Quick Start

iOS

  1. Launch App - Opens to main screen
  2. Tap "Join Network" - Starts training immediately
  3. Watch Metrics - See accuracy improve in real-time
  4. Tap "Leave Network" - Stop participating

Android

  1. Launch App - Opens to main screen
  2. Tap "Join Network" - Starts training immediately
  3. Watch Metrics - See accuracy improve in real-time
  4. Tap "Leave Network" - Stop participating

Settings

Both iOS and Android apps support:

  • Server URL - Change aggregator address
  • Epochs - Training iterations per round (1-10)
  • Byzantine Mode - Send corrupted updates for testing
  • Node ID - View your unique identifier

Access via:

  • iOS: Scroll to bottom, tap "Settings"
  • Android: Tap ⚙️ gear icon

How It Works

Local Training (On Device)

  1. Download Model - Latest aggregated model from network
  2. Load Local Data - MNIST training subset (pre-installed)
  3. Train Locally - Neural network training with differential privacy
  4. Upload Update - Encrypted model parameters to aggregator

Convergence

Watch your node participate in federated learning:

  • Round - FL coordination number (increments every 30 sec)
  • Accuracy - Model accuracy % (target: 82%+)
  • Loss - Training loss (target: <0.5)

Architecture

UI Layer

  • iOS: SwiftUI (native)
  • Android: Jetpack Compose (native)

Model Training

  • Framework: PyTorch (via Go mobile bindings)
  • Privacy: Differential privacy (ε=1.0)
  • Data: MNIST subset (pre-cached)

Communication

  • Protocol: gRPC (binary efficient)
  • Security: TLS 1.3 (mTLS)
  • Signatures: RSA-PSS (message authentication)

Performance

  • CPU: Single-threaded, minimal overhead
  • Memory: 50-150MB total
  • Battery: ~5mW per training round
  • Network: ~5-10MB per round

Build from Source

Store Wrapper Packages

Production packaging wrappers are now available for both stores:

  • Android Play Store wrapper:

    • mobile-apps/android-node-app/store-wrapper/
    • Build script: mobile-apps/android-node-app/store-wrapper/build-release-android.sh
    • Validator: mobile-apps/android-node-app/store-wrapper/validate-store-assets.sh
  • Apple App Store wrapper:

    • mobile-apps/ios-node-app/store-wrapper/
    • Build script: mobile-apps/ios-node-app/store-wrapper/build-release-ios.sh
    • Validator: mobile-apps/ios-node-app/store-wrapper/validate-store-assets.sh

Each wrapper includes:

  • release build scripts
  • store metadata templates
  • signing/config templates
  • baseline privacy/compliance files

Run validators before producing release artifacts.

iOS

Prerequisites:

  • macOS 12+
  • Xcode 14+
  • Swift 5.7+
  • Cocoapods

Steps:

cd mobile-apps/ios-node-app

# Install dependencies
pod install

# Open workspace
open SovereignNodeApp.xcworkspace

# Build & Run (⌘R)
# Or from CLI:
xcodebuild -scheme SovereignNodeApp -configuration Release build

Android

Prerequisites:

  • Android Studio 2022.1+
  • Kotlin 1.8+
  • API 26+ (Android 8.0+)

Steps:

cd mobile-apps/android-node-app

# Build APK
./gradlew build

# Install to connected device
./gradlew installDebug

# Or open in Android Studio and Run (Shift+F10)

API Integration

The app connects to the Sovereign Map backend at:

Default: api.sovereignmap.io:8080
Custom: Configure in Settings

Endpoints Used

POST /join                   # Register node
POST /train                  # Send model update
GET  /convergence            # Get network metrics
POST /leave                  # Unregister node

Troubleshooting

"Can't Connect to Server"

1. Check Settings → Server URL
2. Ensure device on same network as aggregator
3. Verify aggregator is running: curl http://api.sovereignmap.io:8000/health

"Training Not Starting"

1. Tap "Leave Network" then "Join Network" again
2. Check system storage (need 100MB+ free)
3. Force-quit app and relaunch

"Low Accuracy"

- Normal: Accuracy ramps from ~65% to 82%+ over 50 rounds
- Check: Are other nodes connected? (Settings shows total nodes)

"Battery Draining"

- Training uses minimal power (~5mW)
- Check: Phone might be hot (reduce epochs in Settings)
- Solution: Leave network when not needed

Network Requirements

  • Minimum: 1MB/s connection
  • Optimal: 10MB/s+ (fiber/5G)
  • Offline Support: Yes (queues updates)
  • Data Usage: ~5-50MB per day

Privacy & Security

Local Training - Data never leaves device ✅ Encrypted - TLS 1.3 for all communication ✅ Signatures - RSA-PSS message authentication ✅ Minimal Permissions - Network only (no location, contacts, etc.)

Permissions

iOS

  • Network - Connect to aggregator

Android

  • INTERNET - Connect to aggregator
  • ACCESS_NETWORK_STATE - Check connection type

Data Storage

App stores locally:

  • Model weights - Updated each round (~50MB)
  • Training data - MNIST subset (pre-cached)
  • Metrics - 30-day history (~1MB)

Total: ~51MB on disk

All data deleted when app uninstalled.

Performance

Training Time Per Round

  • iPhone 12+: ~2-5 seconds
  • iPhone 11: ~5-10 seconds
  • Pixel 6+: ~2-5 seconds
  • Pixel 4a: ~5-10 seconds

Network Latency

  • Aggregation: ~100-500ms
  • Model upload: ~500ms-2s (5MB)
  • Model download: ~500ms-2s (5MB)

Support

Contributing

Want to improve the app? Contributions welcome!

1. Fork repository
2. Create feature branch
3. Make changes
4. Submit pull request

Roadmap

  • Offline queue (queue updates when offline)
  • Custom data upload (train on your data)
  • Model export (save trained models)
  • Advanced metrics (latency, bandwidth tracking)
  • Multi-aggregator failover
  • Hardware acceleration (GPU/Neural Engine)

License

MIT License - Same as main project

Changelog

v1.0.0 (Current)

  • ✅ iOS app (SwiftUI)
  • ✅ Android app (Kotlin Compose)
  • ✅ 1-tap join functionality
  • ✅ Real-time metrics display
  • ✅ Settings configuration
  • ✅ TLS/mTLS security

Version: 1.0.0
Status: ✅ Production Ready
Last Updated: February 2026

Ready to train on mobile! 📱🚀