Files

CBDDC Samples

This directory contains sample applications demonstrating CBDDC v0.6 integration across different platforms using the Lifter hosting model.

🔗 Cross-Platform Cluster Compatibility

All samples are configured to run on the same cluster securely. You can run them simultaneously to test real-time P2P synchronization.

Parameter Value Description
AuthToken demo-secret-key Shared secret for secure discovery
Discovery Port 6000 (UDP) Port for local peer discovery
DB Mode SQLite (WAL) Persistent storage

🖥️ ZB.MOM.WW.CBDDC.Sample.Console

Interactive CLI node. Good for monitoring the mesh.

Run:

cd ZB.MOM.WW.CBDDC.Sample.Console
dotnet run
# OR simulate multiple nodes:
dotnet run node-2 5001
dotnet run node-3 5002
# Enable recursive merge conflict resolution:
dotnet run --merge

🧪 Quick Test Scenario

  1. Start Console app (creates node-1). All Nodes Must Use Same Security Mode:
  • Secure ↔ Secure: Works
  • Plaintext ↔ Plaintext: Works
  • Secure ↔ Plaintext: Connection fails
  1. In Console, type l to list peers.
  2. In Console, type p to put some data (Alice, Bob).

📚 Documentation

For complete v0.6 documentation, see:

🆕 Conflict Resolution Demo

New Commands (Console sample):

  • demo - Run automated conflict scenario
  • todos - View all TodoLists
  • resolver [lww|merge] - Show current strategy

Try Recursive Merge:

cd ZB.MOM.WW.CBDDC.Sample.Console
dotnet run --merge
# Type: demo

The demo simulates concurrent edits to a TodoList. With --merge, both changes are preserved by merging array items by id. Without it (LWW), last write wins.

🔒 Network Security

Enable encrypted communication:

dotnet run --secure

Features:

  • ECDH key exchange for session establishment
  • AES-256-CBC encryption with HMAC-SHA256 authentication
  • Visual indicators: 🔒 (encrypted) vs 🔓 (plaintext)
  • Status displayed in l (list peers) and h (health) commands

Note: All nodes in a cluster must use the same security mode (all --secure or all plaintext).