permissionlesstech / bitchat
permissionlesstech / bitchat
bitchat A decentralized peer-to-peer messaging app with dual transport architecture: local Bluetooth mesh networks for offline communication and internet-based Nostr protocol for global reach. No accounts, no phone numbers, no central servers. It’s the side-groupchat. bitchat.free 📲 App Store
bitchat 一款去中心化的点对点通讯应用,采用双重传输架构:用于离线通信的本地蓝牙网状网络(Bluetooth mesh),以及用于全球连接的基于互联网的 Nostr 协议。无需账户、无需手机号、无需中央服务器。它是你的侧边群聊工具。bitchat.free 📲 App Store
License This project is released into the public domain. See the LICENSE file for details.
许可证 本项目已发布至公共领域。详情请参阅 LICENSE 文件。
Features
- Dual Transport Architecture: Bluetooth mesh for offline + Nostr protocol for internet-based messaging
- Location-Based Channels: Geographic chat rooms using geohash coordinates over global Nostr relays
- Intelligent Message Routing: Automatically chooses best transport (Bluetooth → Nostr fallback)
- Decentralized Mesh Network: Automatic peer discovery and multi-hop message relay over Bluetooth LE
- Privacy First: No accounts, no phone numbers, no persistent identifiers
- Private Message End-to-End Encryption: Noise Protocol for mesh, NIP-17 for Nostr
- IRC-Style Commands: Familiar /slap, /msg, /who style 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
功能特性
- 双重传输架构: 用于离线的蓝牙网状网络 + 用于互联网消息的 Nostr 协议
- 基于位置的频道: 通过全球 Nostr 中继器,利用 geohash 坐标实现地理位置聊天室
- 智能消息路由: 自动选择最佳传输方式(优先蓝牙 → 备选 Nostr)
- 去中心化网状网络: 通过低功耗蓝牙(BLE)实现自动节点发现和多跳消息中继
- 隐私至上: 无账户、无手机号、无持久化标识符
- 私信端到端加密: 网状网络使用 Noise 协议,Nostr 使用 NIP-17 标准
- IRC 风格命令: 熟悉的 /slap, /msg, /who 风格界面
- 通用应用: 原生支持 iOS 和 macOS
- 紧急擦除: 三击即可瞬间清除所有数据
- 性能优化: LZ4 消息压缩、自适应电池模式及网络优化
Technical Architecture BitChat uses a hybrid messaging architecture with two complementary transport layers:
技术架构 BitChat 采用混合消息架构,包含两个互补的传输层:
Bluetooth Mesh Network (Offline)
- Local Communication: Direct peer-to-peer within Bluetooth range
- Multi-hop Relay: Messages route through nearby devices (max 7 hops)
- No Internet Required: Works completely offline in disaster scenarios
- Noise Protocol Encryption: End-to-end encryption with forward secrecy
- Binary Protocol: Compact packet format optimized for Bluetooth LE constraints
- Automatic Discovery: Peer discovery and connection management
- Adaptive Power: Battery-optimized duty cycling
蓝牙网状网络(离线)
- 本地通信: 蓝牙范围内的直接点对点通信
- 多跳中继: 消息通过附近设备路由(最多 7 跳)
- 无需互联网: 在灾难场景下可完全离线工作
- Noise 协议加密: 具备前向安全性的端到端加密
- 二进制协议: 针对蓝牙 LE 限制优化的紧凑数据包格式
- 自动发现: 节点发现与连接管理
- 自适应功耗: 电池优化后的占空比循环
Nostr Protocol (Internet)
- Global Reach: Connect with users worldwide via internet relays
- Location Channels: Geographic chat rooms using geohash coordinates
- 290+ Relay Network: Distributed across the globe for reliability
- NIP-17 Encryption: Gift-wrapped private messages for internet privacy
- Ephemeral Keys: Fresh cryptographic identity per geohash area
Nostr 协议(互联网)
- 全球覆盖: 通过互联网中继器与全球用户连接
- 位置频道: 使用 geohash 坐标的地理位置聊天室
- 290+ 中继网络: 分布在全球各地,确保可靠性
- NIP-17 加密: 使用“礼盒包装”(Gift-wrapped)私信,保障互联网隐私
- 临时密钥: 每个 geohash 区域使用全新的加密身份
Channel Types
- mesh #bluetooth
- Transport: Bluetooth Low Energy mesh network
- Scope: Local devices within multi-hop range
- Internet: Not required
- Use Case: Offline communication, protests, disasters, remote areas
- Location Channels (block #dr5rsj7, neighborhood #dr5rs, country #dr)
- Transport: Nostr protocol over internet
- Scope: Geographic areas defined by geohash precision
- block (7 chars): City block level
- neighborhood (6 chars): District/neighborhood
- city (5 chars): City level
- province (4 chars): State/province
- region (2 chars): Country/large region
- Internet: Required (connects to Nostr relays)
- Use Case: Location-based community chat, local events, regional discussions
频道类型
- mesh #bluetooth
- 传输:低功耗蓝牙网状网络
- 范围:多跳范围内的本地设备
- 互联网:无需
- 用例:离线通信、抗议活动、灾难救援、偏远地区
- 位置频道(街区 #dr5rsj7,社区 #dr5rs,国家 #dr)
- 传输:基于互联网的 Nostr 协议
- 范围:由 geohash 精度定义的地理区域
- 街区 (7 字符):城市街区级别
- 社区 (6 字符):行政区/社区
- 城市 (5 字符):城市级别
- 省份 (4 字符):州/省级别
- 区域 (2 字符):国家/大区域
- 互联网:需要(连接至 Nostr 中继器)
- 用例:基于位置的社区聊天、本地活动、区域讨论
Direct Message Routing Private messages use intelligent transport selection:
- Bluetooth First (preferred when available): Direct connection with established Noise session. Fastest and most private option.
- Nostr Fallback (when Bluetooth unavailable): Uses recipient’s Nostr public key. NIP-17 gift-wrapping for privacy. Routes through global relay network.
- Smart Queuing (when neither available): Messages queued until transport becomes available. Automatic delivery when connection established.
私信路由 私信采用智能传输选择机制:
- 优先蓝牙(可用时优先): 与已建立的 Noise 会话直接连接。这是最快且最私密的选项。
- 备选 Nostr(蓝牙不可用时): 使用接收者的 Nostr 公钥。通过 NIP-17 礼盒加密保障隐私,并经由全球中继网络路由。
- 智能队列(两者均不可用时): 消息会被排队,直到传输方式可用。连接建立后自动投递。
For detailed protocol documentation, see the Technical Whitepaper. 详细协议文档请参阅技术白皮书。
Setup
Option 1: Using Xcode
cd bitchat
open bitchat.xcodeproj
To run on a device there’re a few steps to prepare the code:
- Clone the local configs:
cp Configs/Local.xcconfig.example Configs/Local.xcconfig - Add your Developer Team ID into the newly created
Configs/Local.xcconfig - Bundle ID would be set to
chat.bitchat.<team_id>(unless you set to something else) - Entitlements need to be updated manually (TODO: Automate): Search and replace
group.chat.bitchatwithgroup.<your_bundle_id>(e.g.group.chat.bitchat.ABC123)
安装设置
选项 1:使用 Xcode
cd bitchat
open bitchat.xcodeproj
要在设备上运行,需执行以下步骤准备代码:
- 克隆本地配置:
cp Configs/Local.xcconfig.example Configs/Local.xcconfig - 将你的开发者团队 ID 添加到新创建的
Configs/Local.xcconfig中 - Bundle ID 将被设置为
chat.bitchat.<team_id>(除非你另行设置) - 需手动更新授权文件(待办:自动化此步骤):搜索并替换
group.chat.bitchat为group.<your_bundle_id>(例如group.chat.bitchat.ABC123)
Option 2: Using just
brew install 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.
选项 2:使用 just
brew install just
想在 macOS 上尝试:运行 just run 将进行设置并从源码运行。之后运行 just clean 可将环境恢复至原始状态,以便进行移动端应用的构建与开发。
Localization
Base app resources live under bitchat/Localization/Base.lproj/. Add new copy to Localizable.strings and plural rules to Localizable.stringsdict. Share extension strings are separate in bitchatShareExtension/Localization/Base.lproj/Localizable.strings. Prefer keys that describe intent (app_info.features.offline.title) and reuse existing ones where possible. Run xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug CODE_SIGNING_ALLOWED=NO build to compile-check any localization updates.
本地化
基础应用资源位于 bitchat/Localization/Base.lproj/ 下。请将新文案添加到 Localizable.strings,并将复数规则添加到 Localizable.stringsdict。共享扩展(Share extension)的字符串位于 bitchatShareExtension/Localization/Base.lproj/Localizable.strings。建议优先使用描述意图的键名(如 app_info.features.offline.title),并尽可能复用现有键名。运行 xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug CODE_SIGNING_ALLOWED=NO build 以编译检查本地化更新。