Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
236e69d
smp-server: support namespaces
shumvgolove May 22, 2026
1c508f6
smp-server: drop NameRecVersion, add unNameOwner/unNameLink
shumvgolove May 22, 2026
ee81703
smp-server: Resolver party, RSLV/NAME protocol types
shumvgolove May 25, 2026
2d14d4c
smp-server: thread forwarded flag through verify functions
shumvgolove May 25, 2026
4d38cc3
smp-server: forwarded whitelist RSLV + move incStat to Stats
shumvgolove May 25, 2026
1a7979f
smp-server: NamesConfig env plumbing + INI parse + default template
shumvgolove May 25, 2026
ee323d5
smp-server: Names resolver subtree (RPC + SNRC ABI + cache)
shumvgolove May 25, 2026
13679e5
smp-server: NameResolverStats + CSV log + Prometheus block
shumvgolove May 25, 2026
f8a60d9
smp-server: wire real resolveName into processCommand
shumvgolove May 25, 2026
7299b73
smp-server: tests for Names resolver subtree (27 specs, all passing)
shumvgolove May 25, 2026
44f617a
protocol: SMP v20 — public-namespace resolver commands
shumvgolove May 25, 2026
51d0a89
release: bump to 6.6.0.0 + CHANGELOG entry
shumvgolove May 25, 2026
f9269be
smp-server: demote names+proxy guard from refusal to warning
shumvgolove May 25, 2026
7f94f49
smp-server: drop allow_dangerous_colocation flag
shumvgolove May 25, 2026
4165041
smp-server: implement UTF-8 validation for ABI strings
shumvgolove May 25, 2026
cc487d1
smp-server: propagate async exceptions through coalescing leader
shumvgolove May 25, 2026
1a5c4d7
smp-server: real estimateBytes — derive size from record content
shumvgolove May 25, 2026
fdeb322
smp-server: drop unLookupKey, log scrubbed endpoint at startup
shumvgolove May 25, 2026
8a678d8
smp-server: consolidate hex decoder — drop duplicate partial impl
shumvgolove May 25, 2026
39e4b28
smp-server: validate ethereum_endpoint URL per the design plan
shumvgolove May 25, 2026
61399e0
smp-server: strengthen coalescing test to assert n == 1
shumvgolove May 25, 2026
3691dc6
smp-server: reject uint256 with sign bit set in low 8 bytes
shumvgolove May 25, 2026
04be7ba
smp-server: validateUrl rejects path beyond /
shumvgolove May 25, 2026
a9e289c
smp-server: fix CHANGELOG + INI template footguns
shumvgolove May 25, 2026
0e13048
smp-server: cache NotFound results to bound DoS via unique-name spam
shumvgolove May 25, 2026
da11925
smp-server: filter expired records server-side as defense in depth
shumvgolove May 25, 2026
13f1e7d
smp-server: parseRpcAuth accepts mixed-case scheme keyword
shumvgolove May 25, 2026
115a115
smp-server: probe ethereum endpoint at startup + log sync exceptions
shumvgolove May 25, 2026
2fca0c9
smp-server: fuse fetchOnce transport-error dispatch
shumvgolove May 27, 2026
c244bcd
smp-server: inline mapSyncEthExn
shumvgolove May 27, 2026
37764a4
smp-server: fuse RSLV handler dispatch
shumvgolove May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 6.6.0

Version 6.6.0.0

SMP server:
- public-namespace resolver (SMP protocol v20):
- new `RSLV <lookup_key>` command and `NAME <NameRecord>` response, forwarded-only via PFWD
- reads name records from the Ethereum SNRC contract via a configurable JSON-RPC endpoint (Reth + Nimbus)
- in-memory cache with TTL, byte cap, FIFO eviction, and in-flight request coalescing
- new `[NAMES]` INI section; disabled by default
- new `simplex_smp_names_*` Prometheus metrics + CSV stats columns
- logs a startup warning when co-located with the proxy role: slow RSLV cache misses can serialise other forwarded commands on the same proxy-relay session (run names on a separate host for high-volume deployments)

# 6.5.1

Version 6.5.1.0
Expand Down
430 changes: 430 additions & 0 deletions plans/20260522_01_smp_public_namespaces.md

Large diffs are not rendered by default.

72 changes: 70 additions & 2 deletions protocol/simplex-messaging.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version 19, 2025-01-24
Version 20, 2026-05-25

# Simplex Messaging Protocol (SMP)

Expand Down Expand Up @@ -67,6 +67,9 @@ Version 19, 2025-01-24
- [Queue deleted notification](#queue-deleted-notification)
- [Error responses](#error-responses)
- [OK response](#ok-response)
- [Resolver commands](#resolver-commands)
- [Resolve name command](#resolve-name-command)
- [Name record response](#name-record-response)
- [Transport connection with the SMP router](#transport-connection-with-the-SMP-router)
- [General transport protocol considerations](#general-transport-protocol-considerations)
- [TLS transport encryption](#tls-transport-encryption)
Expand All @@ -83,7 +86,7 @@ It's designed with the focus on communication security and integrity, under the

It is designed as a low level protocol for other application protocols to solve the problem of secure and private message transmission, making [MITM attack][1] very difficult at any part of the message transmission system.

This document describes SMP protocol version 19. Versions 1-5 are discontinued. The version history:
This document describes SMP protocol version 20. Versions 1-5 are discontinued. The version history:

- v1: binary protocol encoding
- v2: message flags (used to control notifications)
Expand All @@ -103,6 +106,7 @@ This document describes SMP protocol version 19. Versions 1-5 are discontinued.
- v17: create notification credentials with NEW command
- v18: support client notices in BLOCKED error
- v19: service subscriptions to messages (SUBS, NSUBS, SOKS, ENDS, ALLS commands)
- v20: public namespaces resolver (RSLV command, NAME response) — forwarded-only via PFWD

## Introduction

Expand Down Expand Up @@ -424,6 +428,8 @@ Simplex messaging router implementations MUST NOT create, store or send to any o

- Any other information that may compromise privacy or [forward secrecy][4] of communication between clients using simplex messaging routers (the routers cannot compromise forward secrecy of any application layer protocol, such as double ratchet).

Routers with the names role make outbound JSON-RPC calls to an Ethereum endpoint to read `NameRecord` data; the lookup key reaches that endpoint. Operators MUST run the endpoint themselves (loopback Reth + Nimbus, or a self-hosted central deployment) — sharing one endpoint across multiple operators collapses the two-server privacy property because the endpoint operator would see every lookup key across all of them. The names role and the SMP-proxy role MUST NOT be enabled on the same router by default; a slow `RSLV` cache miss can serialise other forwarded commands on the same proxy-relay session.

## Message delivery notifications

Supporting message delivery while the client mobile app is not running requires sending push notifications with the device token. All alternative mechanisms for background message delivery are unreliable, particularly on iOS platform.
Expand Down Expand Up @@ -1422,6 +1428,68 @@ When the command is successfully executed by the router, it should respond with
ok = %s"OK"
```

### Resolver commands

Resolver commands implement public-namespace name resolution on the names-role
router. A names router translates an opaque lookup key (such as `alice` or
`alice.simplex.eth`) into a `NameRecord` carrying the channel and contact links
the named party publishes.

**Forwarded-only.** RSLV is only valid when delivered inside a `PFWD` block via
the SMP proxy. A direct `RSLV` from a transport client is rejected with
`ERR CMD PROHIBITED`. This preserves the two-server privacy property of the
resolver design: the names router sees the lookup key but never the client IP,
session, or identity; the proxy router sees the client connection but cannot
read the encrypted lookup key inside the forwarded transmission.

**Backing store.** This protocol does not prescribe where the names router
reads `NameRecord` from. The reference implementation queries the SNRC contract
on Ethereum via a JSON-RPC endpoint; alternative backings (different chains,
DHT, etc.) are valid as long as they return a `NameRecord` matching the encoding
below.

#### Resolve name command

```abnf
rslv = %s"RSLV" SP lookupKey
lookupKey = length *OCTET ; 1-byte length prefix, up to 64 bytes
```

Name-syntax validation (lowercase, namespace prefixes such as `#testnet:`,
length policy) is a client-side concern. The names router treats the lookup
key as opaque bytes.

The names router responds with either a `NAME` response carrying the resolved
record, or `ERR AUTH` collapsing every failure mode (name not found, malformed
key, names role disabled, RPC unreachable, decode error, timeout). The wire
code does not distinguish between these — stats counters MAY be exposed
out-of-band for operator observability.

#### Name record response

```abnf
name = %s"NAME" SP nameRecord

nameRecord = displayName owner channelLinks contactLinks adminAddr adminEmail expiry isTest
displayName = length *OCTET ; 1-byte length prefix, up to 255 bytes UTF-8
owner = 20OCTET ; raw 20-byte Ethereum-style address
channelLinks = count *nameLink ; count is a 1-byte unsigned integer
contactLinks = count *nameLink ; combined count of channelLinks + contactLinks ≤ 8
nameLink = length16 *OCTET ; 2-byte big-endian length, up to 1024 bytes UTF-8
adminAddr = optionalText ; "0" absent or "1" + 1-byte length + UTF-8 up to 255 bytes
adminEmail = optionalText ; same encoding as adminAddr
expiry = 8OCTET ; Int64 big-endian, Unix seconds, MUST be ≥ 0
isTest = "T" / "F"
```

The encoding is canonical: every primitive has exactly one valid byte form, so
two names routers reading the same backing state produce byte-identical
responses.

**Wire-size budget.** A maximal `nameRecord` (8 links × 1024 bytes + maximal
admin / display strings) fits comfortably within the SMP proxied transmission
budget of 16224 bytes.

## Transport connection with the SMP router

### General transport protocol considerations
Expand Down
11 changes: 10 additions & 1 deletion simplexmq.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 1.12

name: simplexmq
version: 6.5.2.0
version: 6.6.0.0
synopsis: SimpleXMQ message broker
description: This package includes <./docs/Simplex-Messaging-Server.html server>,
<./docs/Simplex-Messaging-Client.html client> and
Expand Down Expand Up @@ -261,6 +261,10 @@ library
Simplex.Messaging.Server.MsgStore.Journal.SharedLock
Simplex.Messaging.Server.MsgStore.STM
Simplex.Messaging.Server.MsgStore.Types
Simplex.Messaging.Server.Names
Simplex.Messaging.Server.Names.Eth.RPC
Simplex.Messaging.Server.Names.Eth.SNRC
Simplex.Messaging.Server.Names.Resolver
Simplex.Messaging.Server.NtfStore
Simplex.Messaging.Server.Prometheus
Simplex.Messaging.Server.QueueStore
Expand Down Expand Up @@ -355,9 +359,13 @@ library
build-depends:
case-insensitive ==1.2.*
, hashable ==1.4.*
, http-client >=0.7 && <0.8
, http-client-tls >=0.3 && <0.4
, ini ==0.4.1
, network-uri >=2.6 && <2.7
, optparse-applicative >=0.15 && <0.17
, process ==1.6.*
, psqueues >=0.2.7 && <0.3
, temporary ==1.3.*
, wai >=3.2 && <3.3
, wai-app-static >=3.1 && <3.2
Expand Down Expand Up @@ -508,6 +516,7 @@ test-suite simplexmq-test
ServerTests
SMPAgentClient
SMPClient
SMPNamesTests
SMPProxyTests
Util
XFTPAgent
Expand Down
1 change: 1 addition & 0 deletions src/Simplex/Messaging/Encoding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Simplex.Messaging.Encoding
smpEncodeList,
smpListP,
lenEncode,
lenP,
)
where

Expand Down
Loading
Loading