HomeDistributed & Parallel ComputingMerkle Tree Sync: Reconciling Offline-Diverged Replicas

Merkle Tree Sync: Reconciling Offline-Diverged Replicas

Two copies of a dataset drift apart while one is offline. Watch a Merkle-tree anti-entropy sync compare hash subtrees top-down, pruning whole matching branches so only the few changed records ever get transferred.

Distributed & Parallel Computing3DModerate60 FPS📱 Mobile-adapted
offline ↗ Open standalone

When a mobile client or database node goes offline and keeps working, its local copy of the data drifts away from the server's copy — but re-syncing shouldn't mean comparing every single record over the network. This simulator builds two Merkle trees, one per replica, where every leaf hashes a record and every internal node hashes its children. Take Replica A offline, let random edits accumulate on it, then run the sync: the algorithm walks both trees from the root and prunes any subtree whose hash still matches, only descending into branches that actually diverged and only transferring the handful of leaf records that changed. Live counters compare the number of hash comparisons actually performed against a naive full linear scan, showing exactly why this is the mechanism real distributed databases (Cassandra, DynamoDB, CouchDB) use for anti-entropy repair.

⚙ Under the hood

Two replicas drift apart while one works offline; watch a Merkle-tree anti-entropy sync compare hash subtrees top-down, pruning whole matching branches so only the handful of changed records ever get transferred.

merkle-treeanti-entropyoffline-syncdistributed-systemshash-treecomputer-science

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)