
Ethereum's Compact Merkle Trie - tosh
https://nervous.io/clojure/crypto/2018/04/04/clojure-evm-iii/
======
nemo1618
Weird coincidence: this post uses Sputter, an EVM implementation written in
Clojure, and there's a Clojure-inspired Lisp named "Sputter" at the top of
/r/golang right now. Threw me for a loop. Maybe with some tweaking, you could
run Sputter in Sputter?

~~~
kode4food
Not _that_ weird of a coincidence, right? The words lisp and sputter are both
related to speech, so I wasn't being overly creative when I came up with the
name.

I wouldn't recommend using my incarnation of sputter just yet. It's not even
close to being production-ready and it's purely interpreted right now and
rather slow.

------
mkirklions
Random and serious question, how many people use this kind of stuff?

It seems extremely niche

>ETH crypto and its language

>Library/tool for a single purpose

>Used for decentralized apps

The decentralized apps are my biggest confusion, but I'm looking for feedback
from people actively developing apps for ETH.

~~~
cdgore
Merkle trees are used extensively in distributed computing. Here's an example:
You have many instances serving assets of some kind replicated in several data
centers. They are structured in an arbitrary number of branches with many
assets in each branch:

    
    
      (root)
        |   \
      (foo)  (bar)---(baz)----[even_more_assets]
        |     |
        |  [many_more_assets]
        |
      [many_assets]
    

How do you make sure the asset trees in the instances are synced up, serving
the same assets?

You could compare every bit across every instance, but that would be very
inefficient. You could compare the hashes of all the assets at each node of
the tree, but you would still end up making many unnecessary comparisons.

You can simply hash each node of the tree based on the hash of its child nodes
/ assets. This forms a Merkle tree. That way, you can simply compare the root
hashes across instances, and if they match, then the whole asset tree must be
the same. If they don't match, compare the hashes at the next level of the
tree until you find the discrepancy, and sync the nodes / assets where the
hashes don't match. Merkle trees can be a very powerful tool for reaching
consensus quickly in distributed systems.

