note

package
v0.0.0-...-241d3e1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ID    uint64
	Value uint32
}

Data contains the data of a note

func New

func New(value uint32) (*Data, error)

New generate a new note data struct with a random ID and the given value it must be signed by the issuer and then converted to a Note using Data.ToNote(signature)

func (*Data) Deserialize

func (n *Data) Deserialize(data []byte) error

Deserialize converts a byte slice to Data

func (*Data) Hash

func (n *Data) Hash() []byte

Hash returns the SHA256 hash of the serialized Data

func (*Data) Serialize

func (n *Data) Serialize() []byte

Serialize converts Data to a byte slice

func (*Data) ToNote

func (n *Data) ToNote(signature []byte) *Note

ToNote creates a Note from Data with the given signature

type Note

type Note struct {
	Data
	Signature []byte
}

Note represents a note signed by the issuer

func NewFromString

func NewFromString(s string) (*Note, error)

NewFromString converts a base58 encoded string with HRP to a Note

func (*Note) Deserialize

func (n *Note) Deserialize(data []byte) error

Deserialize converts a byte slice to a Note

func (*Note) Serialize

func (n *Note) Serialize() []byte

Serialize converts the Note to a byte slice

func (Note) String

func (n Note) String() string

String converts the Note to a base58 encoded string with HRP

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL