# 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:** ```bash 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 2. In Console, type `l` to list peers. 3. In Console, type `p` to put some data (`Alice`, `Bob`). ## ๐Ÿ“š Documentation For complete v0.6 documentation, see: - [Getting Started](../docs/v0.6/getting-started.html) - [Security](../docs/v0.6/security.html) - [Conflict Resolution](../docs/v0.6/conflict-resolution.html) - [Architecture](../docs/v0.6/architecture.html) ## ๐Ÿ†• 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:** ```bash 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:** ```bash 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).