Deep Dive: Mycel Technical Reference¶
This section provides comprehensive technical documentation for developers who want to understand Mycel's internals.
Architecture Overview¶
Mycel is a Delay-Tolerant Networking (DTN) application designed for communication without reliable internet. Messages are stored locally and forwarded opportunistically when peers are encountered.
flowchart TB
subgraph APP ["Application Layer"]
direction LR
UI["Jetpack Compose UI"]
VM["ViewModels"]
SVC["MeshService"]
end
subgraph DTN ["DTN Layer"]
direction LR
REPO["BundleRepository"]
ROUTE["RoutingFacade"]
ACK["AckPathLearner"]
end
subgraph TRANSPORT ["Transport Layer"]
direction LR
REG["TransportRegistry"]
NEARBY["Nearby Connections"]
NOSTR["Nostr Transport"]
end
APP --> DTN --> TRANSPORT
Core Concepts¶
| Concept | Description | Deep Dive |
|---|---|---|
| Bundles | Self-contained message units with headers, payload, and routing metadata | Bundle Structure |
| Routing | PRoPHET probability routing + Spray-and-Wait copy control | Routing Overview |
| Transports | Unified abstraction over Nearby Connections and Nostr relays | Transports |
| Groups | Private groups with CRDT-synchronized membership | Groups |
| Encryption | End-to-end encryption for DMs and groups | Encryption |
Key Properties¶
True DTN¶
- Messages can take days to deliver via human movement
- All nodes are equal peers (no central server)
- Store-and-forward at every hop
Unified Transport¶
- Nearby Connections (BLE + WiFi) and Nostr relays form one logical network
- Users see no difference between transport methods
- Routing automatically selects the best available path
End-to-End Security¶
- DMs encrypted with ECIES (X25519 + AES-256-GCM)
- Group messages encrypted with shared symmetric key
- Relaying nodes cannot read message contents
Module Map¶
| Module | Purpose | Source |
|---|---|---|
:app |
Main application, MeshService, UI wiring | app/ |
:core:nearby |
Nearby Connections transport, session management | core/nearby/ |
:core:dtn |
Bundle storage, routing logic, persistence | core/dtn/ |
:core:transport |
Transport abstraction, Nostr implementation | core/transport/ |
:feature:ui |
Jetpack Compose screens and ViewModels | feature/ui/ |
Section Index¶
Architecture¶
- System Overview - Three-layer architecture with module map
- Message Flow - End-to-end delivery sequence
Bundles¶
- Bundle Structure - Header and payload fields
- Bundle Lifecycle - State machine: NEW → DEL
- Message Types - Control message reference
- Encryption - DM and group encryption
Routing¶
- Routing Overview - Decision tree and algorithms
- PRoPHET Algorithm - Probability-based routing
- ACK Path Learning - Delivery confirmation routing
Transports¶
- Nearby Transport - Session FSM, handshake, transfer
- Nostr Transport - Relay pool, gift-wrap encryption
Groups¶
- Private Groups - Creation, invites, membership
- Channels - Read-only broadcast
- CRDT Membership - 2P-Set conflict resolution