What Are the Three Categories of Channels Supported by BitChat?
BitChat organizes all communications into three distinct channel categories: the global public Mesh channel, precision-based Geohash location channels, and encrypted Private direct-message conversations.
The permissionlesstech/bitchat repository implements a layered communication protocol that segments messaging into these three categories of channels supported by BitChat. Each category serves a specific communication pattern, from global broadcasts to location-scoped discussions and secure peer-to-peer exchanges.
The Three Channel Categories Defined
Mesh (Global Public) Channel
The Mesh channel serves as the default public communication layer where all users automatically participate. This global channel carries unfiltered public conversation without location constraints, enabling network-wide announcements and open discussions.
In bitchat/Protocols/LocationChannel.swift, the ChannelID enum defines this category as the .mesh case. The mesh channel requires no initialization parameters—users join automatically upon connecting to the BitChat network.
Geohash Location Channels
Geohash location channels provide proximity-based communication by deriving channel identifiers from the user's current geohash coordinates. These channels support multiple precision levels—ranging from region down to specific buildings—creating isolated conversation spaces for different geographic scopes.
The implementation uses ChannelID.location(GeohashChannel) with the GeohashChannelLevel enum to manage precision. The bitchat/App/LocationChannelsModel.swift file handles the selection and persistence of these location-based channels, while bitchat/Views/LocationChannelsSheet.swift provides the UI for switching between different geohash levels.
Private Direct-Message Conversations
Private conversations establish one-to-one encrypted channels between two peers, completely isolated from public mesh and location channels. These channels use the recipient's public key as the unique identifier, ensuring end-to-end encrypted delivery.
The ChannelID.privateConversation case in LocationChannel.swift represents this category. Unlike public channels, private conversations route through bitchat/App/ConversationStore.swift, which manages the activeChannel state and ensures messages encrypt exclusively for the target peer's public key.
Working with Channel IDs in Swift
The ChannelID enum in bitchat/Protocols/LocationChannel.swift provides a type-safe interface for referencing all three categories. Below are practical examples for instantiating each channel type:
import Bitchat
// 1️⃣ Mesh channel – the default public channel
let meshChannel: ChannelID = .mesh
// 2️⃣ Geohash location channel – e.g., city‑level channel for geohash “9q8yy”
let cityGeohash = GeohashChannel(level: .city, geohash: "9q8yy")
let cityChannel: ChannelID = .location(cityGeohash)
// 3️⃣ Private direct‑message channel – chat with a specific peer
let peerPublicKey = try! PublicKey(hex: "02a7f…") // (placeholder)
let dmChannel: ChannelID = .privateConversation(peerPublicKey)
How Channel Routing Works
The ConversationStore.swift file manages message routing by maintaining an activeChannel property that holds the currently selected ChannelID. When users switch channels through the UI layer in LocationChannelsSheet.swift, the store updates its state and filters incoming messages based on the three category types:
- Mesh messages broadcast globally without filtering
- Geohash messages match against the user's current location precision
- Private messages decrypt only when the recipient's public key matches the channel identifier
Summary
BitChat's architecture relies on these three distinct channel categories to balance public accessibility with privacy and location relevance:
- Mesh (Global Public) – Always-available global channel for open network communication, defined as
ChannelID.meshinLocationChannel.swift - Geohash Location – Proximity-scoped channels using
ChannelID.location(GeohashChannel)with configurable precision levels from region to building - Private Conversations – Encrypted peer-to-peer channels identified by
ChannelID.privateConversation, routing throughConversationStore.swiftfor secure delivery
Frequently Asked Questions
How does BitChat determine which Geohash precision level to use for location channels?
BitChat uses the GeohashChannelLevel enum to define six distinct precision levels: region, province, city, neighbourhood, block, and building. The LocationChannelsModel.swift file manages the selection logic, allowing users to subscribe to broader regional discussions or hyper-local building-specific channels based on their current geohash coordinates.
What distinguishes Mesh channels from Geohash location channels?
While both are public communication channels, Mesh channels (ChannelID.mesh) operate globally without geographic filtering, delivering messages to all connected peers. Geohash channels (ChannelID.location) scope messages to specific geographic boundaries derived from the user's current location hash, enabling contextually relevant local discussions.
Are private conversations in BitChat end-to-end encrypted?
Yes. The ChannelID.privateConversation case establishes encrypted channels between exactly two peers using the recipient's public key for addressing. According to the source in LocationChannel.swift, these channels isolate messages from the public mesh and location channels, ensuring only the intended recipient can decrypt and read the content.
Can a user participate in multiple channel categories simultaneously?
Yes. The ConversationStore.swift implementation maintains separate routing logic for each channel type, allowing users to receive global Mesh broadcasts, subscribe to multiple Geohash precision levels, and maintain concurrent private conversations. The activeChannel property tracks the current UI focus, but the underlying network layer processes messages from all three categories independently.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →