2026-03-23 22:29:04 +01:00
---
title: RELIABLE-CHANNEL-API
name: Reliable Channel API definition
category: Standards Track
status: raw
tags: [reliability, application, api, sds, segmentation]
editor: Logos Messaging Team
---
## Table of contents
<!-- TOC -->
* [Table of contents ](#table-of-contents )
* [Abstract ](#abstract )
* [Motivation ](#motivation )
* [Syntax ](#syntax )
* [API design ](#api-design )
* [Architectural position ](#architectural-position )
2026-04-24 12:10:41 +02:00
* [IDL ](#idl )
2026-04-28 00:39:51 +02:00
* [Procedures ](#procedures )
* [Outgoing message processing ](#outgoing-message-processing )
* [Incoming message processing ](#incoming-message-processing )
* [Rate limiting ](#rate-limiting )
* [Encryption ](#encryption )
2026-04-27 16:34:17 +02:00
* [The Reliable Channel API ](#the-reliable-channel-api )
* [Channel lifecycle ](#channel-lifecycle )
* [Channel usage ](#channel-usage )
* [Node configuration ](#node-configuration )
* [Type definitions ](#type-definitions )
2026-03-23 22:29:04 +01:00
* [Components ](#components )
* [Segmentation ](#segmentation )
* [Scalable Data Sync (SDS) ](#scalable-data-sync-sds )
* [Rate Limit Manager ](#rate-limit-manager )
* [Encryption Hook ](#encryption-hook )
* [Security/Privacy Considerations ](#securityprivacy-considerations )
* [Copyright ](#copyright )
<!-- TOC -->
## Abstract
This document specifies the **Reliable Channel API** ,
2026-04-23 21:47:51 +02:00
an application-level interface that sits between the application layer and the [MESSAGING-API ](/standards/application/messaging-api.md ) plus [P2P-RELIABILITY ](/standards/application/p2p-reliability.md ), i.e., `application` < - > **reliable-channel-api** < - > `messaging-api/p2p-reliability` .
2026-03-23 22:29:04 +01:00
It bundles segmentation, end-to-end reliability via [Scalable Data Sync (SDS) ](https://lip.logos.co/ift-ts/raw/sds.html ), rate limit management, and a pluggable encryption hook
into a single interface for sending and receiving messages reliably.
## Motivation
The [MESSAGING-API ](/standards/application/messaging-api.md ) provides peer-to-peer reliability via [P2P-RELIABILITY ](/standards/application/p2p-reliability.md ),
but does not provide high end-to-end delivery guarantees from sender to recipient.
This API addresses that gap by introducing:
2026-04-28 15:30:12 +02:00
- **[SEGMENTATION ](/standards/application/segmentation.md )** to handle large messages exceeding network size limits.
2026-04-24 09:28:49 +02:00
- **[SDS ](https://lip.logos.co/ift-ts/raw/sds.html )** to provide causal-history-based end-to-end acknowledgement and retransmission.
2026-03-23 22:29:04 +01:00
- **Rate Limit Manager** to comply with [RLN ](https://lip.logos.co/messaging/standards/core/17/rln-relay.html ) constraints when sending segmented messages.
2026-04-25 00:47:03 +02:00
- **Encryption Hook** to allow upper layers to provide a pluggable encryption mechanism. The main motivation for encryption is to protect the payload.
2026-03-23 22:29:04 +01:00
The separation between Reliable Channels and encryption ensures the API remains agnostic to identity and key management concerns,
which are handled by higher layers.
## Syntax
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119 ](https://www.ietf.org/rfc/rfc2119.txt ).
## API design
### Architectural position
2026-04-23 21:47:51 +02:00
The Reliable Channel API sits between the application layer and the Messaging API, as follows:
2026-03-23 22:29:04 +01:00
```
┌────────────────────────────────────────────────────────────┐
2026-04-23 21:47:51 +02:00
│ Application Layer │
2026-03-23 22:29:04 +01:00
└───────────────────────────┬────────────────────────────────┘
│
┌───────────────────────────▼────────────────────────────────┐
│ Reliable Channel API │
│ ┌──────────────┐ ┌─────┐ ┌───────────────┐ ┌──────────┐ │
│ │ Segmentation │ │ SDS │ │ Rate Limit Mgr│ │Encryption│ │
│ │ │ │ │ │ │ │ Hook │ │
│ └──────────────┘ └─────┘ └───────────────┘ └──────────┘ │
└───────────────────────────┬────────────────────────────────┘
│
┌───────────────────────────▼────────────────────────────────┐
│ Messaging API │
│ (P2P Reliability, Relay, Filter, Lightpush, Store) │
└────────────────────────────────────────────────────────────┘
```
2026-04-24 12:10:41 +02:00
### IDL
A custom Interface Definition Language (IDL) in YAML is used, consistent with [MESSAGING-API ](/standards/application/messaging-api.md ).
2026-04-28 00:39:51 +02:00
## Procedures
### Outgoing message processing
When `send` is called, the implementation MUST process `message` in the following order:
2026-04-28 15:30:12 +02:00
1. **Segment** : Split the payload into segments as defined in [SEGMENTATION ](./segmentation.md ). The maximum segment size MUST be reduced by the size of the SDS header added in step 2, so that each segment together with its SDS header stays within the network message size limit.
2026-04-28 01:18:42 +02:00
2. **Apply [SDS](https://lip.logos.co/ift-ts/raw/sds.html)** : Register each segment with the SDS layer to track acknowledgements and enable retransmission.
3. **Encrypt** : If an `Encryption` implementation is provided, encrypt each segment before transmission.
2026-04-28 00:39:51 +02:00
4. **Rate Limit** : If `RateLimitConfig.enabled` is `true` , delay dispatch as needed to comply with [RLN ](https://lip.logos.co/messaging/standards/core/17/rln-relay.html ) epoch constraints.
2026-04-28 01:18:42 +02:00
5. **Dispatch** : Send each segment via the underlying [MESSAGING-API ](/standards/application/messaging-api.md ).
2026-04-28 00:39:51 +02:00
### Incoming message processing
2026-04-28 01:18:42 +02:00
When a segment is received from the network, the implementation MUST process it in the following order:
2026-04-28 00:39:51 +02:00
2026-04-28 01:18:42 +02:00
1. **Decrypt** : If an `Encryption` implementation is provided, decrypt the segment.
2. **Apply [SDS](https://lip.logos.co/ift-ts/raw/sds.html)** : Deliver the segment to the SDS layer, which emits acknowledgements and detects gaps.
2026-04-28 22:33:31 +02:00
- **Detect missing dependencies and fetch from store**: If SDS detects a gap in the causal history (i.e., a referenced predecessor segment has not yet been received), and considers the message is irretrievably lost,
the implementation MUST attempt to retrieve the missing segment throughout store protocol (store API is never exposed and hence, store queries are handled internally).
2026-04-28 01:18:42 +02:00
3. **Reassemble** : Once all segments for a message have been received, reassemble and emit a `reliable:message:received` event.
2026-04-28 00:39:51 +02:00
### Rate limiting
2026-04-28 01:18:42 +02:00
When `RateLimitConfig.enabled` is `true` , the implementation MUST space segment transmissions
2026-04-28 00:39:51 +02:00
to comply with the [RLN ](https://lip.logos.co/messaging/standards/core/17/rln-relay.html ) epoch constraints defined in `epochSizeMs` .
2026-04-28 01:18:42 +02:00
Segments MUST NOT be sent at a rate that would violate the RLN message rate limit for the active epoch.
2026-04-28 00:39:51 +02:00
### Encryption
The `encryption` parameter in `createReliableChannel` is intentionally optional.
The Reliable Channel API is agnostic to encryption mechanisms.
When an `Encryption` implementation is provided, it MUST be applied as described in [Outgoing message processing ](#outgoing-message-processing ) and [Incoming message processing ](#incoming-message-processing ).
2026-04-27 16:34:17 +02:00
## The Reliable Channel API
2026-04-28 00:24:25 +02:00
This API considers the types defined by [MESSAGING-API ](/standards/application/messaging-api.md ) plus the following.
2026-04-27 16:34:17 +02:00
### Channel lifecycle
This point assumes that a WakuNode instance is created beforehand. See `createNode` function
in [MESSAGING-API ](/standards/application/messaging-api.md ).
```yaml
functions:
createReliableChannel:
2026-04-28 00:25:09 +02:00
description: "Creates a reliable channel over the given content topic. Sets up the required SDS state,
segmentation, and encryption, and subscribes to `contentTopic` ."
2026-04-27 16:34:17 +02:00
parameters:
- name: node
type: WakuNode
description: "The underlying messaging node, as defined in [MESSAGING-API ](/standards/application/messaging-api.md ).
2026-04-28 01:18:42 +02:00
Used to send segments and to subscribe/unsubscribe to the content topics."
2026-04-27 16:34:17 +02:00
- name: channelId
type: string
description: "Unique identifier for this channel. Represents the reliable (SDS), segmented, and optionally-encrypted session."
- name: contentTopic
type: string
description: "The topic this channel listens and sends on. This has routing and filtering connotations."
- name: senderId
type: string
description: "An identifier for this sender. SHOULD be unique and persisted between sessions."
- name: encryption
type: optional< Encryption >
default: none
description: "Optional pluggable encryption implementation. If none, messages are sent unencrypted."
returns:
type: result< ReliableChannel , error >
closeChannel:
description: "Closes a reliable channel, releases all associated resources and internal state,
and unsubscribes from its content topic via the underlying [MESSAGING-API ](/standards/application/messaging-api.md )."
parameters:
- name: channel
type: ReliableChannel
description: "The channel handle returned by `createReliableChannel` ."
returns:
type: result< void , error >
```
### Channel usage
```yaml
functions:
send:
description: "Send a message through a reliable channel. The message is always segmented,
SDS-tracked, rate-limited, and encrypted (if configured)."
parameters:
- name: channel
type: ReliableChannel
description: "The channel handle returned by `createReliableChannel` ."
- name: message
type: array< byte >
description: "The raw message payload to send."
returns:
type: result< ReliableSendId , error >
description: "Returns a `ReliableSendId` that callers can use to correlate subsequent `MessageSentEvent` or `MessageSendErrorEvent` events."
2026-04-28 00:32:50 +02:00
onMessageReceived:
description: "Subscribes a callback to be invoked when a complete message has been received and reassembled."
parameters:
- name: channel
type: ReliableChannel
description: "The channel handle returned by `createReliableChannel` ."
- name: callback
type: function
description: "Invoked on each received message."
parameters:
- name: event
type: MessageReceivedEvent
returns:
type: result< void , error >
onMessageSent:
2026-04-28 01:18:42 +02:00
description: "Subscribes a callback to be invoked when all segments of a message have been transmitted to the network.
2026-04-28 00:52:12 +02:00
This confirms network-level dispatch but does not guarantee the recipient has processed the message.
For end-to-end confirmation, see `onMessageDelivered` ."
2026-04-28 00:32:50 +02:00
parameters:
- name: channel
type: ReliableChannel
description: "The channel handle returned by `createReliableChannel` ."
- name: callback
type: function
2026-04-28 01:18:42 +02:00
description: "Invoked when all segments of a send operation are acknowledged by the network."
2026-04-28 00:32:50 +02:00
parameters:
- name: event
type: MessageSentEvent
returns:
type: result< void , error >
2026-04-28 00:52:12 +02:00
onMessageDelivered:
description: "Subscribes a callback to be invoked when the recipient has confirmed receipt of a message via SDS acknowledgements.
This event is emitted asynchronously, after `MessageSentEvent` , once the SDS layer receives end-to-end acknowledgements from the recipient."
parameters:
- name: channel
type: ReliableChannel
description: "The channel handle returned by `createReliableChannel` ."
- name: callback
type: function
description: "Invoked when the recipient confirms end-to-end delivery."
parameters:
- name: event
type: MessageDeliveredEvent
returns:
type: result< void , error >
2026-04-28 00:32:50 +02:00
onMessageSendError:
description: "Subscribes a callback to be invoked when a send operation fails after exhausting retransmission attempts."
parameters:
- name: channel
type: ReliableChannel
description: "The channel handle returned by `createReliableChannel` ."
- name: callback
type: function
description: "Invoked when a send operation fails."
parameters:
- name: event
type: MessageSendErrorEvent
returns:
type: result< void , error >
```
2026-04-27 16:34:17 +02:00
### Node configuration
This spec extends `NodeConfig` , needed to create a node, which is
defined in [MESSAGING-API ](/standards/application/messaging-api.md ),
2026-04-28 00:25:38 +02:00
with `sds_config` and `rate_limit_config` fields.
2026-04-27 16:34:17 +02:00
```yaml
NodeConfig: # Extends NodeConfig defined in MESSAGING-API
fields:
sds_config:
type: SdsConfig
description: "SDS configuration. See SdsConfig defined in this spec."
rate_limit_config:
type: RateLimitConfig
description: "Rate limiting configuration, including RLN-specific attributes. See RateLimitConfig defined in this spec."
```
### Type definitions
```yaml
types:
ReliableChannel:
type: object
description: "A handle representing an open reliable channel.
Returned by `createReliableChannel` and used to send messages and receive events.
Internal state (SDS, segmentation, encryption) is managed by the implementation."
MessageEvents:
type: event_emitter
description: "Event source for reliable message events on a channel"
events:
"reliable:message:received":
type: MessageReceivedEvent
"reliable:message:sent":
type: MessageSentEvent
2026-04-28 00:52:12 +02:00
"reliable:message:delivered":
type: MessageDeliveredEvent
2026-04-27 16:34:17 +02:00
"reliable:message:send-error":
type: MessageSendErrorEvent
MessageReceivedEvent:
type: object
description: "Event emitted when a complete message has been received and reassembled."
fields:
message:
type: array< byte >
description: "The reassembled message payload."
MessageSentEvent:
type: object
2026-04-28 01:18:42 +02:00
description: "Event emitted when all segments of a message have been transmitted to the network.
2026-04-28 00:52:12 +02:00
This confirms network-level dispatch only; it does not guarantee the recipient has processed the message.
For end-to-end confirmation, listen for `MessageDeliveredEvent` ."
fields:
requestId:
type: ReliableSendId
2026-04-28 01:18:42 +02:00
description: "The identifier of the `send` operation whose segments have all been dispatched to the network."
2026-04-28 00:52:12 +02:00
MessageDeliveredEvent:
type: object
description: "Event emitted when the recipient has confirmed end-to-end receipt of a message via SDS acknowledgements.
This event is fired asynchronously after `MessageSentEvent` , once the SDS layer receives explicit acknowledgements from the recipient."
2026-04-27 16:34:17 +02:00
fields:
requestId:
type: ReliableSendId
2026-04-28 00:52:12 +02:00
description: "The identifier of the `send` operation confirmed as delivered by the recipient."
2026-04-27 16:34:17 +02:00
MessageSendErrorEvent:
type: object
description: "Event emitted when a message send operation fails after exhausting retransmission attempts."
fields:
requestId:
type: ReliableSendId
description: "The identifier of the `send` operation that failed after exhausting retransmission attempts."
error:
type: string
description: "Error message describing what went wrong"
ReliableSendId:
type: string
description: "Unique identifier for a single `send` operation on a reliable channel.
2026-04-28 01:18:42 +02:00
It groups all segments produced by segmenting one message, so callers can correlate
2026-04-27 16:34:17 +02:00
acknowledgement and error events back to the original send call.
2026-04-28 01:18:42 +02:00
Internally, each segment is dispatched as an independent [MESSAGING-API ](/standards/application/messaging-api.md ) call,
producing one `RequestId` (as defined in [MESSAGING-API ](/standards/application/messaging-api.md )) per segment.
2026-04-27 16:34:17 +02:00
A single `ReliableSendId` therefore maps to one or more underlying `RequestId` values,
2026-04-28 01:18:42 +02:00
one per segment sent."
2026-04-27 16:34:17 +02:00
2026-04-28 16:19:49 +02:00
SegmentationConfig:
type: object
fields:
enableReedSolomon:
type: bool
default: false
description: When enabled, the message sender adds parity (redundant) segments to allow recovery in case of data segment loss. See [SEGMENTATION ](./segmentation.md ).
segmentSizeBytes:
type: uint
default: 102400 # 100 KiB
description: "Maximum segment size in bytes.
Messages larger than this value are split before SDS processing."
2026-04-27 16:34:17 +02:00
SdsConfig:
type: object
description: Scalable Data Sync config items.
fields:
persistence:
type: Persistence
description: "Backend for persisting the SDS local history. Implementations MAY support custom backends."
acknowledgementTimeoutMs:
type: uint
default: 5000
description: "Time in milliseconds to wait for acknowledgement before retransmitting."
maxRetransmissions:
type: uint
default: 5
description: "Maximum number of retransmission attempts before considering delivery failed."
causalHistorySize:
type: uint
default: 2
description: "Number of message IDs to consider in the causal history. With longer value, a stronger correctness is guaranteed but it requires higher bandwidth and memory."
RateLimitConfig:
type: object
description: Rate limiting configuration, containing RLN-specific attributes.
fields:
enabled:
type: bool
default: false
description: "Whether rate limiting is enforced. SHOULD be true when RLN is active."
epochSizeMs:
type: uint
default: 600000 # 10 minutes
description: "The epoch size used by the RLN relay, in milliseconds."
Encryption:
type: object
description: "Interface for a pluggable encryption mechanism.
When provided as a parameter to `createReliableChannel` , the API consumer MUST implement both encrypt and decrypt operations.
Implementations MAY use different signatures than those described below, as long as each operation accepts a byte array and returns a byte array."
fields:
encrypt:
type: function
description: "Encrypts a byte payload. Returns the encrypted payload."
parameters:
- name: content
type: array< byte >
returns:
type: result< array < byte > , error>
decrypt:
type: function
description: "Decrypts a byte payload. Returns the decrypted payload."
parameters:
- name: payload
type: array< byte >
returns:
type: result< array < byte > , error>
Persistence:
type: object
description: "Interface for a pluggable SDS persistence backend.
Implementations MUST provide all functions required to save and retrieve SDS state per channel. Implementations MUST also provide the persistence method of interest, e.g., SQLite, custom encrypted storage, etc.
Refer to the [SDS spec ](https://lip.logos.co/ift-ts/raw/sds.html ) for the full definition of what state must be persisted."
```
2026-04-24 12:10:41 +02:00
## Components
### Segmentation
2026-04-28 15:30:12 +02:00
See [SEGMENTATION ](./segmentation.md ).
2026-04-24 12:10:41 +02:00
### Scalable Data Sync (SDS)
[SDS ](https://lip.logos.co/ift-ts/raw/sds.html ) provides end-to-end delivery guarantees using causal history tracking.
2026-04-28 01:18:42 +02:00
- Each sent segment is registered in an outgoing buffer.
- The recipient sends acknowledgements back to the sender upon receiving segments.
- The sender removes acknowledged segments from the outgoing buffer.
- Unacknowledged segments are retransmitted after `acknowledgementTimeoutMs` .
2026-04-24 12:10:41 +02:00
- SDS state MUST be persisted using the `persistence` backend configured in `SdsConfig` .
### Rate Limit Manager
The Rate Limit Manager ensures compliance with [RLN ](https://lip.logos.co/messaging/standards/core/17/rln-relay.html ) rate constraints.
2026-04-28 01:18:42 +02:00
- It tracks how many messages have been sent in the current epoch (only the first segment of each message counts toward the rate limit; subsequent segments are exempt).
- When the limit is approached, segment dispatch MUST be delayed to the next epoch.
2026-04-24 12:10:41 +02:00
- The epoch size MUST match the `epochSizeMs` configured in `RateLimitConfig` .
### Encryption Hook
The Encryption Hook provides a pluggable interface for upper layers to inject encryption.
- The hook is optional; when not provided, messages are sent unencrypted.
2026-04-28 01:18:42 +02:00
- Encryption is applied per segment, after segmentation and SDS registration.
- Decryption is applied per segment, before SDS delivery.
2026-04-27 16:09:24 +02:00
- The `Encryption` interface MUST be implemented by the caller.
2026-04-24 12:10:41 +02:00
- The Reliable Channel API MUST NOT impose any specific encryption scheme.
2026-03-23 22:29:04 +01:00
## Security/Privacy Considerations
2026-04-27 16:09:24 +02:00
- This API does not provide confidentiality by default. An `Encryption` implementation MUST be supplied when confidentiality is required.
2026-04-28 01:18:42 +02:00
- Segment metadata (message ID, segment index, total segments) is visible to network observers unless encrypted by the hook.
2026-03-23 22:29:04 +01:00
- SDS acknowledgement messages are sent over the same content topic and are subject to the same confidentiality concerns.
- Rate limiting compliance is required to avoid exclusion from the network by RLN-enforcing relays.
## Copyright
Copyright and related rights waived via [CC0 ](https://creativecommons.org/publicdomain/zero/1.0/ ).