Appendix A: Complete Element Type Reference

Reading the table. "Element disc" is the bincode discriminant of the Element enum (one byte; persisted at the start of every serialized element). "TreeType disc" is the discriminant of the separate TreeType enum in merk/src/tree_type/mod.rs — it is NOT the same numbering. Most rows list both the TreeType disc and its variant name (e.g. 0 (NormalTree)) to keep the distinction obvious; N/A means the Element variant is not a tree.

Element discVariantTreeType discFieldsCost SizePurpose
0ItemN/A(value, flags)variesBasic key-value storage
1ReferenceN/A(path, max_hop, flags)variesLink between elements
2Tree0 (NormalTree)(root_key, flags)TREE_COST_SIZEContainer for subtrees
3SumItemN/A(value, flags)variesContributes to parent sum
4SumTree1 (SumTree)(root_key, sum, flags)SUM_TREE_COST_SIZEMaintains sum of descendants
5BigSumTree2 (BigSumTree)(root_key, sum128, flags)BIG_SUM_TREE_COST_SIZE128-bit sum tree
6CountTree3 (CountTree)(root_key, count, flags)COUNT_TREE_COST_SIZEElement counting tree
7CountSumTree4 (CountSumTree)(root_key, count, sum, flags)COUNT_SUM_TREE_COST_SIZECombined count + sum
8ProvableCountTree5 (ProvableCountTree)(root_key, count, flags)COUNT_TREE_COST_SIZEProvable count tree
9ItemWithSumItemN/A(value, sum, flags)variesItem with sum contribution
10ProvableCountSumTree6 (ProvableCountSumTree)(root_key, count, sum, flags)COUNT_SUM_TREE_COST_SIZEProvable count + sum (only count in hash)
11CommitmentTree7 (CommitmentTree)(total_count: u64, chunk_power: u8, flags)12ZK-friendly Sinsemilla + BulkAppendTree
12MmrTree8 (MmrTree)(mmr_size: u64, flags)11Append-only MMR log
13BulkAppendTree9 (BulkAppendTree)(total_count: u64, chunk_power: u8, flags)12High-throughput append-only log
14DenseAppendOnlyFixedSizeTree10 (DenseAppendOnlyFixedSizeTree)(count: u16, height: u8, flags)6Dense fixed-capacity Merkle storage
15NonCountedwrapperBox<Element>inner + 1 byteOpts inner out of parent count aggregation
16NotSummedwrapperBox<Element>inner + 1 byteOpts inner out of parent sum aggregation
17ProvableSumTree11 (ProvableSumTree)(root_key, sum: i64, flags)SUM_TREE_COST_SIZESum baked into hash (see Aggregate Sum on Range Queries)

Notes:

  • Discriminants 11–14 are non-Merk trees: data lives outside a child Merk subtree
    • All four store non-Merk data in the data column
    • CommitmentTree stores its Sinsemilla frontier alongside BulkAppendTree entries in the same data column (key b"__ct_data__")
  • Non-Merk trees do NOT have a root_key field — their type-specific root hash flows as the Merk child hash via insert_subtree
  • CommitmentTree uses Sinsemilla hashing (Pallas curve); all others use Blake3
  • Cost behavior for non-Merk trees follows NormalTree (BasicMerkNode, no aggregation)
  • DenseAppendOnlyFixedSizeTree count is u16 (max 65,535); heights restricted to 1..=16