mirror of
https://github.com/luxfi/fhe.git
synced 2026-09-24 00:27:17 +00:00
Two thousand and twenty-one packages carried more than one spec across this estate — eslint alone in a hundred and four forms — and a package resolved twice is two copies at run time, which is how react-hook-form came to report "two different types with this name" from files nobody had edited. None do now. The number lives in the catalog: a manifest names the package, the workspace names the version. Where a manifest cannot reach a catalog it still carries the one version, because the table is the source either way. Co-authored-by: Hanzo Dev <[email protected]>
Encrypted CRDT - Offline-First Privacy
FHE-encrypted Conflict-Free Replicated Data Types for privacy-preserving collaboration.
Implements: PIP-0013 / LP-6500
CRDT Types
| Type | Description | Merge Strategy |
|---|---|---|
| LWW-Register | Last-Writer-Wins Register | Higher timestamp wins, address tiebreak |
| OR-Set | Observed-Remove Set | Tag-based add/remove with tombstones |
How It Works
- Write: Encrypt your value with FHE, assign a Lamport timestamp, store on-chain
- Sync: Peers exchange encrypted registers — values never revealed during sync
- Merge: Deterministic conflict resolution (LWW) operates on encrypted values
- Read: Request threshold decryption only when you need the plaintext
Key Properties
- Convergence: All replicas converge to the same state after syncing all operations
- Privacy: Values encrypted end-to-end — even the chain only sees ciphertext
- Offline-first: Lamport timestamps enable conflict resolution after offline edits
- Mesh-compatible: Works over sneakernet, Bluetooth, or any transport
Quick Start
npm install
npx hardhat compile
npx hardhat test
# Deploy
npx hardhat task:deploy-crdt
# Set a register
npx hardhat task:set-register --contract <addr> --doc myDoc --field title --value 42 --timestamp 1
# Read a register
npx hardhat task:get-register --contract <addr> --doc myDoc --field title
# Merge conflicting registers
npx hardhat task:merge-registers --contract <addr> --doc myDoc --field1 alice-title --field2 bob-title --result merged-title
Related
- Go implementation: github.com/luxfi/fhe/cmd/crdt — Boolean-circuit LWW-Register with MUX selection
- LP-6501: DocReceipts (on-chain document update receipts)
- LP-6502: DAReceipts (data availability certificates)