1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-02-23 15:38:22 +00:00

BIP-0098: Fast Merkle Trees

This commit is contained in:
Karl-Johan Alm
2017-11-14 17:39:23 +09:00
parent 5c48bcc5ae
commit e61b25087d
10 changed files with 449 additions and 0 deletions

6
bip-0098/build.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
dot -Tpng -o node-variants.png node-variants.dot
dot -Tpng -o skip-skip.png skip-skip.dot
dot -Tpng -o traversal-example.png traversal-example.dot
dot -Tpng -o unbalanced-hash-tree.png unbalanced-hash-tree.dot

View File

@@ -0,0 +1,85 @@
digraph G {
row1 [shape=none, label=""]
A [label="000"]
A -> Al [label="L"]
Al [label="VERIFY"]
A -> Ar [label="R"]
Ar [label="SKIP"]
B [label="001"]
B -> Bl [label="L"]
Bl [label="VERIFY"]
B -> Br [label="R"]
Br [label="VERIFY"]
{ rank = same; row1; A; B; }
C [label="010"]
C -> Cl [label="L"]
Cl [label="VERIFY"]
C -> Cr [label="R"]
Cr [label="DESCEND"]
Cr -> Crl
Crl [label="..."]
Cr -> Crr
Crr [label="..."]
D [label="011"]
D -> Dl [label="L"]
Dl [label="DESCEND"]
Dl -> Dll
Dll [label="..."]
Dl -> Dlr
Dlr [label="..."]
D -> Dr [label="R"]
Dr [label="SKIP"]
E [label="100"]
E -> El [label="L"]
El [label="DESCEND"]
El -> Ell
Ell [label="..."]
El -> Elr
Elr [label="..."]
E -> Er [label="R"]
Er [label="VERIFY"]
row1 -> invis [style=invis]
invis [shape=none, label=""]
invis -> C [style=invis]
{ rank = same; C; D; E; }
F [label="101"]
F -> Fl [label="L"]
Fl [label="DESCEND"]
Fl -> Fll
Fll [label="..."]
Fl -> Flr
Flr [label="..."]
F -> Fr [label="R"]
Fr [label="DESCEND"]
Fr -> Frl
Frl [label="..."]
Fr -> Frr
Frr [label="..."]
G [label="110"]
G -> Gl [label="L"]
Gl [label="SKIP"]
G -> Gr [label="R"]
Gr [label="VERIFY"]
H [label="111"]
H -> Hl [label="L"]
Hl [label="SKIP"]
H -> Hr [label="R"]
Hr [label="DESCEND"]
Hr -> Hrl
Hrl [label="..."]
Hr -> Hrr
Hrr [label="..."]
Crl -> F [style=invis]
{ rank = same; F; G; H; }
}

BIN
bip-0098/node-variants.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

7
bip-0098/skip-skip.dot Normal file
View File

@@ -0,0 +1,7 @@
digraph G {
A [label="???"]
A -> Al [label="L"]
Al [label="SKIP"]
A -> Ar [label="R"]
Ar [label="SKIP"]
}

BIN
bip-0098/skip-skip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,32 @@
digraph G {
a [label="A\n101"]
a -> b
a -> c
b [label="B\n111"]
b -> s0
s0 [label="SKIP\n0x00..."]
b -> d
d [label="D\n011"]
d -> f
d -> s1
s1 [label="SKIP\n0x22..."]
f [label="F\n000"]
f -> v1
v1 [label="VERIFY\n0x55..."]
f -> s2
s2 [label="SKIP\n0x66..."]
c [label="C\n010"]
c -> v2
v2 [label="VERIFY\n0x11..."]
c -> e
e [label="E\n001"]
e -> v3
v3 [label="VERIFY\n0x33..."]
e -> v4
v4 [label="VERIFY\n0x44..."]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@@ -0,0 +1,11 @@
digraph G {
0 [label="Root\nH(A || H(B || C))"]
0 -> A
A [label="A\nskip"]
0 -> 1
1 [label="Node\nH(B || C)"]
1 -> B
B [label="B\nskip"]
1 -> C
C [label="C\nverify"]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB