check

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 9 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidSig represents error on given v, r, s values
	ErrInvalidSig = errors.New("invalid transaction v, r, s values")
)

Functions

This section is empty.

Types

type Check

type Check struct {
	Nonce    []byte
	ChainID  types.ChainID
	DueBlock uint64
	Coin     types.CoinID
	Value    *big.Int
	GasCoin  types.CoinID
	Lock     *big.Int
	V        *big.Int
	R        *big.Int
	S        *big.Int
}

Check is like an ordinary bank check. Each user of network can issue check with any amount of coins and pass it to another person. Receiver will be able to cash a check from arbitrary account.

Nonce - unique "id" of the check. Coin Symbol - symbol of coin. Value - amount of coins. GasCoin - symbol of a coin to pay fee. DueBlock - defines last block height in which the check can be used. Lock - secret to prevent hijacking. V, R, S - signature of issuer.

func DecodeFromBytes

func DecodeFromBytes(buf []byte) (*Check, error)

DecodeFromBytes decodes check from bytes

func (*Check) Hash

func (check *Check) Hash() types.Hash

Hash returns a types.Hash to be used in process of signing a Check by sender

func (*Check) HashWithoutLock added in v0.5.0

func (check *Check) HashWithoutLock() types.Hash

HashWithoutLock returns a types.Hash to be used in process of signing and checking Lock

func (*Check) LockPubKey

func (check *Check) LockPubKey() ([]byte, error)

LockPubKey returns bytes of public key, which is used for proving check's recipient rights

func (*Check) Sender

func (check *Check) Sender() (types.Address, error)

Sender returns sender's address of a Check, recovered from signature

func (*Check) Sign added in v0.5.0

func (check *Check) Sign(prv *ecdsa.PrivateKey) error

Sign signs the check with given private key, returns error

func (*Check) String

func (check *Check) String() string

Jump to

Keyboard shortcuts

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