Reference Implementation
meshnode wraps the executable specification in fleetmesh_core/, running on Python 3.11+
with minimal dependencies (standard library plus cryptography).
Typed runtime protocols in fleetmesh_node/interfaces.py enforce hard seams between storage, transport,
peering, accounting, and opt-in services. Walk each layer step by step using the right-hand table of contents.
01 · Compartments & Isolation
Hard failure boundaries in tick order
Instead of one monolithic event loop where a stalled relay or bad frame takes down the whole daemon,
meshnode isolates every subsystem inside an explicit Compartment defined in
fleetmesh_node/compartment/base.py under the subsystem/1 contract. Each compartment
is built from a shared NodeContext, declares its config keys (reads) and dependencies
(requires), and exposes four standard surfaces—state, trouble,
report, and command—so a fault stays contained to the unit that caused it.
Stage 01 · Foundation
Link journal & operator trust first
link ticks first so dropped relay subscriptions are logged before downstream logic reacts. trust runs next so human operator overrides always outrank automated scoring.
Stage 02 · Accountability
Bilateral mechanics & load shedding
strain, peering, budget, capacity, sync, and reporter enforce grants, receipts, and backpressure before outbound discovery or work begins.
Stage 03 · Reachability
Self-publication & fleet boundaries
Identity, discovery, LAN/P2P transport, presence, linked data, and private network isolation run next, followed by local storage retention and discretionary scheduler pulls.
Stage 04 · Opt-In Services
Media, compute, gateways & audit
Settlement, mediation, verified blobs, sidecars, remote control, and opt-in HTTP/compute faces run last—with updates ticking at the very end so it can report on everything above.
Six Architectural Planes
Every compartment lives inside one of six packages under fleetmesh_node/planes/. Tick numbers
(#01–#32) show exact execution order in MANIFEST; optional
compartments stay completely dormant unless their config block is enabled.
Plane 01 · 3 Core · 2 Optional
Transport & Connectivity
planes/transport/
Carries encrypted frames across relays, local networks, direct P2P tunnels, and mediated queues for NAT-bound or mobile leaves.
-
#01
linkCore
Maintains relay WebSocket subscriptions, tracks reconnects, and journals dropped links first so no downstream subsystem acts on stale transport state.
-
#11
lanCore
Discovers local FleetMesh peers on the same subnet via mDNS and DNS-SD with zero external relay traffic.
-
#12
p2pOptional
Enables direct peer-to-peer transport rungs (fips-native, iroh, libp2p) when cfg['p2p'] is set, bypassing relays for low-latency links.
-
#21
bridgeOptional
Bidirectional relay bridge (cfg['bridge']) that subscribes, forwards, and backfills verified Nostr events across external standard relays.
-
#23
mediationCore
Queues and forwards DIDComm envelopes for intermittent browser and mobile Leaf nodes sitting behind NAT or offline.
Plane 02 · 6 Core
Peering, Trust & Governance
planes/peering/
Turns open peering into a self-defending network: operator trust rules, bilateral traffic grants, signed usage receipts, dynamic load shedding, and verifiable reputation reports.
-
#02
trustCore
Applies explicit operator allow/deny decisions and peer tier overrides ahead of all automated accounting and reputation ladders.
-
#03
strainCore
Tracks directional traffic load and relay reconnect pressure (wired to link via an explicit bind() back-edge) to surface single-relay dependence.
-
#04
peeringCore
Drives the bilateral DIDComm peering handshake (offer, propose, accept, terminate) and rejects unknown peers under pressure via a bind() edge to capacity.
-
#05
budgetCore
Issues signed kind 30801 bilateral grants, meters per-window events and bytes, verifies hash-chained receipts, and runs the AIMD headroom ramp.
-
#06
capacityCore
Monitors host resource limits and steps through the 4-rung load-shedding ladder whenever bandwidth, memory, or storage tighten.
-
#08
reporterCore
Evaluates window discrepancies (S1–S4), runs notice-first complaint windows, emits signed kind 30802 findings, and projects NIP-32/NIP-85 standing labels.
Plane 03 · 5 Core
Identity, Presence & Membership
planes/identity/
Publishes who this node is, discovers reachable peers, broadcasts liveness, and enforces strict separation between private fleets and the public mesh.
-
#09
discoveryCore
Watches peer kind 11801 descriptors and rendezvous relays so the local peer directory stays current without central registries.
-
#10
announceCore
Signs and refreshes this node’s own kind 11801 descriptor, declared endpoints, node class, and protocol schema digest.
-
#14
presenceCore
Emits periodic kind 21801 liveness heartbeats and kind 10050 relay routing hints so partners know which paths are warm.
-
#15
linkedCore
Serves deterministic Schema.org JSON-LD views over descriptors, grants, and offers using live state from presence and budget.
-
#16
networkCore
Enforces private fleet membership, invite/credential enrolment, and visibility boundaries—splitting private descriptors cleanly from the public mesh.
Plane 04 · 4 Core
Storage, Sync & Media Replication
planes/store/
Keeps events and verified binary media synchronized across peers while bounding local disk footprint with deterministic retention rules.
-
#07
syncCore
Runs NIP-77 Negentropy range reconciliation inside signed delivery envelopes so offline peers catch up by exchanging only missing deltas.
-
#17
retentionCore
Enforces event TTLs, storage ceilings, and pruning sweeps so SQLite and PostgreSQL stores never grow unbounded.
-
#24
blob_wireCore
Handles wire-level verified media transfer (blob/1.0) with incremental 1,024-byte Bao Merkle chunk validation as bytes arrive.
-
#25
blob_replicationCore
Mirrors and pins content-addressed media blobs across trusted partners and configured origins to keep assets resilient.
Plane 05 · 3 Core · 6 Optional
Services, Compute & Gateways
planes/services/
Turns a relay node into an application platform—settlement rails, paid content fetch, sandboxed compute, static web hosting, live video reflection, and sidecar orchestration.
-
#13
gossipOptional
Topic-scoped pub/sub gossipsub mesh (cfg['gossip']) for fast fan-out broadcasts across connected P2P peers.
-
#19
computeOptional
Executes sandboxed WASI, FFmpeg media, zero-knowledge proof checks, and fuel-bounded MCP/LLM workloads locally (cfg['compute']).
-
#20
compute_wireOptional
Speaks the compute/1.0 & compute/1.1 DIDComm wire protocols for sealed job submission, live progress streaming, and cancellation.
-
#22
settlementCore
Coordinates peer-to-peer micropayment rails and escrow across Lightning (BOLT11/12), Cashu ecash, and Nostr Wallet Connect (NIP-47) (MANIFEST name: settle).
-
#26
paid_fetchCore
Enforces HTTP 402 Paid Fetch quotes and NUT-24 ecash token redemption for metered blob and content delivery (MANIFEST name: paidfetch).
-
#27
sidecarsCore
Monitors external manifest-backed HTTP sidecars—Git (grasp/1.0), OCI registries (ncontainer/1.0), and media catalogs—alongside the node.
-
#29
dvmOptional
NIP-90 Data Vending Machine gateway (cfg['dvm']) translating kinds 5000–5999 into sandboxed compute jobs and signed results.
-
#30
nsiteOptional
NIP-5A decentralized static-site HTTP gateway (cfg['nsite']) reading manifests through bridge with COOP/COEP isolation.
-
#31
videoOptional
Live CMAF/LL-HLS video packaging and work-barter transit reflection (cfg['video']) over video-transit/1.0.
Plane 06 · 2 Core · 1 Optional
Operations & Control
planes/operations/
Drives discretionary background pulls, authenticated remote fleet administration, and node-wide upgrade reporting.
-
#18
schedulerCore
Triggers discretionary outbound peer pulls and periodic sync jobs only after trust, grants, capacity, and retention have settled.
-
#28
remoteCore
Executes signed operator commands remotely over control/1.0 with UCAN capability validation and full audit logging.
-
#32
updatesOptional
Ticks last (cfg['updates']) so it can inspect every upstream compartment, detect release or protocol digest drift, and report upgrade status.
Runtime Contract & Canonical Tick Sequence
Verified directly against MANIFEST in fleetmesh_node/app/core.py on every CI run.
- Tick Order
- 23 core compartments in tick order:
link, trust, strain, peering, budget, capacity, sync, reporter, discovery, announce, lan, presence, linked, network, retention, scheduler, settlement, mediation, blob_wire, blob_replication, paid_fetch, sidecars, and remote. Up to 9 optional ones join the order when configured: p2p (#12) and gossip (#13) after lan, compute (#19), compute_wire (#20), and bridge (#21) after scheduler, then dvm (#29), nsite (#30), video (#31), and updates (#32) last.
- Refusal Channel
- Every rejected action logs a structured reason (
capacity, auth, rate, schema)—never a silent drop.
- Contracts
- Static typing and formal runtime protocols in
fleetmesh_node/interfaces.py enforce strict seams between storage, sync, peering, and accounting; two explicit bind() back-edges wire link → strain and peering → capacity.
Minimal Default Attack Surface
All nine optional compartments stay completely dormant until explicitly enabled in node config.
Run meshnode subsystems at any time to inspect live tick health, active compartments, and structured refusals.
02 · State & Storage
SQLite on one box, PostgreSQL at scale
Every critical transition flushes to durable storage before any wire acknowledgment goes out, so restarts mid-window
preserve exact accounting meters, active grants, and receipt hash chains.
State & Storage Model
Pluggable SQLite and PostgreSQL dialects with content-addressed causal projections.
- Event Store
- Deduplicated storage via
SqliteDialect or PostgresDialect with tag indexes, Negentropy ranges, and multi-replica store_lease coordination.
- Causal Graph
ProjectedNodeStore in fleetmesh_node/storage/projected.py tracks thread roots, reactions, reposts, and deletions by content hash.
- Ledgers
- Active and historical peering grants, per-window traffic meters, receipt hash chains, and directional strain ledgers.
- control.sock
- Local UNIX domain socket exposing live inspection, manifest reconciliation, and event streams to operator tooling.
03 · Transport & Accounting
Seven-rung dialer & bilateral ledgers
Nodes separate wire reachability from resource accountability: the transport ladder negotiates the fastest
available carrier while bilateral grants and hash-chained receipts meter every byte exchanged.
Transport & Wire Stack
Seven-rung transport priority from native P2P overlays down to gift-wrapped fallback.
- Multi-Key ID
secp256k1 (did:nostr), X25519 (DIDComm agreement), and Ed25519 (transport), plus did:key, did:peer, did:plc, and did:web.
- 7-Rung Dialer
- Prefers
fips-native (5), iroh (10), rhio (12), p2panda (15), libp2p (20), ssb (25), and falls back to nostr gift wraps (100).
- Sync Face
- Async WebSocket relay supporting NIP-01, NIP-11, and NIP-77 Negentropy reconciliation inside signed delivery envelopes.
Bilateral Accounting
Cryptographic accountability between two peers—zero global consensus required.
- Grants
- Signed
kind 30801 envelopes publish explicit request ceilings, event caps, and accounting windows.
- Receipts
- Monotonic hash-chained receipts prove delivered traffic on cadence and verify in the issuer’s frame.
- AIMD Loop
- Clean windows expand peer headroom; verified discrepancies trigger deterministic S0–S4 back-off.
04 · Compute & Settlement
Sandboxed execution & multi-rail micropayments
Opt-in compute compartments let operators sell or barter deterministic workloads—from WebAssembly and
FFmpeg transcoding to zero-knowledge verification and fuel-bounded MCP agents—with zero protocol rent.
Compute, ZK & AI Fabric
Sandboxed WASI, Groth16 & zkVM verification, LLM routers, and fuel-bounded MCP agents.
- WASI & Media
- Sandboxed WebAssembly in
fleetmesh_node/planes/services/compute/executors/wasm.py and deterministic FFmpeg transcoding in fleetmesh_node/planes/services/compute/executors/media.py.
- Zero-Knowledge
- Groth16 proofs over
alt_bn128 in fleetmesh_core/crypto/zk.py plus RISC Zero and SP1 zkVM receipt checks in fleetmesh_node/planes/services/compute/executors/zk.py.
- LLM & MCP
- Multi-provider LLM routing in
fleetmesh_node/planes/services/compute/executors/providers.py and fuel-capped ReAct agents in fleetmesh_node/planes/services/compute/executors/mcp.py.
Multi-Rail Settlement & Paid Fetch
Peer-to-peer micropayments, escrow, and HTTP 402 Paid Fetch in fleetmesh_node/settlement/.
- Lightning
- BOLT11, BOLT12, and L402 preimage escrow for atomic, accountable sealed delivery.
- Cashu & NUT-24
- Chaumian ecash mint swaps/melts and HTTP 402 Paid Fetch in
fleetmesh_node/planes/services/paidfetch/compartment.py.
- NWC (NIP-47)
- Nostr Wallet Connect hooks for automated, client-delegated settlement.
05 · Bridges & Protocols
One verifiable node, six federated suites
Rather than isolating users inside a single wire format, opt-in bridges and protocol suites normalize Nostr,
ATProto, ActivityPub, Scuttlebutt, p2panda, and Rhio/Bao onto the same signed node substrate.
Universal Relay Bridge
Continuous bidirectional bridging across existing Nostr relays.
- Ingress & Egress
- Live subscription and forwarding in
fleetmesh_node/planes/transport/bridge/compartment.py with full signature and provenance checks.
- Shard Routing
- Automatic topic-tag (
#t) indexing routes community traffic to the right mesh shards.
- Backfill
- Range-bounded historical reconciliation over standard external WebSocket relays.
DVM & Linked Data
NIP-90 compute translation, Schema.org JSON-LD, and NIP-32/85 projections.
- NIP-90 DVM
- Translates kinds 5000–5999 into sandboxed WASI jobs in
fleetmesh_node/dvm/ and returns signed results.
- NIP-32 & NIP-85
- Projects verified adverse findings into kind 1985 labels and kind 30385 relay assertions backed by kind 30802 evidence.
- Schema.org
- Deterministic JSON-LD projections in
fleetmesh_core/projection/linked_data.py across descriptors, grants, and offers.
Pluggable Protocol Suites
Six federated protocols hosted on one node via fleetmesh_node/protocols/base.py.
- ATProto & ActivityPub
- XRPC PDS/Relay, DAG-CBOR MSTs, and CAR v1 slices alongside ActivityStreams 2.0, WebFinger, and RFC 9421 signatures.
- SSB & p2panda
- Secure Scuttlebutt SHS, Box Stream, and MuxRPC plus RFC 8949 CBOR append logs with checkpoint pruning.
- Rhio / Bao
- 1,024-byte chunked Bao Merkle verification, HTTP 206 byte-range serving, and NATS JetStream subject routing.
06 · Media, Leaf & Ops
Edge services, browser leaves & declarative fleets
The top layer turns verified blobs and grants into end-user apps—live video reflection, NIP-5A static web
hosting, zero-install browser leaves, and Rust-powered declarative fleet management.
Live Video & Sidecars
CMAF/LL-HLS video reflection, work-barter transit, and NIP-5A static hosting.
- Video Transit
- Live fMP4/WebM segmenting and reflection in
fleetmesh_node/planes/services/video/compartment.py over video-transit/1.0 with HTTP 307 shedding.
- NIP-5A nsite
- Decentralized static web gateway in
fleetmesh_node/planes/services/nsite/compartment.py serving kind 15128/35128 manifests with COOP/COEP isolation.
- Sidecars
- Health and manifest checks in
fleetmesh_node/planes/services/sidecars/compartment.py for Git (grasp/1.0), OCI (ncontainer/1.0), and media catalogs.
Browser Leaf & Key Login
Zero-install browser nodes and passwordless multi-app authentication.
- @fleetmesh/leaf
- TypeScript browser SDK for Chromium, Firefox, and WebKit with IndexedDB storage, Web Locks tab sync, NIP-77 diffing, and
budget/1.0 receipts.
- fleetmesh_auth
- Passwordless login via NIP-07 extensions and NIP-46 remote signers, plus NIP-98 portable passes (
fmpass_...).
- Rendezvous
- Zero-privilege cold-start discovery relay at
wss://relay.fleetmesh.org for bootstrapping descriptors and mediators.
Declarative Fleet Ops
Schema-checked manifests, Rust meshctl, and local multi-node testnets.
- Manifests & meshctl
fleetmesh.org/v1alpha1 YAML under manifests/, validated by scripts/check-manifests.py and applied with meshnode init --manifest. The Rust meshctl CLI drives hot-reconciliation, 6-plane conformance, and live fleet watches.
- Cluster Engine
- Local multi-node simulator in
fleetmesh_node/testnet/cluster.py for mesh, star, ring, and line topologies.
- Health Watch
- Machine-readable JSON invariant auditing via
meshctl watch --json with clean exit codes (0, 1, 2).