MeshCore protocol explained
Technical deep-dive into the MeshCore protocol: how messages are sent, routed and received in a decentralized mesh network
What is the MeshCore protocol?
The MeshCore protocol is the technical layer that enables devices in a mesh network to communicate with each other. It defines how messages are formatted, sent, routed and received โ without central server or internet.
Unlike traditional network protocols like TCP/IP (which uses internet) or GSM (which needs cell towers), the MeshCore protocol works completely peer-to-peer. Every device is equal and messages find their way via multiple intermediate nodes.
The protocol is built on top of LoRa (Long Range) radio technology and uses the 868 MHz frequency band in Europe. This page explains how the protocol works technically.
MeshCore protocol layers
The MeshCore protocol consists of 4 layers, similar to the OSI model:
1. Physical layer (LoRa PHY)
The physical layer uses LoRa radio modulation to transmit data wirelessly. This layer determines frequency, bandwidth, spreading factor and transmission power.
2. Link layer (LoRa MAC)
The link layer handles access control, collision detection and acknowledgements between directly connected nodes.
3. Network layer (Mesh routing)
The network layer implements mesh routing: it determines which route a message takes to get from sender to receiver via intermediate nodes.
4. Application layer (Messages)
The application layer contains the actual payload: text messages, position, telemetry, etc. This layer can be encrypted with AES-256.
MeshCore packet structure
Each message in the MeshCore network is sent as a packet with a specific structure:
[HEADER] [PAYLOAD] [CHECKSUM] HEADER (8 bytes): - Packet ID (4 bytes) - Source Address (2 bytes) - Destination Address (2 bytes) - Hop Count (1 byte) - Flags (1 byte) PAYLOAD (max 237 bytes): - Message Type (1 byte) - Encrypted Data (max 236 bytes) CHECKSUM (2 bytes): - CRC16 for data integrity
The Packet ID is unique and prevents messages from being processed multiple times. The Hop Count tracks how many times a message has been forwarded โ this prevents infinite loops. The Flags indicate whether the message is encrypted, expects an ACK, etc.
MeshCore message types
TEXT_MESSAGE (0x01)
Text message between users. Can be private (encrypted) or public.
POSITION (0x02)
GPS coordinates of a node. Automatically broadcast at set intervals.
TELEMETRY (0x03)
Sensor data like battery percentage, temperature, voltage.
NODEINFO (0x04)
Information about the node itself: name, hardware model, firmware version.
ROUTING (0x05)
Routing messages for network discovery and route updates.
ACK (0x06)
Acknowledgement: confirmation that a message was received.
How does mesh routing work?
The mesh routing algorithm determines how messages find their way through the network. MeshCore uses a combination of flood routing and intelligent hop limiting:
Flood routing principle
When a node sends a message, it broadcasts to all nodes within range. Each receiver checks if the message is for them. If not, the node forwards the message to its neighbors (with increased hop count). This process repeats until the message reaches its destination or the maximum hop limit is reached.
Hop limiting
Each message has a hop limit (typically 3-7 hops). With each forward action, the hop count increases. When the maximum is reached, the message is no longer forwarded. This prevents messages from circulating endlessly through the network and prevents network congestion.
Benefits of the MeshCore protocol
Self-healing network
If a node fails, the protocol automatically finds an alternative route.
Decentralized
No central server or infrastructure needed. The network works peer-to-peer.
End-to-end encrypted
Private messages are encrypted with AES-256. Only sender and receiver can read them.
Energy efficient
LoRa is extremely energy efficient. Devices last days to weeks on battery.
Long range
LoRa technology reaches ~1km in urban areas, 10+ km in open field.
Scalability
The network becomes stronger as more nodes participate.
Technical specifications
| Frequency (EU) | 868 MHz (ISM band, license-free) |
| Bandwidth | 125 kHz, 250 kHz, 500 kHz (configurable) |
| Spreading Factor | SF7 - SF12 (higher SF = more range, lower datarate) |
| Coding Rate | 4/5, 4/6, 4/7, 4/8 (forward error correction) |
| Max Payload | 237 bytes per packet (LoRa PHY limit) |
| Encryption | AES-256 (optional, configurable per channel) |
Frequently asked questions about the protocol
Is the MeshCore protocol compatible with Meshtastic?
MeshCore is based on the same LoRa technology and shares similar principles, but uses different protocol implementations. They are not directly compatible, but both work on 868 MHz in Europe.
How fast is data transmission in the network?
This depends on the spreading factor. With SF7 you get ~5-10 kbps, with SF12 (more range) ~250 bps. It's slow compared to WiFi, but optimized for range and energy efficiency.
Can I modify the protocol for my use case?
Yes, MeshCore is open source. You can view and modify the source code. Note that modifications may make your devices incompatible with the main network.
What happens if two messages are sent simultaneously?
The link layer uses CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance). Devices first listen if the channel is free. In case of collision, a random backoff is applied and the message is resent.
How much overhead does the protocol have?
The header is 8 bytes, checksum 2 bytes = 10 bytes overhead. For a 237 byte packet this is ~4% overhead, which is very efficient.
Does the protocol support IPv6 or other internet protocols?
No, MeshCore is a proprietary protocol specifically designed for LoRa mesh networks. It is not an internet protocol and has no IP addresses. Nodes have unique 16-bit mesh addresses.
Start with MeshCore development
Now that you understand how the MeshCore protocol works technically, you can get started. Develop your own applications, contribute to firmware, or experiment with protocol optimizations.