Skip to main content

Path Discovery and Route Learning

Path Discovery and Route Learning

MeshCore uses an intelligent path discovery system rather than simple flooding. This design means the network gets quieter — not louder — as usage increases.

How Path Discovery Works: Step by Step

  1. First message to an unknown destination — MeshCore floods the network to locate the target node. Every node relays the message until it reaches the destination.
  2. Destination receives the message and sends an ACK — The acknowledgement travels back along the discovered path.
  3. Route is cached — Both the original sender and all relay nodes along the path record the route. This is the key step: the network has now “learned” a path.
  4. Subsequent messages use the established path — Only nodes on the known route retransmit. All other nodes stay silent.
  5. Retry and re-discover — After 3 consecutive failed retries on a known path, MeshCore discards the cached route and floods again to find a new one.

Group and Public Channel Messages

Group messages and public channel broadcasts always flood the network, because they are addressed to multiple destinations and no single path can serve all recipients. Path caching only applies to direct (unicast) messages.

Path Hash Mode

The granularity of the cached path identifier is configurable via the CLI:

set path.hash.mode 0   # 1-byte path hash (low overhead)
set path.hash.mode 1   # 2-byte path hash (default; balanced)
set path.hash.mode 2   # 3-byte path hash (highest precision)

A larger hash reduces the chance of path collision in dense networks at the cost of slightly larger packet headers.

Advertisement Broadcasts

Nodes periodically broadcast advertisements so neighbors can discover them. The interval is configurable:

set flood.advert.interval 6   # broadcast every 6 hours

To trigger an immediate advertisement (useful after changing location or name):

advert