From 6b0a08eeade082b0c045314ae2b68bc081509e24 Mon Sep 17 00:00:00 2001
From: nanocryk
Date: Tue, 29 May 2018 11:20:26 +0200
Subject: [PATCH 1/2] merkle tree and proof explanation

whitepaper.md  84 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 83 insertions(+), 1 deletion()
diff git a/whitepaper.md b/whitepaper.md
index e88fc15..d643e09 100644
 a/whitepaper.md
+++ b/whitepaper.md
@@ 32,4 +32,86 @@ 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 crosstree communication with trust coming
from an userbased 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
+
+ classDef default fill:#fff,stroke:#111,strokewidth:1px;
+```
+
+Data is provided with a proof of its presence in the tree called a **Merkle proof**. The proof is
+composed of all hashes (in green) necessary to recompute the branch from the data leaf and the root
+(in blue).
+
+```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
+
+ classDef default fill:#fff,stroke:#111,strokewidth:1px;
+
+ classDef provided fill:#afa,stroke:#1f1,strokewidth:1px;
+ class C,d,ab,efgh provided;
+
+ classDef computed fill:#aff,stroke:#1ff,strokewidth:1px;
+ class c,cd,abcd,root computed;
+```
+
+If data is updated, we can compute its new hash and with the previous proof compute the new one (the green ones stay the same, but the blue ones are updated)
\ No newline at end of file

GitLab
From 08ab6f4e7ca25444bde98d8190d18e12b3bba5bc Mon Sep 17 00:00:00 2001
From: nanocryk
Date: Tue, 29 May 2018 11:26:10 +0200
Subject: [PATCH 2/2] gitlab don't seem to support mermaid classes, modify
diagrams in consequence

whitepaper.md  31 ++
1 file changed, 2 insertions(+), 29 deletions()
diff git a/whitepaper.md b/whitepaper.md
index d643e09..d9bd53d 100644
 a/whitepaper.md
+++ b/whitepaper.md
@@ 68,13 +68,10 @@ graph TD
f > F
g > G
h > H

 classDef default fill:#fff,stroke:#111,strokewidth:1px;
```
Data is provided with a proof of its presence in the tree called a **Merkle proof**. The proof is
composed of all hashes (in green) necessary to recompute the branch from the data leaf and the root
(in blue).
+composed of all hashes necessary to recompute the branch from the data leaf and the root.
```mermaid
graph TD
@@ 84,34 +81,10 @@ graph TD
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

 classDef default fill:#fff,stroke:#111,strokewidth:1px;

 classDef provided fill:#afa,stroke:#1f1,strokewidth:1px;
 class C,d,ab,efgh provided;

 classDef computed fill:#aff,stroke:#1ff,strokewidth:1px;
 class c,cd,abcd,root computed;
```
If data is updated, we can compute its new hash and with the previous proof compute the new one (the green ones stay the same, but the blue ones are updated)
\ No newline at end of file
+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

GitLab