3. Beacon data format

3.1 Advertisement layout

The beacon is the standard 31-byte Amazon Sidewalk BLE advertisement described in the Amazon Sidewalk Protocol Specification. Beacon data uses the bytes after the transmit identifier. Byte numbers are advertisement bytes. This layout supersedes the file SID_BLE_ADVERTISING_FORMAT.md that is included in SDK 2.0.0 packages, which describes an earlier advertisement version.

Bytes Field Value for a beacon with payload
0–10 Header Flags, 16-bit service UUID 0xFE03, manufacturer-specific data with company identifier 0x0171
11 Application ID (destination) 0x21 (33) by default, or 0x11 (17) when the Amazon Sidewalk cloud has configured it for the device (see below)
12 Device State Advertisement version 2 and the Device Mode: 0x41 in Normal mode, 0x4B in Location Beacon mode (see the table below)
13 Frame Indicator Time-based transmit identifier and the data indicator: 0x01 when a payload is present
14–18 Transmit identifier (TX-UUID) The device’s rotating 5-byte identifier
19–20 Sequence number 2 bytes, big-endian, carrying a 14-bit value (see Section 3.3)
21–24 Authentication tag 4 bytes
25–30 Encrypted application data 6 bytes (SID_BLE_BEACON_DATA_MAX_SIZE). A payload is always this long.

Byte 11 is 0x21 (33) by default. The Amazon Sidewalk cloud can configure a device to use 0x11 (17) instead. The SDK applies the setting, keeps it across restarts and restores 33 on a factory reset; the application does not set it. Amazon Sidewalk uses destination 17 to limit beacon forwarding for a device; no application action is needed.

Bytes 12 and 13 tell the Amazon Sidewalk cloud what the beacon carries.

Configuration Byte 12 (Device State) Byte 13 (Frame Indicator) Bytes 19–30
Beacon off 0x41 (Normal mode) 0x00 Absent
Payload, Normal mode 0x41 0x01 Sequence number, tag, data
Payload, Location Beacon mode 0x4B (Device Mode 0101) 0x01 Sequence number, tag, data
Location Beacon mode without payload 0x4B 0x00 Sequence number only (bytes 19–20); bytes 21–30 absent

Bit 1 of byte 13 is the response-requested flag, set by the response_requested field of the configuration (see Section 4.2). It adds 0x02 to the byte 13 values in the table: 0x03 for a payload with the flag set, 0x02 for a configuration with the flag only. It must stay clear in this revision.

3.2 Encryption

The SDK encrypts the payload in two layers, as it does for a connected uplink. Both layers use time-based keys that the SDK derives from the device’s application key and network key; the device’s long-term keys are never used directly. The network layer uses AES in Galois/Counter Mode (AES-GCM) with a 4-byte authentication tag. The initialization vector (IV) of the network layer is derived from the device identity, the current 15-minute time slot and the sequence number, so every advertisement content is unique. The three header bytes 11–13 are bound to the tag as additional authenticated data (AAD), so a beacon cannot be replayed under a different destination, mode or frame indicator.

The application does not handle any key material. Both layers are removed on the Amazon side. Your application receives the payload decrypted.

3.3 Sequence number

The sequence number tells the Amazon Sidewalk cloud that the beacon content has changed.

  • It is a 14-bit value, 0 to 16383. After 16383 it wraps to 0.
  • It takes a random value each time the BLE link is started.
  • It increments by one each time the application changes the configuration: a different payload, a different beacon mode, a different response-requested flag, or switching the beacon off.
  • It does not change when the application sets the same configuration again, when the application changes only the update period, or when the SDK re-encrypts the unchanged payload (see Section 3.4).
  • If the application sets an update period, the SDK increments the sequence number by itself at the end of every period. The period is counted from the last configuration change. A configuration change restarts it.

The cloud compares sequence numbers for equality, not for order. A restart of the device, which produces a new random value, is handled like any other change.

3.4 Identifier rotation and re-encryption

The transmit identifier rotates every 15 minutes, as for every Amazon Sidewalk BLE device. At the same 15-minute boundary the SDK re-encrypts the payload with the new time slot, so the authentication tag and the encrypted bytes change while the sequence number and the plaintext stay the same. The cloud treats such a beacon as unchanged. A change of the destination (see Section 3.1) also re-encrypts the beacon, because byte 11 is part of the authenticated data; the sequence number is kept.