Moving to 2-Byte Prefixes
The Bay Area MeshCore network is moving to 2-byte prefixes for repeaters, and we need existing repeater owners to update their devices to make this happen. This post is for those of you who already have a repeater running on the network.
Setting up a new repeater? The repeater setup guide already covers 2-byte prefix configuration — just follow those steps and you’re good to go.
What Are Prefixes and Why Does the Byte Size Matter?
Every repeater on the mesh has a unique public key. The first portion of that key — the prefix — is what the mesh uses to determine how to route messages. A 1-byte prefix supports up to 256 unique values. A 2-byte prefix supports up to 65,536. As the Bay Area network has scaled we now have more active repeaters than available unique 1-byte prefixes. Moving to 2-byte prefixes allows us to continue to scale and operate without prefix collisions.
There’s also a practical benefit for network analysis tools like CoreScope and MeshMapper: with the same 1-byte prefixes being used by multiple repeaters it makes it hard to distinguish between them. A 2-byte prefix makes disambiguating repeaters in network analysis much more reliable.
What You Need to Do
1. Update your repeater firmware to 1.14 or later
Firmware 1.14 introduced support for multi-byte prefixes, and your repeater will need to updated prior to moving your repeater from a 1-byte prefix to a 2-byte prefix.
Flash the latest firmware using the MeshCore Flasher in Chrome if you’re connecting directly to your repeater via USB. If you’re doing an OTA update, see the OTA firmware update instructions in the MeshCore FAQ.
2. Verify your prefix is unique under 2-byte
With 65,536 possible 2-byte prefixes, what your 2-byte prefix will be based on your repeater’s existing public key is very likely already unique — but it’s worth confirming.
Open CoreScope Analytics, select the Prefix Tool, enter your 2-byte prefix or full public key, and confirm your prefix isn’t already in use by another active Bay Area repeater.
If there’s a collision, the CoreScope Prefix Tool can determine an available 2-byte prefix for you to use and guide you through generating new keys.
3. Set your repeater’s path hash mode to 2-byte
Connect to your repeater via the Repeater Setup tool or connect to it remotely via a companion device, and open the Console.
If you needed to generate new keys to acheive a unique 2-byte prefix, run the following commands. Otherwise you can skip this step and go to the step for enabling 2-byte hash mode.
set prv.key <your private key>
reboot
Enable 2-byte hash mode by running the following commands:
set path.hash.mode 1
reboot
Notes:
path.hash.mode 1is not a typo, it is a zero based setting where 0 is the default for 1-byte and 1 is for 2-byte. Thepath.hash.modesetting affects the path hash size in your repeater’s own advert broadcasts — it does not change which packets your repeater forwards. A 1.14+ repeater always forwards 1-, 2-, and 3-byte packets regardless of this setting.
4. Send an advert
Your repeater is now all set, just send out your first advert to let the network know about your repeater’s new 2-byte prefix.
What About Companions?
Nothing to do yet. Keep your companion’s path hash size at the 1-byte default. Older repeaters (pre-1.14) silently drop packets with larger path hashes, so changing companions before the network is ready would cause messages to go undelivered. We’ll post an update once enough repeaters have updated and it’s safe to switch.
Questions?
Ask in the Bay Area MeshCore Discord.