MerkleTrieNode

org.sigilaris.core.merkle.MerkleTrieNode
See theMerkleTrieNode companion object
sealed trait MerkleTrieNode

Represents a node in a Merkle Trie.

Merkle Trie consists of three types of nodes:

  • Leaf: Terminal node storing a key-value pair
  • Branch: Branch node with only child nodes
  • BranchWithData: Branch node with both child nodes and a value

Attributes

See also

MerkleTrieNode.Leaf for terminal nodes

MerkleTrieNode.Branch for branch nodes

MerkleTrieNode.BranchWithData for branch nodes with values

Example
 val leaf = MerkleTrieNode.leaf(
   prefix = ByteVector(0x12, 0x34).toNibbles,
   value = ByteVector(0xab, 0xcd),
 )
Companion
object
Source
MerkleTrieNode.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Branch
class Leaf

Members list

Value members

Abstract methods

Returns the prefix nibbles of this node.

Returns the prefix nibbles of this node.

Attributes

Source
MerkleTrieNode.scala

Concrete methods

def getChildren: Option[Children]

Returns the children array if this node has children.

Returns the children array if this node has children.

Attributes

Returns

Some(children) for Branch or BranchWithData, None for Leaf

Source
MerkleTrieNode.scala
def getValue: Option[ByteVector]

Returns the value stored in this node if present.

Returns the value stored in this node if present.

Attributes

Returns

Some(value) for Leaf or BranchWithData, None for Branch

Source
MerkleTrieNode.scala

Returns a new node with the updated children.

Returns a new node with the updated children.

Value parameters

children

the new children array

Attributes

Returns

node with updated children

Source
MerkleTrieNode.scala

Returns a new node with the updated prefix.

Returns a new node with the updated prefix.

Value parameters

prefix

the new prefix

Attributes

Returns

node with updated prefix

Source
MerkleTrieNode.scala
def setValue(value: ByteVector): MerkleTrieNode

Returns a new node with the updated value.

Returns a new node with the updated value.

Value parameters

value

the new value

Attributes

Returns

node with updated value

Source
MerkleTrieNode.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
MerkleTrieNode.scala