Commit 4ebae359 authored by nanocryk's avatar nanocryk

Merge branch '14-add-informal-explanations-for-merkle-trees-and-proofs' into 'master'

Resolve "Add informal explanations for Merkle trees and proofs"

Closes #14

See merge request !12
parents 3ad5384a 08ab6f4e
......@@ -32,4 +32,59 @@ possible by default to create a token with a *subtree Merkle root* **without** p
verifying its children. Most tokens will forbid this, but it can be used to import a large amount of
somehow trusted tokens into the tree. The main usage is cross-tree communication with trust coming
from an user-based oracle (detailed later in this document), allowing bandswitch and computation
sharding between multiple independent trees.
\ No newline at end of file
sharding between multiple independent trees.
## Merkle trees and proofs
Merkle trees allow to store large sets of data. Each element hash is a leaf of a binary tree, and
each node is the hash of the concatenation of its children. Finally, we only store the root of the
tree called a **Merkle root**.
```mermaid
graph TD
root(root) --> abcd(abcd)
root --> efgh(efgh)
abcd --> ab(ab)
abcd --> cd(cd)
efgh --> ef(ef)
efgh --> gh(gh)
ab --> a(a)
ab --> b(b)
cd --> c(c)
cd --> d(d)
ef --> e(e)
ef --> f(f)
gh --> g(g)
gh --> h(h)
a --> A
b --> B
c --> C
d --> D
e --> E
f --> F
g --> G
h --> H
```
Data is provided with a proof of its presence in the tree called a **Merkle proof**. The proof is
composed of all hashes necessary to recompute the branch from the data leaf and the root.
```mermaid
graph TD
root(root) --> abcd(abcd)
root --> efgh(efgh)
abcd --> ab(ab)
abcd --> cd(cd)
cd --> c(c)
cd --> d(d)
c --> C
```
If data is updated, we can compute its new hash and with the previous proof compute the new one.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment