Merklizing the key/value store for fun and profit | Joel Gustafson
Suppose you and I each have a local key/value store. We suspect our key/value stores have mostly the same contents, but that there might be a few differences: a couple entries that you have that I don’t, that I have that you don’t, or conflicting values for the same key. What’s the best way for us to compare the content of our databases and identify the differences? Naively, I could send you all of my entries, and you can send me all of your entries. Or I could send you all of my entries, and you could iterate over them and just send me back the diff. But this is still linear in the number of entries. If you and I care enough about making diffs efficient, we can both maintain a special kind of merkle tree called a Prolly Tree that allows us to skip large sections of shared entries and identify conflicts in logarithmic time. This “merkle syncing” capability is a powerful and versatile peer-to-peer primitive and can be used as a natural persistence layer for CRDT systems, an “rsync for k
--> Merklizing the key/value store for fun and profit | Joel Gustafson Merklizing the key/value store for fun and profit Joel Gustafson / Posts / 2023-05-04 Suppose you and I each have a local key/value store. We suspect our key/value stores have mostly the same contents, but that there might be a few differences: a couple entries that you have that I don’t, that I have that you don’t, or conflicting values for the same key. What’s the best way for us to compare the content of our databases and identify the differences? Naively, I could send you all of my entries, and you can send me all of yo
saved by
related reading
- Build Your Own Databasenan.fyi
- Building a BFT JSON CRDTjzhao.xyz
- What is a Merkle Tree?decentralizedthoughts.github.io
- Prolly Trees | DoltHub Blogdolthub.com
- Merkle Tree | Brilliant Math & Science Wikibrilliant.org
- An Interactive Intro to CRDTs | jakelazaroff.comjakelazaroff.com
- Static search trees: 40x faster than binary search · CuriousCodingcuriouscoding.nl
- How Dolt Stores Table Data | DoltHub Blogdolthub.com
- The Hitchhiker's Guide to Ethereum - Delphi Digitalmembers.delphidigital.io
- How Cursor Indexes Codebases Fastread.engineerscodex.com
- CRDTs go brrrjosephg.com
- Merkle Trees & Merkle Roots: Bitcoin & Blockchain | Geminigemini.com