Skip to main content
net10.0net8.0net9.0.NETStandard2.0.NETStandard2.1

Scalability-Protocols (BUS) gossip transport for Crdt.Transport, built on NanoMsgSharp (managed nanomsg/NNG over tcp, tls, ipc, ws, and inproc).

Published
Jul 15, 2026
3mo ago
Total Downloads
742
742

Install

dotnet add package Crdt.Transport.NanoMsg --version 1.1.2
ProductVersions
.NET
net10.0net8.0net9.0
.NET Standard
netstandard2.0netstandard2.1

README

Crdt

CI NuGet GitHub Packages

High-performance, NativeAOT-ready Conflict-free Replicated Data Types (CRDTs) for modern .NET.

Crdt implements the full catalogue of CRDTs β€” counters, registers, sets, maps, flags, graphs, trees, JSON documents, and sequence/text types β€” in state-based, delta-state, and operation-based flavours, with compact binary and System.Text.Json source-generated serialization. It also includes advanced/esoteric variants (bounded, resettable, and handoff counters, causal-length sets, a tree with move, Fugue, and interval tree clocks).

✨ Why Crdt

  • Strong eventual consistency without coordination: replicas converge after exchanging state, deltas, or operations.
  • Fast: readonly struct building blocks, Span<T>/IBufferWriter<byte> serialization, BinaryPrimitives/Unsafe fast paths, no LINQ on hot paths.
  • NativeAOT & trimming clean on .NET 8/9/10 β€” the library is annotated IsAotCompatible, and the test suite itself is verified running as a NativeAOT binary.
  • Broad reach: targets netstandard2.0, netstandard2.1, net8.0, net9.0, net10.0 (polyfilled on older runtimes).
  • Strong-named: all assemblies are signed (public key token da3d093ebe8bf537) for strong-named and .NET Framework consumers β€” see strong naming.

Supported target frameworks

TFM Notes
net10.0, net9.0, net8.0 Full feature set; NativeAOT supported.
netstandard2.1 Compatibility target (Unity / Mono / .NET Core 3.x) via polyfills; not itself AOT-published.
netstandard2.0 Broad compatibility target (.NET Framework 4.6.1+, older Unity / Mono) via System.Memory + Microsoft.Bcl.HashCode and source polyfills; not AOT-published.

πŸ“¦ Install

dotnet add package Crdt

The optional replication/transport layer β€” in-memory, TCP (with optional TLS), and UDP anti-entropy gossip, in state-based, delta-state, and operation-based modes β€” ships as a separate package:

dotnet add package Crdt.Transport

DTLS-secured datagram gossip (built on DtlsSharp) lives in a further opt-in package:

dotnet add package Crdt.Transport.Dtls

MQTT broker gossip (built on Mqtt.Client) β€” for replicas that reach each other through an MQTT 3.1.1/5.0 broker rather than peer-to-peer β€” ships as another opt-in package:

dotnet add package Crdt.Transport.Mqtt

Peer-to-peer gossip over the nanomsg/NNG BUS scalability protocol (built on NanoMsgSharp, pure-managed, no broker) β€” over TCP, TLS, IPC, WebSockets, or in-process β€” ships as another opt-in package:

dotnet add package Crdt.Transport.NanoMsg

PGM reliable multicast (built on Pgm, pure-managed RFC 3208 multicast) ships as another opt-in package:

dotnet add package Crdt.Transport.Pgm

🧩 CRDT catalogue

Family Types
Counters GCounter, PNCounter, BCounter, ResettableCounter, HandoffCounter
Registers LWWRegister<T>, MVRegister<T>
Sets GSet<T>, TwoPhaseSet<T>, LWWElementSet<T>, ORSet<T>, CausalLengthSet<T>
Maps ORMap<TKey,TValue>, LWWMap<TKey,TValue>
Flags EnableWinsFlag, DisableWinsFlag, GFlag
Graphs TwoPTwoPGraph, AddOnlyDag
Trees ReplicatedTree (highly-available move)
Documents JsonCrdt (nested JSON)
Sequences / Text Rga<T>, LogootSequence<T>, LSeqSequence<T>, TreedocSequence<T>, YataSequence<T>, WootSequence<T>, FugueSequence<T>, Text
Causal clocks HybridLogicalClock, VersionVector, IntervalTreeClock

The Counters, Sets, Trees, Documents, Sequences, and Causal clocks rows include several advanced / esoteric CRDTs (bounded, resettable, and handoff counters; causal-length set; tree-with-move; JSON document; Fugue; interval tree clocks). See Advanced / esoteric CRDTs for what each one is for.

πŸ” Replication models

  • State-based (CvRDT) β€” exchange and Merge full states. Robust to reordering and duplication.
  • Delta-state β€” propagate small deltas of the same lattice; converges with a causal delta protocol.
  • Operation-based (CmRDT) β€” propagate operations carrying their causal context; effects are idempotent / de-duplicated.

Crdt provides the data structures, merge/delta/operation logic, and serialization. Wiring replicas to a network (gossip, anti-entropy, broadcast) is left to the application.

πŸ“š Documentation

  • Getting started β€” install, your first counter, merging replicas.
  • Data types β€” the full catalogue with usage examples for every CRDT.
  • Choosing a data type β€” when to use which type, when not to, and rough performance/resource cost.
  • Replication models β€” state-based, delta-state, and operation-based, and when to use each.
  • Garbage collection β€” causal stability, stable cuts, tombstone reclamation, and pluggable consensus.
  • Serialization β€” the binary and JSON formats, value serializers, and hostile-input limits.
  • Architecture β€” semilattices, dots, the causal kernel (ORSWOT), and the Hybrid Logical Clock.
  • Performance & NativeAOT β€” AOT compliance, trimming, and benchmarking notes.
  • Transports β€” the optional Crdt.Transport package: in-memory, TCP/UDP, DTLS-secured, MQTT broker, nanomsg/NNG BUS, and PGM multicast gossip replication.
  • Strong naming β€” assembly identity and the committed signing key.

πŸ› οΈ Building from source

dotnet build Crdt.slnx -c Release
dotnet test  Crdt.slnx -c Release

Linting / formatting:

dotnet format Crdt.slnx --verify-no-changes
pwsh -NoProfile -File eng/check-line-length.ps1

NativeAOT test gate (publishes and runs the suite as a native binary):

dotnet publish tests/Crdt.Tests/Crdt.Tests.csproj -c Release -f net10.0 -r <rid> -p:AotTest=true

πŸ“„ License

MIT

Changes from Previous Version

No structural changes between v1.1.1 and v1.1.2.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 5 target frameworks; confirm the exact target used by your application.The published metadata declares 23 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.