ByteEncoder

org.sigilaris.core.codec.byte.ByteEncoder
See theByteEncoder companion object
trait ByteEncoder[A]

Type class for encoding Scala values to deterministic byte sequences.

ByteEncoder provides type-safe encoding of Scala data structures into ByteVector representations suitable for blockchain applications such as transaction signing, block hashing, and merkle tree construction.

The encoding is deterministic: the same value always produces the same byte sequence, ensuring consistency across different platforms and nodes.

Attributes

See also

ByteDecoder for the inverse operation

ByteCodec for bidirectional encoding/decoding

types.md for detailed encoding rules per type

Companion
object
Source
ByteEncoder.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def encode(value: A): ByteVector

Encodes a value to a deterministic byte sequence.

Encodes a value to a deterministic byte sequence.

Value parameters

value

the value to encode

Attributes

Returns

the encoded byte sequence

Source
ByteEncoder.scala

Concrete methods

def contramap[B](f: B => A): ByteEncoder[B]

Creates a new encoder by applying a function before encoding.

Creates a new encoder by applying a function before encoding.

This is the contravariant map operation for encoders.

Value parameters

f

function to transform input before encoding

Attributes

Returns

new encoder for type B

Example
 case class UserId(value: Long)
 given ByteEncoder[UserId] = ByteEncoder[Long].contramap(_.value)
Source
ByteEncoder.scala