mirror of
https://github.com/luxfi/fhe.git
synced 2026-07-26 23:16:08 +00:00
- data-seal: Verifiable Data Integrity Seal (PIP-0010/LP-0535) FHE-encrypted tamper-proof sealing with Public/ZK/Private modes, batch sealing, homomorphic verification - content-provenance: AI & Media Content Provenance (PIP-0011/LP-7110) Model manifests, output attestation via homomorphic comparison, media derivation DAGs - encrypted-crdt: Encrypted CRDT (PIP-0013/LP-6500) LWW-Register with FHE values, OR-Set with tag-based add/remove, Lamport timestamp conflict resolution, deterministic merge - shadow-governance: Shadow Government Protocol (PIP-7010) Anonymous ministries, encrypted voting with homomorphic tallying, nullifier-based anti-fraud, quorum enforcement Each example includes Solidity contracts, Hardhat tests, CLI tasks, and README linking to corresponding PIP and LP specifications.
2.0 KiB
2.0 KiB
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)