types

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CommitmentLen = 32
	ScriptHashLen = 32
	AmountLen     = 8
	AssetIDLen    = 32
	StateLen      = 128
	SaltLen       = 32
)
View Source
const NullifierSize = hash.HashSize

Variables

View Source
var ErrIDStrSize = fmt.Errorf("max ID string length is %v bytes", hash.HashSize*2)
View Source
var IlliumCoinID = NewID(bytes.Repeat([]byte{0x00}, 32))

Functions

This section is empty.

Types

type Amount

type Amount uint64

Amount represents the base illium monetary unit (to be named later). The total number of coins issued is not expected to overflow an uint64 for 250 years from genesis.

type HexEncodable

type HexEncodable []byte

func (HexEncodable) MarshalJSON

func (h HexEncodable) MarshalJSON() ([]byte, error)

func (*HexEncodable) UnmarshalJSON

func (h *HexEncodable) UnmarshalJSON(data []byte) error

type ID

type ID [hash.HashSize]byte

func NewID

func NewID(digest []byte) ID

func NewIDFromData

func NewIDFromData(data []byte) ID

func NewIDFromString

func NewIDFromString(id string) (ID, error)

func (ID) Bytes

func (id ID) Bytes() []byte

func (ID) Clone

func (id ID) Clone() ID

func (ID) Compare

func (id ID) Compare(target ID) int

Compare returns 1 if hash > target, -1 if hash < target and 0 if hash == target.

func (*ID) MarshalJSON

func (id *ID) MarshalJSON() ([]byte, error)

func (*ID) SetBytes

func (id *ID) SetBytes(data []byte)

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(data []byte) error

type Nullifier

type Nullifier [hash.HashSize]byte

func CalculateNullifier

func CalculateNullifier(commitmentIndex uint64, salt [32]byte, scriptCommitment []byte, scriptParams ...[]byte) (Nullifier, error)

CalculateNullifier calculates and returns the nullifier for the given inputs.

func NewNullifier

func NewNullifier(b []byte) Nullifier

func NewNullifierFromString

func NewNullifierFromString(n string) (Nullifier, error)

func (Nullifier) Bytes

func (n Nullifier) Bytes() []byte

func (*Nullifier) MarshalJSON

func (n *Nullifier) MarshalJSON() ([]byte, error)

func (*Nullifier) SetBytes

func (n *Nullifier) SetBytes(data []byte)

func (Nullifier) String

func (n Nullifier) String() string

func (*Nullifier) UnmarshalJSON

func (n *Nullifier) UnmarshalJSON(data []byte) error

type Serializable

type Serializable interface {
	Serialize() ([]byte, error)
	Deserialize(data []byte) error
	MarshalJSON() ([]byte, error)
	UnmarshalJSON(data []byte) error
}

type SpendNote

type SpendNote struct {
	ScriptHash []byte
	Amount     Amount
	AssetID    ID
	State      [StateLen]byte
	Salt       [SaltLen]byte
}

SpendNote holds all the data that makes up an output commitment.

func (*SpendNote) Commitment

func (s *SpendNote) Commitment() (ID, error)

Commitment serializes and hashes the data in the note and returns the hash.

func (*SpendNote) Deserialize

func (s *SpendNote) Deserialize(ser []byte) error

func (*SpendNote) Serialize

func (s *SpendNote) Serialize() []byte

type UnlockingScript

type UnlockingScript struct {
	ScriptCommitment []byte
	ScriptParams     [][]byte
}

func (*UnlockingScript) Hash

func (u *UnlockingScript) Hash() ID

func (*UnlockingScript) Serialize

func (u *UnlockingScript) Serialize() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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