1.10. Pluggable Protocol Architecture & Ecosystem Interoperability
1.10.1. Pluggable Protocol Architecture & Ecosystem Interoperability Specification
1.10.1.1. Deep Architectural Analysis and Implementation Blueprint for AT Protocol, ActivityPub, and Secure Scuttlebutt (SSB)
1.10.1.2. 1. Executive Summary & Problem Statement
Fleetmesh (fleetmesh.org) is designed as a sovereign, verifiable edge compute, storage, and networking fabric. At its inception, Fleetmesh adopted open protocols: Nostr (NIP-01, NIP-11, NIP-42, NIP-44, NIP-59, NIP-77) for relaying, peer discovery, and encrypted transport; Blossom (BUD-01..04) for content-addressable blob storage; Cashu (NUT-00..24) for ecash settlement and paid fetch; and DIDComm v2 for internal mesh messaging.
However, the current node runtime (meshnode) embeds these protocol families directly into core components:
Hardcoded Relay Face:
NodeApp.faceunconditionally binds and starts a NostrRelayServerover WebSocket/HTTP.Coupled Transport Ladder:
TransportRouterassumes the fallback rung is a Nostr relay transport (RelayRung), with protocol-specific framing embedded in envelope unpackers.Rigid Storage Schema: Event stores and blob servers are tightly wired to Nostr event structures and Blossom HTTP routes.
1.10.1.2.1. The Strategic Imperative
The decentralized web is rapidly coalescing around major sovereign protocol ecosystems:
ATProto (Authenticated Transfer Protocol): The open protocol underpinning Bluesky, characterized by self-sovereign DIDs (
did:plc,did:web), Merkle Search Trees (MST), IPLD/DAG-CBOR repositories, XRPC APIs, and the firehose event stream (com.atproto.sync.subscribeRepos).ActivityPub (W3C): The federated social web standard (Fediverse / Mastodon), featuring Actor models, WebFinger discovery, ActivityStreams 2.0 (JSON-LD), and HTTP Signatures over Inbox/Outbox HTTP endpoints.
Secure Scuttlebutt (SSB): An offline-first, peer-to-peer append-only log protocol based on Secret Handshake (SHS), Box Stream, and MuxRPC over raw TCP.
Fleetmesh must not be locked into a single protocol dialect. We must transform Fleetmesh into a Pluggable Multi-Protocol Node Runtime, where:
Each protocol family (Nostr, ATProto, ActivityPub, SSB) is an independent, modular package that can be enabled or disabled declaratively in
config.json.A disabled protocol incurs zero listening ports, zero background threads, zero storage overhead, and zero capability advertisements.
The node core can run purely as an ATProto Personal Data Server (PDS) or edge relay, purely as an ActivityPub actor node, purely as a private DIDComm/FIPS/Iroh mesh node, or as a multi-protocol gateway bridging all of them.
Fleetmesh’s unique superpowers—bilateral token-bucket budgets, capacity evaluation, verifiable WASM compute, and Cashu micro-settlements—can be applied to protect and monetize foreign protocol surfaces against crawler storms and spam.
1.10.1.3. 2. Codebase Audit: State of Protocol Modularity Today
A comprehensive audit of meshnode and fleetmesh_core reveals both significant structural strengths and specific architectural pinch points that must be decoupled.
+---------------------------------------------------------------------------------------+
| CURRENT COUPLING MATRIX |
+-------------------+-------------------------------------------------------------------+
| Layer | Hardcoded Nostr / Blossom Couplings |
+-------------------+-------------------------------------------------------------------+
| Ingress / Host | - NodeApp.__init__ unconditionally constructs RelayServer |
| | - NodeApp.start() unconditionally binds face.host:face.port |
| | - Socket assumes WebSocket (NIP-01) or ws.PlainHTTP (NIP-11/BUD) |
| | - Foreign HTTP handlers must hack into face.http_handlers list |
+-------------------+-------------------------------------------------------------------+
| Transport Egress | - TransportRouter._send_ladder appends 'nostr' as hard floor |
| | - Assumes all messages are DIDComm JWEs wrapped in NIP-59 |
| | - DidcommInbound unwrap expects Nostr gift-wrap envelopes |
+-------------------+-------------------------------------------------------------------+
| Storage Engine | - MeshStoreProtocol enforces Nostr event dict (kind, tags, sig) |
| | - NodeStore indexes strictly by event_id, pubkey, kind, created_at|
| | - SyncProtocol & Negentropy sync Nostr event ID sets (NIP-77) |
+-------------------+-------------------------------------------------------------------+
| Configuration | - No top-level "protocols" block in NodeConfig |
| | - Nostr relay face cannot be disabled |
| | - Zero-overhead disabled state does not exist |
+-------------------+-------------------------------------------------------------------+
| Wire Codecs | - fleetmesh_core/wire/cbor.py rejects Major Type 6 (tags), |
| | blocking Tag 42 required for ATProto IPLD CIDs |
+-------------------+-------------------------------------------------------------------+
1.10.1.3.1. 2.1 Existing Modularity Strengths
Strict Interoperability Policy (
meshnode/docs/interop.md):“Reuse before invent”: Open protocols are spoken unchanged; peering, budgets, and settlement belong to Fleetmesh.
“Foreign protocols are dialects, not forks”: Capabilities are announced with native
ctags rather than rebranded underhttps://fleetmesh.org/.Conformance is verified against upstream test vectors (
scripts/check-interop.py).
Cryptographic Foundations (
core/fleetmesh_core/crypto/keys.py):The node generates and manages three fundamental keys:
node:secp256k1(multicodec0xe7 0x01), BIP-340 Schnorr. Directly reusable for ATProto K-256 (did:key:zQ3sh...).agreement:X25519(multicodec0xec 0x01). Reusable for SSB Box Stream ECDH.transport:Ed25519(multicodec0xed 0x01). Directly reusable for ActivityPub HTTP Signatures and SSB feed identities (@<pubkey>.ed25519).
CIDv1 Codec (
core/fleetmesh_core/identity/cid.py):sha256_to_cid()andcid_to_sha256()map between Blossom hex digests and IPFS CIDv1 multibase ‘b’ (raw sha2-256bafkrei...), establishing the foundation for cross-protocol blob sharing.
Transport Ladder Abstraction (
meshnode/fleetmesh_node/transport/):TransportRouternegotiates betweenfips-native,iroh, andlibp2pusingRungProtocoland per-rung circuit breakers (ladder.py).
Compartment Worker Model (
meshnode/fleetmesh_node/compartment/):Clean actor isolation where workers tick, report health, declare channels, and register DIDComm handlers.
1.10.1.3.2. 2.2 Coupling Points in the Current Codebase
1.10.1.3.2.1. 1. Ingress & Host Face Coupling (meshnode/fleetmesh_node/app/core.py & meshnode/fleetmesh_node/nostr/relayserver.py)
In meshnode/fleetmesh_node/app/core.py:
Lines 239–252:
NodeApp.__init__unconditionally instantiatesself.face = relayserver.RelayServer(...).Line 569:
NodeApp.start()unconditionally executesself.face.start().RelayServerbinds the edge socket directly. It attempts an RFC 6455 WebSocket handshake for every incoming connection; if the handshake fails, it catchesws.PlainHTTPand dispatches to NIP-11, Blossom (BUD-01/02/04),/metrics, and/gossip.Compartments requiring HTTP exposure (e.g.
nsiteandlinked) must mutateself.face.http_handlers.Result: Non-Nostr protocols cannot cleanly mount HTTP endpoints, WebSockets, or path-based APIs without coupling to
RelayServer.
1.10.1.3.2.2. 2. Transport Ladder Coupling (meshnode/fleetmesh_node/transport/router.py)
In meshnode/fleetmesh_node/transport/router.py:
Lines 541–542 (
_send_ladder):if 'nostr' not in order: order.append('nostr')
Line 523: Direct fallback to
self.nostr.send(..., stored=True)when store-and-forward is requested.Inbound unwrap (
didcomm_inbound.open_inbound) expects NIP-59 gift-wrapped events or DIDComm JWEs.Result: If Nostr is disabled or omitted, message routing fails. The ladder cannot treat foreign transport rungs (e.g. SSB TCP, ATProto sync) as first-class citizens.
1.10.1.3.2.3. 3. Storage Engine Coupling (core/fleetmesh_core/wire/interfaces.py & core/fleetmesh_core/storage/)
MeshStoreProtocoldefinesinsert_event(event: Mapping[str, Any], now: int) -> strandenumerate_range(filt: ...).The backing tables in SQLite (
fleetmesh_node/nostr/eventstore.py) and PostgreSQL (core/fleetmesh_core/storage/store_postgres.py) assume Nostr event structures(id, pubkey, created_at, kind, tags, content, sig).SyncPeer(fleetmesh_node/planes/store/sync/) and Negentropy (fleetmesh_core/storage/negentropy.py) operate on 32-byte Nostr event ID sets.Result: Storing ATProto MST nodes or ActivityStreams JSON-LD objects requires dedicated storage adapters or table schemas.
1.10.1.3.2.4. 4. CBOR Codec Limitations (core/fleetmesh_core/wire/cbor.py)
Line 9: “Major type 6 (tags) is deliberately unhandled: nothing this node reads carries one…”
In DAG-CBOR (RFC 8949 + IPLD), CIDs are encoded as CBOR Tag 42 (
0xd8 0x2a).Result: Parsing ATProto commits, records, or MST blocks currently raises
CBORError: unhandled CBOR major type: 6.
1.10.1.4. 3. Architecture & Design Principles
+-----------------------------------------------------------------------------------+
| Node Daemon Core |
| +--------------------+ +----------------------+ +---------------------------+ |
| | Keystore & DID | | Budget & Capacity | | Verified Storage Engines | |
| | (ed25519/secp256k1)| | (AIMD Token Buckets) | | (SQLite, Postgres, CAS) | |
| +--------------------+ +----------------------+ +---------------------------+ |
| | |
| +------------------------------------+ |
| | ProtocolHostRouter (Multiplex) | |
| | Public Port (8000 / 443 with TLS)| |
| +------------------------------------+ |
+-----------------------------------|-----------------------------------------------+
|
+-------------------------+-------------------------+---------------------+
| | | |
+-------------------+ +-------------------+ +-------------------+ +-------------+
| fleetmesh-nostr | | fleetmesh-atproto | | fleetmesh-actpub | | fleetmesh- |
| (NIP-01..77, BUD) | | (XRPC, Firehose, | | (ActivityStreams, | | ssb |
| | | MST, did:plc) | | WebFinger, Inbox)| | (SHS, MuxRPC|
+-------------------+ +-------------------+ +-------------------+ | TCP 8008) |
| | | +-------------+
[Nostr Relays] [Bluesky PDS] [W3C Fediverse] [SSB Network]
1.10.1.4.1. Principle 1: A Protocol is a Suite, Not a Single Compartment
A compartment in Fleetmesh (fleetmesh_node/compartment/base.py) is an in-process worker that ticks, holds state, handles DIDComm PIURIs, and can front a sidecar.
A Protocol Suite is a higher-level subsystem spanning multiple layers:
Ingress / Server Face: HTTP routes, WebSocket handlers, or raw socket listeners.
Egress / Transport Rung: Outbound delivery mechanisms integrated into
TransportRouter.Identity & Resolution: Resolving protocol-specific identifiers (
did:plc,acct:user@domain,npub,@feed.ed25519) and mapping them to/from the node’s native cryptographic keys.Record / Content Storage: Adapting protocol-specific schemas (MST DAG-CBOR, ActivityStreams JSON-LD, Nostr Events, SSB append-only logs) to backing relational stores or CAS blob storage.
Capability Advertisement: Announcing capabilities in the node’s descriptor (kind 11801) and protocol-native metadata endpoints (e.g. NIP-11,
/.well-known/atproto-did, WebFinger).
1.10.1.4.2. Principle 2: Zero-Overhead Disabled State
When a protocol is disabled ("enabled": false or omitted):
No network ports or sockets are opened.
No HTTP or WebSocket endpoints are mounted.
No background tick routines or crawler threads are spawned.
No capability tags are placed into the node’s descriptor.
Memory consumption and startup latency for that protocol suite drop to absolute zero.
1.10.1.4.3. Principle 3: Standards Fidelity & Origin Sovereignty
Adhering to Fleetmesh’s core policy in meshnode/docs/interop.md:
Foreign protocols are spoken verbatim as published by their respective governing standards (
com.atproto.*by Bluesky, W3C ActivityStreams/ActivityPub by W3C, NIPs by Nostr, Scuttlebutt Protocol Guide by SSB).Foreign protocols are never forked, rebranded, or placed under
https://fleetmesh.org/.Every protocol package must prove conformance using test vectors directly from upstream specifications.
1.10.1.4.4. Principle 4: Unified Ingress Multiplexing (ProtocolHostRouter)
Rather than forcing each protocol to bind its own arbitrary TCP port, Fleetmesh introduces ProtocolHostRouter: a unified, high-performance HTTP and WebSocket request router.
A single public edge port (e.g., 8000 or 443 behind TLS) cleanly hosts:
GET /xrpc/*,POST /xrpc/*-> Routed to ATProto XRPC engine.GET /xrpc/com.atproto.sync.subscribeRepos-> Routed to ATProto Firehose WebSocket.GET /.well-known/atproto-did-> Routed to ATProto DID verification.GET /.well-known/webfinger-> Routed to ActivityPub WebFinger discovery.POST /users/{id}/inbox-> Routed to ActivityPub federation ingress.GET /users/{id}-> Routed to ActivityPub Actor document.GET /withUpgrade: websocket-> Routed to Nostr NIP-01 relay server (if enabled).GET /withAccept: application/nostr+json-> Routed to Nostr NIP-11 relay info.PUT /upload,GET /{sha256}-> Routed to Blossom Content-Addressable Blob server.
Dedicated non-HTTP protocols (such as SSB on TCP port 8008 or FIPS on Unix Domain Sockets) declare standalone socket bindings.
1.10.1.5. 4. Core Protocol Package Abstraction
The unified protocol package specification is defined in fleetmesh_core.wire.interfaces and enforced via ProtocolPackage:
from __future__ import annotations
from dataclasses import dataclass
from typing import (
Any,
Callable,
Mapping,
Optional,
Protocol,
Sequence,
TypeVar,
runtime_checkable,
)
@dataclass(frozen=True)
class ProtocolHealth:
healthy: bool
status: str
connections_active: int
messages_in: int
messages_out: int
errors: Sequence[str] = ()
@dataclass(frozen=True)
class RouteMatch:
path_prefix: str
methods: tuple[str, ...]
handler: Callable[[Any], Any]
is_websocket: bool = False
@runtime_checkable
class ProtocolHostRouter(Protocol):
"""Unified HTTP / WebSocket multiplexer mounted on the node's public port."""
def mount_route(self, prefix: str, handler: Callable[..., Any], methods: Sequence[str] = ('GET',)) -> None: ...
def mount_websocket(self, path: str, handler: Callable[..., Any]) -> None: ...
def unmount_all(self, owner: str) -> None: ...
@runtime_checkable
class ProtocolIdentityAdapter(Protocol):
"""Translates between Fleetmesh keys and foreign protocol identity models."""
def resolve_id(self, uri: str) -> Optional[str]: ...
def sign_assertion(self, payload: bytes) -> bytes: ...
def verify_assertion(self, payload: bytes, signature: bytes, pubkey: str) -> bool: ...
@runtime_checkable
class ProtocolPackage(Protocol):
"""The formal interface every pluggable protocol package implements."""
name: str # e.g., 'atproto', 'activitypub', 'nostr', 'ssb'
version: str # e.g., '1.0.0'
standards: tuple[str, ...] # e.g., ('com.atproto.sync', 'did:plc', 'NIP-01')
def configure(self, config: Mapping[str, Any]) -> None:
"""Parse, validate, and store the protocol-specific configuration block."""
...
def identity_adapter(self, keystore: Any) -> Optional[ProtocolIdentityAdapter]:
"""Return the identity and cryptographic adapter for this protocol family."""
...
def mount_ingress(self, host: ProtocolHostRouter) -> None:
"""Register HTTP and WebSocket route handlers onto the shared public host face."""
...
def transport_rung(self, context: Any) -> Optional[Any]:
"""Return an outbound TransportProtocol rung for TransportRouter, if supported."""
...
def compartments(self) -> tuple[type[Any], ...]:
"""Return any background Compartment classes to splice into NodeApp MANIFEST."""
...
def start(self) -> None:
"""Boot the protocol runtime (open sockets, connect to upstreams)."""
...
def stop(self) -> None:
"""Gracefully terminate connections and release listeners."""
...
def health(self) -> ProtocolHealth:
"""Return real-time operational metrics and health status."""
...
def descriptor_capabilities(self) -> tuple[tuple[str, str], ...]:
"""Return protocol capability tags (e.g. ('c', 'https://atproto.com/...')) for kind 11801."""
...
1.10.1.6. 5. Deep-Dive Implementation Specifications
1.10.1.6.1. 5.1 ATProto (Bluesky Ecosystem)
+-------------------------------------------------------------------------------+
| fleetmesh-protocol-atproto |
| |
| +--------------------+ +----------------------+ +-----------------------+ |
| | Identity & Auth | | Repo Engine (MST) | | Ingress / Egress | |
| | - did:plc resolver | | - DAG-CBOR Commits | | - XRPC HTTP API | |
| | - did:web resolver | | - CAR File Exporter | | - Firehose WebSocket | |
| | - K-256/P-256 Sign | | - Blossom CAS Blobs | | - Upstream PDS Client | |
| +--------------------+ +----------------------+ +-----------------------+ |
+-------------------------------------------------------------------------------+
1.10.1.6.1.1. 5.1.1 Identity & Cryptography Mapping
DIDs: ATProto relies on
did:plcanddid:web.Fleetmesh’s keystore already generates and manages
secp256k1(K-256) keys for Nostr.The ATProto package maps the node’s
secp256k1key directly to an ATProto signing key (did:key:zQ3sh...).An ATProto DID document is generated and published to
did:plcdirectory or served at/.well-known/did.jsonfordid:web.
Handle Resolution:
Handles (e.g.
alice.meshnode.net) are resolved via DNS TXT (_atproto.alice.meshnode.net) or HTTP (https://alice.meshnode.net/.well-known/atproto-did).The package includes a caching handle resolver integrating
fleetmesh_node/transport/dnstxt.pyandfleetmesh_node/transport/netfetch.py.
1.10.1.6.1.2. 5.1.2 Data Model: Merkle Search Trees (MST) & CAR Archives
Wire Codec Upgrade (
fleetmesh_core/wire/cbor.py):Add support for CBOR Major Type 6 (Tags), specifically Tag 42 (IPLD Link).
Form:
0xd8 0x2afollowed by byte stringb'\x00' + multihash.Enforce canonical sorting rules per RFC 8949 and DAG-CBOR specs.
Records: ATProto stores user records (
app.bsky.feed.post,app.bsky.actor.profile, etc.) in a Merkle Search Tree (MST) serialized using DAG-CBOR.Commit Log & CAR Engine (
fleetmesh_core/storage/car.py):Every update creates a signed commit pointing to the new MST root CID.
Commits are packaged into Content-Addressable aRchives (CAR files).
Fleetmesh Storage Integration:
MST nodes and commit metadata are indexed in Fleetmesh’s SQLite / PostgreSQL storage engine.
Unified Blossom CAS Integration: Media attachments (avatars, banners, post images) are content-addressed by CID (raw SHA-256 multihash
bafkrei...). Fleetmesh’scid.py(cid_to_sha256) translates CIDs to SHA-256 hex strings, allowing them to be stored and fetched directly from Fleetmesh’s Blossom BlobStore (BUD-01). This provides immediate deduplication and unified storage across Nostr and ATProto!
1.10.1.6.1.3. 5.1.3 Wire & API Surfaces
XRPC Ingress:
Mounted on
/xrpc/*.Implements core Lexicon methods:
com.atproto.server.describeServercom.atproto.sync.getRepo(returns CAR stream)com.atproto.sync.getRecordcom.atproto.sync.getBlob(redirects/streams from Blossom store)com.atproto.repo.getRecord,com.atproto.repo.listRecords
Firehose Ingress / Egress:
Ingress:
GET /xrpc/com.atproto.sync.subscribeReposserving real-time DAG-CBOR commit blocks to downstream indexers (AppViews).Egress: WebSocket client subscribing to Bluesky Relay firehoses (
wss://bsky.network/xrpc/...), filtering records, and caching them locally.
1.10.1.6.1.4. 5.1.4 Fleetmesh Bilateral Budget Protection
Crawling the ATProto firehose generates significant network and CPU load. Fleetmesh integrates its bilateral token-bucket budgets (CapacityLedger):
Downstream firehose consumers must establish peering contracts or authenticate with Cashu tokens (
NUT-24/ paid fetch).Unauthenticated consumers are rate-limited via AIMD (Additive Increase, Multiplicative Decrease) token buckets.
1.10.1.6.2. 5.2 ActivityPub (W3C Fediverse)
+-------------------------------------------------------------------------------+
| fleetmesh-protocol-activitypub |
| |
| +--------------------+ +----------------------+ +-----------------------+ |
| | WebFinger & Actor | | ActivityStreams 2.0 | | Ingress / Egress | |
| | - /.well-known/ | | - JSON-LD Processor | | - POST /inbox | |
| | webfinger | | - Object / Collection| | - GET /outbox | |
| | - Actor Document | | Store | | - HTTP Signatures S2S | |
| +--------------------+ +----------------------+ +-----------------------+ |
+-------------------------------------------------------------------------------+
1.10.1.6.2.1. 5.2.1 Identity & WebFinger
Actor URI: Actors are identified by HTTPS URIs:
https://<domain>/users/<username>.WebFinger: Mounted on
GET /.well-known/webfinger?resource=acct:<user>@<domain>. Returns JRD (JSON Resource Descriptor) pointing to the Actor URI.Actor Document: Returns ActivityStreams 2.0 JSON-LD containing:
id,type: PersonorService.inbox: https://<domain>/users/<username>/inboxoutbox: https://<domain>/users/<username>/outboxpublicKey: Ed25519 or RSA public key PEM. Fleetmesh uses its native Ed25519 identity key (did:key:z6M...).
1.10.1.6.2.2. 5.2.2 Wire & Federation
S2S Ingress (
POST /inboxandPOST /users/{id}/inbox):Receives inbound federated activities:
Create,Follow,Announce(boost),Like,Undo,Delete.Authenticates sender using HTTP Signatures (RFC 9421 / draft-cavage) by fetching remote actor’s public key.
S2S Egress:
Delivers signed activities to remote followers’ inboxes using HTTP POST with HTTP Signatures signed by the node’s Ed25519 key.
Database Schema (
fleetmesh_node/storage/activitypub.sqlite):actors:(uri, username, domain, public_key_pem, inbox_url, updated_at)activities:(id, actor_uri, type, object_json, published_at, local)followers:(actor_uri, target_user, followed_at)inbox:(id, activity_id, recipient, read_at)
Spam & DDoS Protection via Fleetmesh Capacity Engine:
Remote federated instances sending invalid activities or spamming the inbox are subjected to Fleetmesh’s
StrainLedgerpenalty scores and throttled automatically.
1.10.1.6.3. 5.3 Secure Scuttlebutt (SSB)
+-------------------------------------------------------------------------------+
| fleetmesh-protocol-ssb |
| |
| +--------------------+ +----------------------+ +-----------------------+ |
| | Secret Handshake | | Box Stream & MuxRPC | | Append-Only Log | |
| | - SHS 4-phase KEX | | - Framing & Ciphers | | - Feed verification | |
| | - Curve25519/Ed25519 - JSON/Binary Duplex | | - Monotonic sequences | |
| +--------------------+ +----------------------+ +-----------------------+ |
+-------------------------------------------------------------------------------+
1.10.1.6.3.1. 5.3.1 Architecture: Why SSB is Structurally Distinct
Unlike ATProto and ActivityPub (which are HTTP/WebSocket based), SSB operates over raw TCP streams (port 8008) with peer-to-peer discovery (LAN UDP broadcasts) and custom binary encryption framing.
1.10.1.6.3.2. 5.3.2 Secret Handshake (SHS) & Box Stream
Secret Handshake (SHS):
4-phase cryptographic key exchange using:
Ephemeral Curve25519 keys,
Long-term Ed25519 identity keys (converted to Curve25519 via
crypto_sign_ed25519_pk_to_curve25519),32-byte network capability key (“caps” key, e.g. mainnet
d4a1da283c1e443e022da12bc6139952b324e4001f40fa38ba5754035a49807f).
Guarantees mutual authentication, forward secrecy, and identity hiding.
Box Stream Framing:
Encrypts all subsequent TCP traffic into 34-byte header frames (18-byte chunk length MAC + payload MAC) using XSalsa20-Poly1305 or ChaCha20-Poly1305.
1.10.1.6.3.3. 5.3.3 MuxRPC Protocol
Asynchronous bidirectional RPC protocol over Box Stream.
Supports five call styles:
async,sync,source(pull stream),sink, andduplex.Core methods:
createHistoryStream: Pulls message logs starting from sequence number $N$.gossip.ping: Heartbeat and latency tracking.blobs.get: Retrieves content-addressed blobs by SHA-256 hash&<sha256>.sha256.
1.10.1.6.3.4. 5.3.4 Dual Implementation Options in Fleetmesh:
Option A (In-Tree Asyncio Server): An asyncio TCP server in
fleetmesh_node/planes/transport/ssb/implementing SHS and Box Stream.Option B (SSB Sidecar Daemon - Recommended):
Follows Fleetmesh’s existing FIPS and libp2p sidecar architecture (
fleetmesh_node/sidecar/fleetmesh_ssb.py).Communicates with the main
meshnodeprocess over a Unix domain socket (ssb.sock).Plugs into
TransportRouteras an outbound rung:class SSBRung(Rung): name = 'ssb' rank = 25
1.10.1.6.4. 5.4 Nostr & Blossom — Decoupled Package
The existing fleetmesh_node/nostr/ implementation is decoupled into fleetmesh-protocol-nostr:
Ingress: NIP-01 WebSocket relay (
RelayServer), NIP-11 relay information, BUD-01/02 Blossom blob endpoints.Transport Rung:
RelayRungfor NIP-59 gift-wrapped DIDComm messages.Storage: Event store and retention rules (
NodeStore).Enabling/Disabling: If disabled, no Nostr WebSocket listener opens and no Nostr subscriptions are initiated. Operators can run a pure ATProto/ActivityPub node without Nostr overhead.
1.10.1.7. 6. Unified Ingress Host Architecture (ProtocolHostRouter)
To avoid port fragmentation, ProtocolHostRouter multiplexes all HTTP and WebSocket traffic through a single port:
Incoming TCP (Port 8000)
|
[ProtocolHostRouter Multiplexer]
|
+------------------+---------------+------------------+------------------+
| (Upgrade: WS) | (Path: /xrpc) | (Path: /users) | (Path: /upload) |
v v v v v
+--------------+ +--------------+ +--------------+ +--------------+ +--------------+
| Nostr NIP-01 | | ATProto XRPC | | ActivityPub | | Blossom Blob | | /.well-known |
| Relay Server | | & Firehose WS| | Inbox/Outbox | | BUD-01 CAS | | Discovery |
+--------------+ +--------------+ +--------------+ +--------------+ +--------------+
1.10.1.7.1. Route Dispatching Rules
Path-Prefix Matching:
/xrpc/-> Dispatched tofleetmesh-protocol-atproto./users/,/actors/,/inbox/-> Dispatched tofleetmesh-protocol-activitypub./upload,/[a-f0-9]{64}-> Dispatched to Blossom CAS storage.
Standard Discovery Well-Knowns:
/.well-known/atproto-did-> ATProto DID identity./.well-known/webfinger-> ActivityPub WebFinger JRD./.well-known/did.json-> W3C DID document.
Root (
/) Protocol Negotiation:If
Upgrade: websocket: Handed to Nostr Relay WebSocket handler (or ATProto firehose if on/xrpc/com.atproto.sync.subscribeRepos).If
Accept: application/nostr+json: Handed to NIP-11 Relay Information handler.If
Accept: application/activity+json, application/ld+json: Handed to ActivityPub root Actor handler.Default: Returns node overview, supported protocols, and capability links.
1.10.1.8. 7. Declarative Configuration Schema
The node configuration (config.json) introduces the top-level protocols block:
{
"class": "edge",
"name": "edge-alpha",
"storage": {
"engine": "sqlite",
"path": "node.db"
},
"protocols": {
"host": {
"listen": "0.0.0.0",
"port": 8000,
"public_url": "https://mesh.fleetmesh.org"
},
"nostr": {
"enabled": true,
"relays": ["wss://relay.damus.io"],
"require_auth": false,
"blossom": {
"enabled": true,
"max_bytes": 104857600
}
},
"atproto": {
"enabled": true,
"handle": "node.fleetmesh.org",
"service_did": "did:web:node.fleetmesh.org",
"pds": {
"enabled": true,
"allow_registration": false
},
"firehose": {
"relay_upstream": "wss://bsky.network/xrpc/com.atproto.sync.subscribeRepos",
"subscribe": true,
"publish": true
},
"metered_peering": true
},
"activitypub": {
"enabled": true,
"domain": "social.fleetmesh.org",
"summary": "Fleetmesh Sovereign Edge Node",
"rate_limit_per_inbox": 60,
"allow_local_federation": false
},
"ssb": {
"enabled": false,
"port": 8008,
"caps": "d4a1da283c1e443e022da12bc6139952b324e4001f40fa38ba5754035a49807f"
}
}
}
allow_local_federation (ActivityPub) and allow_local_peers (p2panda) are
dev/LAN-only opt-ins, off by default. Turning one on lets outbound federation
or a p2panda push reach a loopback or private address; whenever it is off the
fetch keeps the full SSRF policy.
1.10.1.9. 8. Cross-Protocol Federation & Value Proposition
Why run these protocols on Fleetmesh instead of running independent standalone daemons?
+-------------------------------------------------------------------------------+
| Fleetmesh Cross-Protocol Federation |
| |
| Nostr (Kind 1 Note) <-------------> ActivityPub (Create{Note}) |
| ^ ^ |
| | | |
| +------------> ATProto <-----------+ |
| (app.bsky.feed.post) |
| ^ |
| | |
| v |
| SSB (post) |
| |
| * Unified CAS Blob Storage: One image uploaded once serves Blossom, Bluesky, |
| Fediverse, and Scuttlebutt media attachments without data duplication. |
| * Bilateral Token-Bucket Defense: Protection against crawler scrapers. |
| * Cashu Micro-Settlement: Paid firehose access and monetization. |
+-------------------------------------------------------------------------------+
1.10.1.9.1. 8.1 Identity Cross-Mapping
Dimension |
Nostr |
ATProto |
ActivityPub |
Secure Scuttlebutt |
|---|---|---|---|---|
Identifier |
|
|
|
|
Signing Key |
|
|
|
|
Encryption |
|
P-256 / secp256k1 |
X25519 JWE / RSA |
|
Fleetmesh Key |
|
|
|
|
1.10.1.9.2. 8.2 Data Model Translation
Operation |
Nostr |
ATProto |
ActivityPub |
SSB |
|---|---|---|---|---|
Text Post |
Kind 1 Event |
|
|
|
Profile |
Kind 0 Metadata |
|
|
|
Follow |
Kind 3 Contact List |
|
|
|
Reaction |
Kind 7 Reaction |
|
|
|
Media Blob |
Blossom SHA-256 hex |
CIDv1 raw sha2-256 ( |
URL / Attachment |
|
1.10.1.9.3. 8.3 Fleetmesh Core Superpowers Applied to Foreign Protocols
Unified Storage Plane (Blossom CAS as Single Source of Truth):
In ATProto, media blobs are SHA-256 multihash CIDs (
bafkrei...). In Blossom (Nostr), blobs are SHA-256 hex strings. In ActivityPub, media is referenced by URL. In SSB, blobs are&<hash>.sha256.Fleetmesh unifies all media into the local content-addressable
BlobStore. A media file uploaded via Blossom is instantly resolvable as an ATProto blob, an ActivityPub attachment, or an SSB blob without data duplication.
Economic Defense & Micropayments:
ATProto firehoses and ActivityPub inboxes are notoriously vulnerable to scraping and DDoS spam.
Fleetmesh applies bilateral peering tokens (
CapacityLedger) and Cashu ecash (NUT-24Paid Fetch) to inbound firehose and S2S traffic, creating the first economically defended federated server.
Decentralized Multi-Protocol Identity:
A single Fleetmesh node identity maintains cryptographic linkages across all ecosystems:
Nostr:
npub1...(secp256k1)ATProto:
did:plc:.../did:web:...(secp256k1)ActivityPub:
https://domain/users/node(ed25519)DIDComm:
did:key:z6M...(ed25519)SSB:
@<ed25519-key>.ed25519
These are published in signed identity attestations, allowing users to verify that the same sovereign operator controls identities across all ecosystems.
1.10.1.10. 9. Implementation Roadmap & Testing Strategy
+-------------------------------------------------------------------------------+
| Phase 1: Ingress Multiplexer & Abstraction Foundation |
| - ProtocolHostRouter multiplexer (HTTP/WS on port 8000) |
| - Decouple RelayServer into fleetmesh-protocol-nostr package |
| - Add protocols block to NodeConfig schema |
+-------------------------------------------------------------------------------+
|
v
+-------------------------------------------------------------------------------+
| Phase 2: AT Protocol Package (Bluesky) |
| - DAG-CBOR Tag 42 & CAR v1 encoder/decoder in fleetmesh_core |
| - Merkle Search Tree (MST) repository storage engine |
| - XRPC HTTP API (/xrpc/*) and Firehose WebSocket publisher |
| - Blossom CAS blob mapping (CIDv1 <-> SHA-256) |
| - Conformance testing against Bluesky test vectors |
+-------------------------------------------------------------------------------+
|
v
+-------------------------------------------------------------------------------+
| Phase 3: ActivityPub Package (W3C Fediverse) |
| - WebFinger discovery & Actor document generation |
| - HTTP Signatures (RFC 9421) inbound verifier & outbound signer |
| - S2S Ingress (/inbox) and Outbox distribution worker |
| - StrainLedger spam shielding |
| - Interop testing against Mastodon test instances |
+-------------------------------------------------------------------------------+
|
v
+-------------------------------------------------------------------------------+
| Phase 4: Secure Scuttlebutt Package (SSB) |
| - Secret Handshake (SHS) & Box Stream TCP server (port 8008 / sidecar) |
| - MuxRPC duplex stream handler & append-only feed storage |
| - Integration as SSBRung in TransportRouter |
+-------------------------------------------------------------------------------+
|
v
+-------------------------------------------------------------------------------+
| Phase 5: Cross-Protocol Gateway & Census Integration |
| - Cross-protocol bidirectional translation compartments |
| - Cashu NUT-24 paid firehose monetization |
| - Update scripts/check-interop.py with upstream standards vectors |
+-------------------------------------------------------------------------------+
1.10.1.10.1. Detailed Phase Breakdown
1.10.1.10.1.1. Phase 1: Ingress Multiplexer & Abstraction Foundation
Milestone 1.1: Define
ProtocolPackage,ProtocolHostRouter, andProtocolHealthinfleetmesh_core.wire.interfaces.Milestone 1.2: Implement
ProtocolHostRoutermultiplexer infleetmesh_node/transport/host.pysupporting path-based and header-based dispatching.Milestone 1.3: Decouple
RelayServerandBlossomServerinto thefleetmesh-protocol-nostrpackage, conforming toProtocolPackage.Milestone 1.4: Add
protocolsblock tofleetmesh_node/config/with backwards compatibility for legacyfaceconfigs.
1.10.1.10.1.2. Phase 2: ATProto Package Implementation (fleetmesh-protocol-atproto)
Milestone 2.1: Implement
did:plcanddid:webresolution + secp256k1 signing infleetmesh_core.identity.Milestone 2.2: Upgrade
fleetmesh_core.wire.cborto support Major Type 6 (Tag 42 IPLD CIDs) and implement Merkle Search Tree (MST) + CAR export infleetmesh_core.storage.Milestone 2.3: Implement XRPC HTTP endpoints (
/xrpc/*) and WebSocket firehose subscriber/publisher.Milestone 2.4: Validate conformance against Bluesky protocol test vectors (
com.atproto.repo,com.atproto.sync).
1.10.1.10.1.3. Phase 3: ActivityPub Package Implementation (fleetmesh-protocol-activitypub)
Milestone 3.1: Implement WebFinger discovery and Actor document generation.
Milestone 3.2: Implement ActivityStreams 2.0 JSON-LD parser and storage schema in
NodeStore.Milestone 3.3: Implement HTTP Signatures (RFC 9421 / draft-cavage) using the node’s Ed25519 keys.
Milestone 3.4: Implement Inbox (
POST) and Outbox (GET/POST) handlers, with test validation against Mastodon test instances.
1.10.1.10.1.4. Phase 4: Secure Scuttlebutt Package Implementation (fleetmesh-protocol-ssb)
Milestone 4.1: Implement Secret Handshake (SHS) and Box Stream framing in
fleetmesh_core.crypto.ssb.Milestone 4.2: Implement MuxRPC duplex framing and create history stream sync.
Milestone 4.3: Integrate SSB TCP socket listener on port 8008 or sidecar (
fleetmesh_node/sidecar/fleetmesh_ssb.py).Milestone 4.4: Implement
SSBRunginTransportRouter.
1.10.1.10.1.5. Phase 5: Cross-Protocol Gateway & Peering Metering
Milestone 5.1: Implement cross-protocol translation compartments (Nostr Kind 1 <-> ATProto post <-> ActivityPub note <-> SSB post).
Milestone 5.2: Apply token-bucket rate limiting and Cashu settlement to ATProto firehose egress and ActivityPub inbox ingress.
Milestone 5.3: Update
scripts/check-interop.pycensus to track ATProto Lexicons, W3C ActivityPub RFCs, and SSB specifications.
1.10.1.11. 10. Key Architectural Decisions & Open Questions
Multiplexer Technology:
Option A: Lightweight built-in asynchronous HTTP/WebSocket dispatcher (zero external dependencies, zero supply-chain risk, matching current
wsproto/asynciopatterns).Option B: Standard ASGI server integration (Starlette / Uvicorn).
Recommendation: Option A for node core minimalism, with optional ASGI adapter.
Package Distribution:
Option A: In-tree modules inside
fleetmesh_node/protocols/(monorepo approach).Option B: Separate installable packages (
pip install fleetmesh-protocol-atproto).Recommendation: Hybrid approach: Core protocols (Nostr, ATProto, ActivityPub) ship in-tree under
fleetmesh_node/protocols/, loaded dynamically via theprotocolsconfig block, while external protocols use the existing plugin loader.
Firehose Resource Management:
Subscribing to the Bluesky firehose requires processing hundreds of events per second.
Question: Should the ATProto firehose subscriber run inside the
meshnodeprocess or as an external worker sidecar (similar to the FIPS and P2P sidecars)?Recommendation: Optional sidecar mode for high-volume firehoses, in-process mode for personal PDS / edge leaves.
SSB Integration Model:
Question: In-process TCP socket or standalone sidecar?
Recommendation: Sidecar architecture (
fleetmesh_node/sidecar/fleetmesh_ssb.py) communicating over a Unix domain socket, maintaining complete fault isolation from the node daemon and matching the existing libp2p pattern.
1.10.1.12. 11. Production Implementations: p2panda and Rhio Cluster Sync
The pluggable protocol runtime houses two additional production suites delivering append-only cryptographic ordering and micro-datacenter cluster replication.
1.10.1.12.1. 11.1 p2panda Protocol Package (fleetmesh-protocol-p2panda)
Conforming to the p2panda specification (v0.4.0), this package integrates decentralized append-only operation logs:
Cryptographic Foundation: Author identities are 64-character lowercase hex Ed25519 public keys mapped from the node’s transport keypair.
Deterministic CBOR Encoding: Uses
fleetmesh_core.wire.cborfor canonical RFC 8949 deterministic encoding of operation headers and payloads.Strict Chain Monotonicity:
Genesis operations (
seq_num == 0) strictly enforcebacklink is Noneandprevious_seq_num is None.Successive operations (
seq_num > 0) requireprevious_seq_num == seq_num - 1and cryptographic backlink continuity (backlink == prev_op.id).
Storage Engine (
P2PandaLogStore): Thread-safe SQLite store configured withPRAGMA busy_timeout=5000;and single-initializationPRAGMA journal_mode=WAL;.HTTP/CBOR Ingress:
GET /p2panda/status: Node protocol health, author identity, and operation counts.GET /p2panda/operations?author=<pubkey>: Ordered operation logs from sequence number.GET /p2panda/operations/<op_id>: Direct permalink returning single verified operation.GET /p2panda/operations/<author>: Direct permalink returning author operation stream.POST /p2panda/operations: Accepts canonical CBOR or JSON operation envelopes, verifying signatures and appending to local logs.
Transport Ladder Rung (
P2PandaRung): Operates at rank 15 inTransportRouter. Delivers DIDComm messages wrapped as signed p2panda operations to local logs and upstream HTTP/CBOR endpoints.
1.10.1.12.2. 11.2 Rhio Protocol Package (fleetmesh-protocol-rhio)
Derived from HIRO MicroDataCenters Rhio cluster architecture, this package equips nodes for high-throughput edge micro-datacenter clustering:
Bao Chunked Tree Hashing (
RhioBaoTree): Standard-library hierarchical Merkle tree hashing using 1024-byte chunk slicing with\x00leaf domain separators and\x01parent domain separators. Enables verified streaming content retrieval.CAS Blob Synchronization (
RhioBlobSync): Local content-addressable storage repository paired with SQLite metadata (rhio_blobs.db). UsesINSERT OR IGNOREsemantics to preserve original creation timestamps and S3 synchronization status (synced_s3).Decoupled Sidecar Daemon (
fleetmesh-rhio): Runs as a separate process managing NATS JetStream pub/sub connections and S3/MinIO cluster synchronization. Communicates with meshnode over Unix Domain Socket (rhio.sock) via thefleetmesh-rhio/1newline-delimited JSON IPC protocol with automatic socket cleanup and reconnect recovery.HTTP Ingress:
GET /rhio/status: Node network ID, NATS endpoint, S3 endpoint, and stored blob count.GET /rhio/blobs?hash=<sha256>&GET /rhio/blobs/<sha256>: Direct binary CAS stream retrieval.POST /rhio/blobs: Stores raw bytes or base64 JSON payloads, calculating Bao roots and recording CAS entries.GET /rhio/sync: S3 cluster synchronization status.
Transport Ladder Rung (
RhioRung): Operates at rank 12 inTransportRouter. Publishes outbound DIDComm envelopes across NATS JetStream subjects (fleetmesh.<pubkey>).