* Add comprehensive RSSI debugging logs - Log RSSI capture during discovery phase - Log RSSI reading after peripheral connection - Log didReadRSSI results including validation and retries - Log getPeerRSSI() calls and dictionary contents - Log RSSI transfer from temp IDs to real peer IDs - Add UI logging to trace nil RSSI values in ContentView - Track RSSI flow from Bluetooth discovery to UI display * Add detailed logging for RSSI transfer from temp ID to real peer ID - Log peripheral mapping updates during announce packet handling - Track connectedPeripherals state before and after mapping - Log RSSI transfer from peripheralRSSI to peerRSSI - Identify whether temp ID is found and properly transferred * Add peripheral lookup fallback for announce packets - Log whether peripheral is present when announce received - Add fallback to look up peripheral if not passed as parameter - This handles cases where announce is received via relay * Add comprehensive state logging to getPeerRSSI - Log connectedPeripherals mapping state - Log peripheralRSSI dictionary contents - Log UI-side RSSI lookup attempts with dictionary state - Track exactly what's in the RSSI lookup tables * Log peer list shown in UI * Ensure RSSI transfers even when no temp ID mapping exists * Add debugging for announce packets without peripheral reference * Fix build errors and add type annotations * Fix RSSI mapping for relayed announce packets - Add fallback logic to match unmapped peripherals with announced peers - Transfer RSSI from temp UUID to real peer ID when single unmapped peripheral exists - Implement periodic RSSI updates every 10 seconds for all connected peripherals - Improve RSSI debugging logs to track mapping state * Fix RSSI mapping condition for single unmapped peripheral - Remove peerNicknames.count == 0 condition that was preventing mapping - Map single unmapped peripheral to announcing peer regardless of nickname state - Remove temp RSSI entries when transferring to real peer ID - Improve logging to show successful RSSI transfers * Improve getPeerRSSI to skip temp IDs and check known peers - Skip temp IDs (non-16 character) when iterating connectedPeripherals - Add fallback to check peerNicknames for known peers without peripherals - Check both peerRSSI and peripheralRSSI for known peers - Improve RSSI lookup coverage for edge cases * Remove RSSI debug logging and fix build warnings - Remove all RSSI-related debug logging added during troubleshooting - Keep functional RSSI tracking code intact - Fix unused variable warnings in didReadRSSI and updateAllPeripheralRSSI - Clean up verbose logging while maintaining core functionality --------- Co-authored-by: jack <jackjackbits@users.noreply.github.com>
bitchat
A decentralized peer-to-peer messaging app that works over Bluetooth mesh networks. No internet required, no servers, no phone numbers. It's the side-groupchat.
Warning
Private message and channel features have not received external security review and may contain vulnerabilities. Do not use for sensitive use cases, and do not rely on its security until it has been reviewed. Now uses the Noise Protocol for identity and encryption. Public local chat (the main feature) has no security concerns.
License
This project is released into the public domain. See the LICENSE file for details.
Features
- Decentralized Mesh Network: Automatic peer discovery and multi-hop message relay over Bluetooth LE
- Privacy First: No accounts, no phone numbers, no persistent identifiers
- Cover Traffic: Timing obfuscation and dummy messages for enhanced privacy
- Private Message End-to-End Encryption: Noise Protocol
- Store & Forward: Messages cached for offline peers and delivered when they reconnect
- IRC-Style Commands: Familiar
/join,/msg,/whostyle interface - Universal App: Native support for iOS and macOS
- Emergency Wipe: Triple-tap to instantly clear all data
- Performance Optimizations: LZ4 message compression, adaptive battery modes, and optimized networking
Technical Architecture
Binary Protocol
bitchat uses an efficient binary protocol optimized for Bluetooth LE:
- Compact packet format with 1-byte type field
- TTL-based message routing (max 7 hops)
- Automatic fragmentation for large messages
- Message deduplication via unique IDs
Mesh Networking
- Each device acts as both client and peripheral
- Automatic peer discovery and connection management
- Store-and-forward for offline message delivery
- Adaptive duty cycling for battery optimization
For detailed protocol documentation, see the Technical Whitepaper.
Setup
Option 1: Using XcodeGen (Recommended)
-
Install XcodeGen if you haven't already:
brew install xcodegen -
Generate the Xcode project:
cd bitchat xcodegen generate -
Open the generated project:
open bitchat.xcodeproj
Option 2: Using Swift Package Manager
-
Open the project in Xcode:
cd bitchat open Package.swift -
Select your target device and run
Option 3: Manual Xcode Project
- Open Xcode and create a new iOS/macOS App
- Copy all Swift files from the
bitchatdirectory into your project - Update Info.plist with Bluetooth permissions
- Set deployment target to iOS 16.0 / macOS 13.0
Option 4: just
Want to try this on macos: just run will set it up and run from source.
Run just clean afterwards to restore things to original state for mobile app building and development.