token

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	// Type is the type of the token
	Type string
	// Value is the quantity of the token
	Value *math.Zr
	// BlindingFactor is the blinding factor used to commit type and value
	BlindingFactor *math.Zr
	// Owner is the owner of the token
	Owner []byte
	// Issuer is the issuer of the token, if defined
	Issuer []byte
}

Metadata contains the metadata of a token

func (*Metadata) Deserialize

func (m *Metadata) Deserialize(b []byte) error

Deserialize un-marshals Metadata

func (*Metadata) Serialize

func (m *Metadata) Serialize() ([]byte, error)

Serialize un-marshals Metadata

type Token

type Token struct {
	// Owner is the owner of the token
	Owner []byte
	// Data is the Pedersen commitment to type and value
	Data *math.G1
}

Token encodes Type, Value, Owner

func (*Token) Deserialize

func (t *Token) Deserialize(bytes []byte) error

Deserialize unmarshals Token

func (*Token) GetCommitment

func (t *Token) GetCommitment() *math.G1

GetCommitment returns the Pedersen commitment in Token

func (*Token) GetTokenInTheClear

func (t *Token) GetTokenInTheClear(meta *Metadata, pp *crypto.PublicParams) (*token2.Token, error)

GetTokenInTheClear returns Token in the clear

func (*Token) IsRedeem

func (t *Token) IsRedeem() bool

IsRedeem returns true if the token has an empty owner field

func (*Token) Serialize

func (t *Token) Serialize() ([]byte, error)

Serialize marshals Token

type TokenDataWitness

type TokenDataWitness struct {
	Type           string
	Value          *math.Zr
	BlindingFactor *math.Zr
}

TokenDataWitness contains the opening of Data in Token

func GetTokensWithWitness

func GetTokensWithWitness(values []uint64, ttype string, pp []*math.G1, c *math.Curve) ([]*math.G1, []*TokenDataWitness, error)

func NewTokenDataWitness

func NewTokenDataWitness(ttype string, values, bfs []*math.Zr) []*TokenDataWitness

NewTokenDataWitness returns an array of TokenDataWitness that corresponds to the passed arguments

func (*TokenDataWitness) Clone

func (tdw *TokenDataWitness) Clone() *TokenDataWitness

Clone produces a copy of TokenDataWitness

Jump to

Keyboard shortcuts

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