Skip to content
Graphviz (DOT) templates

Merkle Tree

Binary Merkle tree over four blocks of data with root proof.

Template previewGraphviz (DOT)
mt D1 data 1 H1 H(d1) = h1 D1->H1 D2 data 2 H2 H(d2) = h2 D2->H2 D3 data 3 H3 H(d3) = h3 D3->H3 D4 data 4 H4 H(d4) = h4 D4->H4 H12 H(h1 || h2) = h12 H1->H12 H2->H12 H34 H(h3 || h4) = h34 H3->H34 H4->H34 Root Root = H(h12 || h34) H12->Root H34->Root

What this template contains

Graph
Directed
Edges
10
Source
20 lines

Make it your own.

digraph mt {
  rankdir=BT;
  graph [bgcolor=transparent];
  node [shape=box, style="rounded,filled", fontname=Inter, fontsize=10];

  D1 [label="data 1", fillcolor="#dbeafe"];
  D2 [label="data 2", fillcolor="#dbeafe"];
  D3 [label="data 3", fillcolor="#dbeafe"];
  D4 [label="data 4", fillcolor="#dbeafe"];

  H1 [label="H(d1) = h1", fillcolor="#fef3c7"];
  H2 [label="H(d2) = h2", fillcolor="#fef3c7"];
  H3 [label="H(d3) = h3", fillcolor="#fef3c7"];
  H4 [label="H(d4) = h4", fillcolor="#fef3c7"];

  H12 [label="H(h1 || h2) = h12", fillcolor="#fce7f3"];
  H34 [label="H(h3 || h4) = h34", fillcolor="#fce7f3"];

  Root [label="Root = H(h12 || h34)", fillcolor="#dcfce7"];

  D1 -> H1; D2 -> H2; D3 -> H3; D4 -> H4;
  H1 -> H12; H2 -> H12;
  H3 -> H34; H4 -> H34;
  H12 -> Root; H34 -> Root;
}