CRDT

Creator
Creator
Seonglae Cho
Created
Created
2022 Nov 30 18:6
Editor
Edited
Edited
2025 Jun 21 19:44

Realtime Collaborative Editing protocol

Conflict-free replicated data type

Same state if changes are the same regardless of order
In distributed computing, a conflict-free replicated data type is a data structure that is replicated across multiple computers in a network, where applications can update all replicas simultaneously and independently without coordination with other replicas.
https://channel.io/ko/blog/crdt_vs_ot
interface CRDT<T, S> { value: T; state: S; merge(state: S): void; }
type Value<T> = { [key: string]: T; }; type State<T> = { [key: string]: LWWRegister<T | null>["state"]; };
CRDT Tools
 
 
CRDT Algorithms
 
 
 
 

Introduction

Local first Development
CRDT

To synchronize without an asymmetric server, the server needs to merge changes without knowing the content. For this, homomorphic encryption is proposed instead of traditional encryption.
  1. Using the TFHE library, the server performs encrypted numerical operations (addition/multiplication) with a server key generated by the client, and the client decrypts the results to obtain correct sum and multiplication results.
  1. To apply homomorphic encryption to LWW (Last-Write-Wins) Register CRDT, all branches and iterations must be performed a fixed number of times, and use the select operation with encrypted boolean values for conditional replacement to prevent leaks.
While homomorphic encryption CRDT is theoretically possible, it has fundamental limitations in terms of keys, performance, and space, making it difficult to immediately apply to real local-first apps.
Implementation
 
 

Recommendations