MerkleTrieNode

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

Companion object for MerkleTrieNode with constructors and type definitions.

Attributes

Companion
trait
Source
MerkleTrieNode.scala
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

final case class Branch(prefix: Nibbles, children: Children) extends MerkleTrieNode

Branch node with only child nodes.

Branch node with only child nodes.

Value parameters

children

array of 16 optional child node hashes

prefix

the common prefix for all children

Attributes

Source
MerkleTrieNode.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class BranchWithData(prefix: Nibbles, children: Children, value: ByteVector) extends MerkleTrieNode

Branch node with both child nodes and a value.

Branch node with both child nodes and a value.

Value parameters

children

array of 16 optional child node hashes

prefix

the common prefix for all children

value

the value stored at this branch

Attributes

Source
MerkleTrieNode.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Children

Companion object for Children providing constructors.

Companion object for Children providing constructors.

Attributes

Source
MerkleTrieNode.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Children.type
final case class Leaf(prefix: Nibbles, value: ByteVector) extends MerkleTrieNode

Terminal node storing a key-value pair.

Terminal node storing a key-value pair.

Value parameters

prefix

the key suffix for this leaf

value

the value stored in this leaf

Attributes

Source
MerkleTrieNode.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Types

type Children = IronType[Vector[Option[MerkleHash]], ChildrenCondition]

Array of 16 optional child node hashes.

Array of 16 optional child node hashes.

Attributes

Source
MerkleTrieNode.scala
type ChildrenCondition = Length[StrictEqual[16]]

Refinement constraint requiring exactly 16 elements in a Children vector.

Refinement constraint requiring exactly 16 elements in a Children vector.

Attributes

Source
MerkleTrieNode.scala

Hash value of a Merkle Trie node.

Hash value of a Merkle Trie node.

Attributes

Source
MerkleTrieNode.scala

Root hash of a Merkle Trie.

Root hash of a Merkle Trie.

Attributes

Source
MerkleTrieNode.scala

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
Source
Mirror.scala
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

def branch(prefix: Nibbles, children: Children): MerkleTrieNode

Creates a branch node.

Creates a branch node.

Value parameters

children

the children array

prefix

the common prefix

Attributes

Returns

new Branch node

Source
MerkleTrieNode.scala
def branchWithData(prefix: Nibbles, children: Children, value: ByteVector): MerkleTrieNode

Creates a branch node with data.

Creates a branch node with data.

Value parameters

children

the children array

prefix

the common prefix

value

the value to store

Attributes

Returns

new BranchWithData node

Source
MerkleTrieNode.scala
def leaf(prefix: Nibbles, value: ByteVector): MerkleTrieNode

Creates a leaf node.

Creates a leaf node.

Value parameters

prefix

the key suffix

value

the value to store

Attributes

Returns

new Leaf node

Source
MerkleTrieNode.scala

Givens

Givens

Cats Eq instance for MerkleTrieNode.

Cats Eq instance for MerkleTrieNode.

Attributes

Source
MerkleTrieNode.scala

Decodes a MerkleTrieNode from bytes.

Decodes a MerkleTrieNode from bytes.

Decoding format:

  • Leaf: 1 + prefix + value
  • Branch: 2 + prefix + children
  • BranchWithData: 3 + prefix + children + value

Attributes

Source
MerkleTrieNode.scala

Encodes a MerkleTrieNode to bytes.

Encodes a MerkleTrieNode to bytes.

Encoding format:

  • Leaf: 1 + prefix + value
  • Branch: 2 + prefix + children
  • BranchWithData: 3 + prefix + children + value

Attributes

Source
MerkleTrieNode.scala

Hash instance for MerkleTrieNode.

Hash instance for MerkleTrieNode.

Attributes

Source
MerkleTrieNode.scala

Extensions

Extensions

extension (c: Children)
def updateChild(i: Int, v: Option[MerkleHash]): Children

Updates a child at the given index.

Updates a child at the given index.

Value parameters

i

index (0-15)

v

new child hash value

Attributes

Returns

updated children array

Source
MerkleTrieNode.scala