transaction

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hidden

type Hidden struct {
	Sender     []byte
	Receiver   []byte
	Commitment []byte
	Auxiliary  []byte
	Timestamp  int64
}

Hidden is the struct for hidden transaction

func NewHidden added in v0.1.14

func NewHidden(sender, receiver, commitment, auxiliary []byte, timestamp int64) *Hidden

NewHidden creates a new hidden transaction

func (*Hidden) Serialize added in v0.1.13

func (h *Hidden) Serialize() ([]byte, error)

Serialize returns the hidden transaction's commitment, for Merkle Tree generation purpose

func (*Hidden) ToOnChain added in v0.1.15

func (h *Hidden) ToOnChain() *OnChain

ToOnChain converts a hidden transaction to an on-chain transaction

type OnChain added in v0.1.1

type OnChain struct {
	Sender     string `json:"Sender"`
	Receiver   string `json:"Receiver"`
	Commitment string `json:"Commit"`
	Auxiliary  string `json:"Aux"`
	Timestamp  string `json:"Timestamp"`
}

OnChain is the struct for on-chain transaction

func NewOnChain added in v0.1.14

func NewOnChain(sender, receiver, commitment, auxiliary, timestamp string) *OnChain

NewOnChain creates a new on-chain transaction

func (*OnChain) KeyVal added in v0.1.1

func (o *OnChain) KeyVal() (string, []byte, error)

KeyVal composes the key value pair for the transaction to be stored on-chain

func (*OnChain) ToHide added in v0.1.15

func (o *OnChain) ToHide() (*Hidden, error)

ToHide converts an on-chain transaction to a hidden transaction

type Plain

type Plain struct {
	Sender    string
	Receiver  string
	Amount    int64
	Auxiliary []byte
	Timestamp int64
}

Plain is the struct for plaintext transaction

func NewPlain added in v0.1.14

func NewPlain(sender, receiver string, amount int64) *Plain

NewPlain creates a new plaintext transaction

func (*Plain) Hide

func (p *Plain) Hide(counter uint64, g, h *ed25519.Point, negateHash bool) (*Hidden, error)

Hide converts a plaintext transaction to a hidden transaction

func (*Plain) HidePair added in v0.1.15

func (p *Plain) HidePair(counter uint64, g, h *ed25519.Point) (h1, h2 *Hidden, err error)

HidePair creates the hidden transaction pairs

Jump to

Keyboard shortcuts

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